-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[BugFix] fix the column not found issue in skew join hint #66929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Murphy <mofei@starrocks.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where skew join hints would fail with a "column not found" error when referencing columns from the right side of a join. Previously, the skew join optimization only resolved columns against the left relation's scope, preventing users from specifying skew columns on the right table (e.g., join[skew|t1.v4(1,2)]). The fix enables bidirectional support by resolving skew columns against a combined scope of both join relations and dynamically determining which side contains the skew column during optimization.
Key changes:
- Column resolution now checks both left and right relations to find the skew column
- Optimization logic determines skew column side dynamically and applies salt operations accordingly
- Variable renaming from side-specific (
rightSkewColumn) to side-agnostic (otherSideSkewColumn) names
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| fe/fe-core/src/main/java/com/starrocks/sql/analyzer/QueryAnalyzer.java | Modified analyzeJoinHints to accept both left and right scopes, creating a joined scope for skew column resolution |
| fe/fe-core/src/main/java/com/starrocks/sql/optimizer/transformer/RelationTransformer.java | Updated skew column translation to pass both left and right OptExprBuilders for bidirectional column lookup |
| fe/fe-core/src/main/java/com/starrocks/sql/optimizer/rule/transformation/SkewJoinOptimizeRule.java | Enhanced optimization rule to detect which side contains the skew column and renamed methods/variables to be side-agnostic |
| fe/fe-core/src/test/java/com/starrocks/sql/plan/SkewJoinV2Test.java | Added test case verifying right-side skew column hints work correctly with V2 optimization |
| fe/fe-core/src/test/java/com/starrocks/sql/plan/SkewJoinTest.java | Added test case verifying right-side skew column hints work correctly with standard optimization |
|
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 37 / 37 (100.00%) file detail
|
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |



Why I'm doing:
What I'm doing:
Skew join hint should be able to support both left side and right side.
Fixes #66924
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check:
Note
Enables skew join hints to reference columns from either the left or right join side by fixing scope analysis and optimizer transformations, with new tests verifying right-side hints.
analyzeJoinHintsnow receivesleftScope/rightScope; skew column is analyzed against a combined join scope.addSaltForSkewChild/addSaltForOtherChild) and applies salt to the correct child based on column lineage.join[skew|...]column using a builder that includes both left/right plans, enabling right-side column support.Written by Cursor Bugbot for commit 1bcfe9f. This will update automatically on new commits. Configure here.