mhilton commented on issue #8899:
URL: 
https://github.com/apache/arrow-datafusion/issues/8899#issuecomment-1900598499

   > Would 
https://docs.rs/chrono/latest/chrono/offset/enum.LocalResult.html#method.earliest
 work instead?
   
   I don't think it would, at least not in all cases. If we take the two times:
   
   - `2024-10-27 02:30:00 +0100` (CET)
   - `2024-10-27 02:30:00 +0200` (CEST)
   
   which are both valid in the `Europe/Berlin` timezone. Then using `earliest` 
in a `date_trunc('hour', ...)` function would cause the result for the latter 
time to be `2024-10-27 02:00:00 +0100` essentially truncating to the wrong hour.
   
   My thought is that in cases where the result is `Ambiguous` then the value 
that has the same offset as the input time should be chosen.
   
   > Edit: this approach will still fail if the provided timestamp is invalid
   
   Is it possible for an invalid input value to get as far as the `date_trunc` 
function, or would it be caught sooner in the processing?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to