You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT date_part('seconds', interval '1 hour');
-- returns 3600, but the result should be 0SELECT date_part('seconds', interval '1 hour 5 second');
--- returns 3605, should return 5SELECT date_part('seconds', interval '3605 seconds');
--- returns 3605, should return 5
It seems that for intervals at least the date part is calculating based on the overall interval, not the specifically requested part. Postgresql has this note about date_part and interval:
When processing an interval value, the extract function produces field values that match the interpretation used by the interval output function. This can produce surprising results if one starts with a non-normalized interval representation, for example:
SELECT INTERVAL '80 minutes';
Result: 01:20:00
SELECT EXTRACT(MINUTES FROM INTERVAL '80 minutes');
Result: 20
Describe the bug
Splitting out from #14738 (comment):
It seems that for intervals at least the date part is calculating based on the overall interval, not the specifically requested part. Postgresql has this note about date_part and interval:
https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
To Reproduce
No response
Expected behavior
I believe DataFusion should mirror PG in this behaviour.
Additional context
No response
The text was updated successfully, but these errors were encountered: