You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SPARK-45652][SQL][3.4] SPJ: Handle empty input partitions after dynamic filtering
This is a cherry-pick of apache#43531 to branch-3.4, with a few modifications.
### What changes were proposed in this pull request?
Handle the case when input partitions become empty after V2 dynamic filtering, when SPJ is enabled.
### Why are the changes needed?
Current in the situation when all input partitions are filtered out via dynamic filtering, SPJ doesn't work but instead will panic:
```
java.util.NoSuchElementException: None.get
at scala.None$.get(Option.scala:529)
at scala.None$.get(Option.scala:527)
at org.apache.spark.sql.execution.datasources.v2.BatchScanExec.filteredPartitions$lzycompute(BatchScanExec.scala:108)
at org.apache.spark.sql.execution.datasources.v2.BatchScanExec.filteredPartitions(BatchScanExec.scala:65)
at org.apache.spark.sql.execution.datasources.v2.BatchScanExec.inputRDD$lzycompute(BatchScanExec.scala:136)
at org.apache.spark.sql.execution.datasources.v2.BatchScanExec.inputRDD(BatchScanExec.scala:135)
at org.apache.spark.sql.boson.BosonBatchScanExec.inputRDD$lzycompute(BosonBatchScanExec.scala:28)
```
This is because the `groupPartitions` method will return `None` in this scenario. We should handle the case.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Added a test case for this.
### Was this patch authored or co-authored using generative AI tooling?
No
Closesapache#43539 from sunchao/SPARK-45652-branch-3.4.
Authored-by: Chao Sun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
0 commit comments