Use Duration
as the result of timestamp - timestamp
rather than Interval
#7068
Labels
enhancement
New feature or request
Is your feature request related to a problem or challenge?
Intervals (e.g.
1 month
, which is a different number of days depending on the relative dates) and Durations (e.g.12321 seconds
) and arithmetic have (subltely) different semanticsSQL exposes intervals (not Durations), as the
INTERVAL
typeDataFusion has historically used intervals inconsistently
For example, subtracting timestamps that are one year apart results in an interval of 365 days, not 1 year
Subtracting 11 months results in an interval of 334 days, rather than 11 months.
It appears that the current code assumes a day is 24 hours (which is not always correct given leap seconds, and other date/time oddities):
Describe the solution you'd like
To avoid inconsistencies and make sure the semantics are clear, @tustvold proposes to change timestamp / timestamp arithmetic to use Durations consistently. This will mean subtracting two timestamps will result in an actual
Duration
array rather than anInterval
which really encodes a durationDescribe alternatives you've considered
Leave the existing system as is
Additional context
No response
The text was updated successfully, but these errors were encountered: