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
SELECT nth_value(x, -9223372036854775808) OVER (ORDER BY x)
FROM (VALUES (1)) AS t(x);
Actual behavior
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.
Describe the bug
nth_valuepanics during execution when giveni64::MINas thenargument. The evaluator negates negativenvalues for reverse indexing.To Reproduce
Actual behavior
Expected behavior
Return an execution error for an invalid
nvalue, not a panic.