https://github.com/apache/spark
Revision 8f6a3a50b4b86bed008250824b0c304df9952762 authored by Ivan Sadikov on 02 May 2022, 23:30:05 UTC, committed by Hyukjin Kwon on 02 May 2022, 23:35:18 UTC
This PR fixes the issue described in https://issues.apache.org/jira/browse/SPARK-39084 where calling `df.rdd.isEmpty()` on a particular dataset could result in a JVM crash and/or executor failure.

The issue was due to Python iterator not being synchronised with Java iterator so when the task is complete, the Python iterator continues to process data. We have introduced ContextAwareIterator as part of https://issues.apache.org/jira/browse/SPARK-33277 but we did not fix all of the places where this should be used.

Fixes the JVM crash when checking isEmpty() on a dataset.

No.

I added a test case that reproduces the issue 100%. I confirmed that the test fails without the fix and passes with the fix.

Closes #36425 from sadikovi/fix-pyspark-iter-2.

Authored-by: Ivan Sadikov <ivan.sadikov@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
(cherry picked from commit 9305cc744d27daa6a746d3eb30e7639c63329072)
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
1 parent be52490
History
Tip revision: 8f6a3a50b4b86bed008250824b0c304df9952762 authored by Ivan Sadikov on 02 May 2022, 23:30:05 UTC
[SPARK-39084][PYSPARK] Fix df.rdd.isEmpty() by using TaskContext to stop iterator on task completion
Tip revision: 8f6a3a5

README.md

back to top