fix: declare required child distribution on aggregate, window and join operators #7231
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 221 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.323
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7231"
general
weight: 0.35
rich7420
Which issue does this PR close?
Closes #7208.
Rationale for this change
With AQE on,
REBALANCE(k)followed byGROUP BY kreturns duplicate groups when the data is skewed, and aPARTITION BY kwindow restartsrow_number()inside a key. Spark'sOptimizeSkewInRebalancePartitionssplits the skewed shuffle partition. In plain Spark that is safe, becauseValidateRequirementsrejects the split when an operator above needsClusteredDistribution(k). Comet's aggregate, window and join operators declared norequiredChildDistribution, so the check always passed and the native operators ran over the pieces of a key separately.What changes are included in this PR?
A new trait,
CometDelegatesRequiredChildDistribution, returnsoriginalPlan.requiredChildDistribution. It is mixed intoCometBaseAggregateExec,CometWindowExec,CometWindowGroupLimitExec,CometHashJoinExecandCometSortMergeJoinExec, so each declares the same requirement as the Spark operator it replaces.requiredChildOrderingand the broadcast hash join are unchanged.How are these changes tested?
New test in
CometExecSuite,AQE does not split a skewed rebalance partition under operators that need clustering. It uses the data from the issue and checks theGROUP BYquery (also with a project and filter below it), therow_number()window query, a window group limit (rn <= 2), and a self-join with sort-merge join on and off. Each query is compared with Spark, and the plan is asserted to have no skewedAQEShuffleReadExec.The test fails without the operator changes and passes with them.
CometExecSuite,CometWindowExecSuite,CometJoinSuiteandCometAggregateSuitepass on the default profile (Spark 4.1): 535 tests, 0 failures.