Dandandan opened a new issue, #1:
URL: https://github.com/apache/datafusion/issues/1
### Describe the bug
`lead` panics during planning when given `i64::MIN` as the offset. The
implementation negates lead offsets, and negating `i64::MIN` overflows.
### To Reproduce
```sql
EXPLAIN SELECT lead(x, -9223372036854775808) OVER (ORDER BY x)
FROM (VALUES (1)) AS t(x);
```
### Actual behavior
```text
thread 'main' panicked at .../library/core/src/ops/arith.rs:
attempt to negate with overflow
```
### Expected behavior
Return a planning error for an invalid offset, not a panic.
### Notes
The SQL reaches `datafusion/functions-window/src/lead_lag.rs`, where
`WindowShiftKind::Lead` maps the offset through `v.neg()`.
--
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]