pan3793 opened a new pull request, #58514: URL: https://github.com/apache/spark/pull/58514
### What changes were proposed in this pull request? Extend the per-join-type partition filtering that `spark.sql.sources.v2.bucketing.partition.filter.enabled` applies in `EnsureRequirements.mergeAndDedupPartitions` to the join types that were falling through to the no-filtering default: | Key groups kept | Join types | |---|---| | present on both sides | `Inner`, **`Cross`**, **`LeftSemi`** | | left side's | `LeftOuter`, **`LeftAnti`**, **`LeftSingle`**, **`ExistenceJoin`** | | right side's | `RightOuter` | | both sides' (no filtering) | `FullOuter`, any other | Bold entries are new. The split matches `PushExtraPredicateThroughJoin`, plus `LeftSingle`. ### Why are the changes needed? In a storage-partitioned join, rows only match within a key group. A key group that no output row can come from is wasted scan work: - `Cross` and `LeftSemi` emit nothing from a group missing on either side. - `LeftAnti`, `LeftSingle` and `ExistenceJoin` keep or test every left row, so a right-only group contributes nothing. Those join types previously kept the union of both sides' key groups, i.e. no filtering. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? - `EnsureRequirementsSuite`: new unit test asserting the merged key groups for all nine join types, with the config on and off. - `KeyGroupedPartitioningSuite`: new end-to-end tests for `LEFT SEMI`, `LEFT ANTI`, an existence join (`EXISTS ... OR`) and a left single join (correlated scalar subquery), each asserting the planned join type, no shuffle, the query result and the number of retained key groups. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Fable 5.1) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
