-
Notifications
You must be signed in to change notification settings - Fork 6.1k
planner: simplify outer join other conditions #66015
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
Changes from 3 commits
f85a296
f714931
781eaa0
9f69cc8
706bd54
26765e7
75e4a70
e327656
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -273,14 +273,16 @@ func (p *LogicalJoin) normalizeJoinConditionsForOuterJoin() { | |
| return | ||
| } | ||
| // Outer join ON conditions are not simplified through predicate pushdown. | ||
| // Normalize only double NOT here to avoid cartesian joins caused by other conditions. | ||
| exprCtx := p.SCtx().GetExprCtx() | ||
| for i := range p.OtherConditions { | ||
| if !expression.ContainOuterNot(p.OtherConditions[i]) { | ||
| continue | ||
| } | ||
| p.OtherConditions[i] = expression.PushDownNot(exprCtx, p.OtherConditions[i]) | ||
| } | ||
| // However, we still need to eliminate obvious logical constants in OtherConditions | ||
| // (e.g. "a = b OR 0") to avoid losing join keys. | ||
| p.OtherConditions = ruleutil.ApplyPredicateSimplificationForJoin( | ||
qw4990 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| p.SCtx(), | ||
|
||
| p.OtherConditions, | ||
| p.Children()[0].Schema(), | ||
| p.Children()[1].Schema(), | ||
| false, | ||
| nil, | ||
| ) | ||
| } | ||
|
|
||
| // simplifyOuterJoin transforms "LeftOuterJoin/RightOuterJoin" to "InnerJoin" if possible. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Planner Case Map | ||
|
|
||
| ## pkg/planner/core/casetest/rule | ||
|
|
||
| - predicate_pushdown_suite_in.json | ||
| - TestConstantPropagateWithCollation: predicate simplification + results; includes outer join OR-constant case (`/* issue:65994 */`). |
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.
What's
double_not_semi_join_execa label for this test case?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.
It's more like a comment or a prompt.
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.
where not not (t0.k0 = t2.k0))