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
{{ message }}
Repository navigation
date_trunc always returns Timestamp(Nanosecond, None) which might truncate ranges #6653
However, by using Timestamp(Nanosecond, None) everywhere will truncate the range over which date_trunc will work -- specifically if there is some value that can be represented using Timestamp(Second) that doesn't fit into a Timestamp(Nanosecond) such as a value before 1677-09-21 00:12:43.145224193 or after 2262-04-11 23:47:16.854775807 date_trunc will error.
Describe the solution you'd like
We could potentially change the function to keep the same TimeUnit of its input:
If granularity parameter is smaller than second, e.g. millisecond, or nanosecond, what is the expected behavior? Returns original input, or throws an error?
If granularity parameter is smaller than second, e.g. millisecond, or nanosecond, what is the expected behavior? Returns original input, or throws an error?
I would think returning the original would make the most sense and still be accurate. But it definitely wouldn't be very useful 🤔
Activity
viirya commentedon Jun 12, 2023
If
granularityparameter is smaller than second, e.g. millisecond, or nanosecond, what is the expected behavior? Returns original input, or throws an error?alamb commentedon Jun 12, 2023
I would think returning the original would make the most sense and still be accurate. But it definitely wouldn't be very useful 🤔