Dandandan opened a new issue, #22210:
URL: https://github.com/apache/datafusion/issues/22210
### Describe the bug
`date_bin` panics during planning/constant folding when subtracting an
extreme timestamp origin from an extreme source timestamp.
### To Reproduce
```sql
EXPLAIN SELECT date_bin(
INTERVAL '1 nanosecond',
arrow_cast(9223372036854775807, 'Timestamp(Nanosecond, None)'),
arrow_cast(-9223372036854775808, 'Timestamp(Nanosecond, None)')
);
```
### Actual behavior
```text
thread 'main' panicked at
datafusion/functions/src/datetime/date_bin.rs:324:21:
attempt to subtract with overflow
```
### Expected behavior
DataFusion should return a planning error for the unrepresentable timestamp
difference, not panic.
### Notes
The failing operation is the source-origin difference in the `date_bin`
implementation.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]