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
EXPLAIN SELECT date_trunc('year', TIMESTAMP '1677-09-22 00:00:00');
Actual behavior
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.
Describe the bug
date_trunccan 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 unwrapsNone.To Reproduce
Actual behavior
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.