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

   ### Describe the bug
   
   `nth_value` panics during execution when given `i64::MIN` as the `n` 
argument. The evaluator negates negative `n` values for reverse indexing.
   
   ### To Reproduce
   
   ```sql
   SELECT nth_value(x, -9223372036854775808) OVER (ORDER BY x)
   FROM (VALUES (1)) AS t(x);
   ```
   
   ### Actual behavior
   
   ```text
   thread 'main' panicked at 
datafusion/functions-window/src/nth_value.rs:417:45:
   attempt to negate with overflow
   ```
   
   ### Expected behavior
   
   Return an execution error for an invalid `n` value, not a panic.


-- 
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]

Reply via email to