You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "Dandandan (via GitHub)" <gi...@apache.org> on 2026/05/15 19:32:08 UTC

[I] panic: date_trunc unwraps out-of-range lower-bound timestamp truncation [datafusion]

Dandandan opened a new issue, #22214:
URL: https://github.com/apache/datafusion/issues/22214

   ### Describe the bug
   
   `date_trunc` can panic during planning/constant folding for lower-bound nanosecond timestamps. Truncating to a coarser unit can produce a value outside Arrow's nanosecond timestamp range, and the code unwraps `None`.
   
   ### To Reproduce
   
   ```sql
   EXPLAIN SELECT date_trunc('year', TIMESTAMP '1677-09-22 00:00:00');
   ```
   
   ### Actual behavior
   
   ```text
   thread 'main' panicked at datafusion/functions/src/datetime/date_trunc.rs:649:14:
   called `Option::unwrap()` on a `None` value
   ```
   
   ### Expected behavior
   
   Return an error or NULL for an out-of-range truncated timestamp; do not panic.
   
   ### Notes
   
   Other coarse granularities near the lower nanosecond timestamp bound hit the same unwrap.


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] panic: date_trunc unwraps out-of-range lower-bound timestamp truncation [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #22214: panic: date_trunc unwraps out-of-range lower-bound timestamp truncation
URL: https://github.com/apache/datafusion/issues/22214


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] panic: date_trunc unwraps out-of-range lower-bound timestamp truncation [datafusion]

Posted by "Sean-Kenneth-Doherty (via GitHub)" <gi...@apache.org>.
Sean-Kenneth-Doherty commented on issue #22214:
URL: https://github.com/apache/datafusion/issues/22214#issuecomment-4469986856

   take


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org