Describe the bug
The whole-partition evaluation path for LEAD and LAG with IGNORE NULLS calls array.nulls().unwrap(). Arrow arrays containing no null values commonly omit the null bitmap, so evaluating either function on such an array panics.
To Reproduce
Evaluate LEAD or LAG with IGNORE NULLS through PartitionEvaluator::evaluate_all using an array constructed without nulls, for example:
let array = Int32Array::from(vec![1, 2, 3]);
assert!(array.nulls().is_none());
The evaluation panics with:
called `Option::unwrap()` on a `None` value
Expected behavior
IGNORE NULLS should behave like the regular shift when the input contains no null values, returning the expected LEAD or LAG result without requiring a null bitmap.
Additional context
The panic is in evaluate_all_with_ignore_null in datafusion/functions-window/src/lead_lag.rs.
Describe the bug
The whole-partition evaluation path for
LEADandLAGwithIGNORE NULLScallsarray.nulls().unwrap(). Arrow arrays containing no null values commonly omit the null bitmap, so evaluating either function on such an array panics.To Reproduce
Evaluate
LEADorLAGwithIGNORE NULLSthroughPartitionEvaluator::evaluate_allusing an array constructed without nulls, for example:The evaluation panics with:
Expected behavior
IGNORE NULLSshould behave like the regular shift when the input contains no null values, returning the expectedLEADorLAGresult without requiring a null bitmap.Additional context
The panic is in
evaluate_all_with_ignore_nullindatafusion/functions-window/src/lead_lag.rs.