Linhong Liu created SPARK-51757:
-----------------------------------

             Summary: `LEAD` causes NullPointerException in window function
                 Key: SPARK-51757
                 URL: https://issues.apache.org/jira/browse/SPARK-51757
             Project: Spark
          Issue Type: Task
          Components: SQL
    Affects Versions: 4.0.0, 4.1.0
            Reporter: Linhong Liu


Issue:
```
select lead(id, 3, id) over (partition by div(id, 2) order by id) from range(0, 
10, 1, 1)
```
throws
```
[info]   org.apache.spark.SparkException: Job aborted due to stage failure: 
Task 0 in stage 0.0 failed 1 times, most recent failure: Lost task 0.0 in stage 
0.0 (TID 0): java.lang.
NullPointerException: Cannot invoke 
"org.apache.spark.sql.catalyst.expressions.SpecializedGetters.isNullAt(int)" 
because "<local2>" is null
[info]  at 
org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificMutableProjection.apply(Unknown
 Source)
[info]  at 
org.apache.spark.sql.execution.window.OffsetWindowFunctionFrameBase.prepare(WindowFunctionFrame.scala:186)
[info]  at 
org.apache.spark.sql.execution.window.WindowEvaluatorFactory$WindowPartitionEvaluator$$anon$1.fetchNextPartition(WindowEvaluatorFactory.scala:108)
[info]  at
...
```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to