Dandandan opened a new issue, #22215:
URL: https://github.com/apache/datafusion/issues/22215
### Describe the bug
`date_bin` can panic during planning/constant folding when computing the
distance for a negative timestamp near `i64::MIN`.
### To Reproduce
```sql
EXPLAIN SELECT date_bin(
INTERVAL '3 nanoseconds',
arrow_cast(-9223372036854775808, 'Timestamp(Nanosecond, None)'),
TIMESTAMP '1970-01-01 00:00:00'
);
```
### Actual behavior
```text
thread 'main' panicked at
datafusion/functions/src/datetime/date_bin.rs:338:9:
attempt to subtract with overflow
```
### Expected behavior
Return a planning error for the unrepresentable bin computation instead of
panicking.
--
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]