appletreeisyellow opened a new issue, #8899:
URL: https://github.com/apache/arrow-datafusion/issues/8899

   ### Describe the bug
   
   `date_trunc()` panicked when a timestamp is casted to a timezone other than 
UTC
   
   For example, this query causes a panic:
   
   ```sql
   SELECT date_trunc('week', arrow_cast(arrow_cast('2023-10-29T00:00:00Z', 
'Timestamp(Nanosecond, Some("UTC"))'), 'Timestamp(Nanosecond, 
Some("Europe/Berlin"))'));
   ```
   
   
   ### To Reproduce
   
   Run the above query in DataFusion CLI v34.0.0
   
   ```sql
   $ datafusion-cli
   
   DataFusion CLI v34.0.0
   ❯ SELECT date_trunc('week', arrow_cast(arrow_cast('2023-10-29T00:00:00Z', 
'Timestamp(Nanosecond, Some("UTC"))'), 'Timestamp(Nanosecond, 
Some("Europe/Berlin"))'));
   thread 'main' panicked at 
/private/tmp/datafusion-20231217-5103-4z8blm/arrow-datafusion-34.0.0/datafusion/physical-expr/src/datetime_expressions.rs:335:14:
   called `Option::unwrap()` on a `None` value
   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   ```
   
   ### Expected behavior
   
   Handle the result correctly or return an error instead of panicking
   
   ### Additional context
   
   _No response_


-- 
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