[SPARK-57881][SQL] UnionExec outputPartitioning supports KeyedPartitioning#56961
Open
pan3793 wants to merge 1 commit into
Open
[SPARK-57881][SQL] UnionExec outputPartitioning supports KeyedPartitioning#56961pan3793 wants to merge 1 commit into
pan3793 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR extends
UnionExec's output partitioning propagation to includeKeyedPartitioning, so that aUNION ALLofKeyedPartitioningchildren can participate in a SPJ.Why are the changes needed?
A
UNION ALLof two V2 (i.e., Iceberg) bucketed tables currently reportsUnknownPartitioning— theunionOutputPartitioningfeature only handledHashPartitioning/SinglePartition. Consequently, any join on the partition key over such a union always shuffles, even when both legs are storage-partitioned on the join key. This defeats the SPJ optimization for a common pattern: combining sharded/bucketed sources before a join.Example —
t1,t2,t3all partitioned byidentity(id):UnknownPartitioning, so the sort-merge join inserts a shuffle on both sides.KeyedPartitioningoverid; SPJ recognizes both legs as compatible and the join runs without a shuffle (aGroupPartitionsExeccoalesces partitions sharing a key when the children's key sets overlap).Does this PR introduce any user-facing change?
No, it's a perf-only change.
How was this patch tested?
UTs are added.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: GLM 5.2