planner: simplify outer join other conditions#66015
planner: simplify outer join other conditions#66015hawkingrei wants to merge 8 commits intomasterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #66015 +/- ##
================================================
- Coverage 77.7600% 77.6685% -0.0915%
================================================
Files 2001 1923 -78
Lines 546165 534896 -11269
================================================
- Hits 424698 415446 -9252
+ Misses 119805 119442 -363
+ Partials 1662 8 -1654
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/check-issue-triage-complete |
|
/retest |
| "select /* double_not_left_join_exec */ t0.k0, t2.k0 from t0 left join t2 on not not (t0.k0 = t2.k0) order by t0.k0, t2.k0", | ||
| "select /* double_not_right_join_exec */ t0.k0, t2.k0 from t0 right join t2 on not not (t0.k0 = t2.k0) order by t2.k0, t0.k0", | ||
| "select /* double_not_semi_join_exec */ t0.k0 from t0 where exists (select 1 from t2 where not not (t0.k0 = t2.k0)) order by t0.k0" | ||
| "select /* double_not_semi_join_exec */ t0.k0 from t0 where exists (select 1 from t2 where not not (t0.k0 = t2.k0)) order by t0.k0", |
There was a problem hiding this comment.
What's double_not_semi_join_exec a label for this test case?
There was a problem hiding this comment.
It's more like a comment or a prompt.
There was a problem hiding this comment.
where not not (t0.k0 = t2.k0))
| // 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( | ||
| p.SCtx(), |
There was a problem hiding this comment.
Do we need to call this function for other join types, like semi/anti/inner?
Also we can move this function call inside PredicatePushDown, becase there is no much logic, and a new function seems meanless.
There was a problem hiding this comment.
Great, I have rafactored this code.
Signed-off-by: Weizhen Wang <[email protected]>
|
/retest |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: guo-shaoge The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
/retest |
Signed-off-by: Weizhen Wang <[email protected]>
|
/retest |
Signed-off-by: Weizhen Wang <[email protected]>
|
/retest |
Signed-off-by: Weizhen Wang <[email protected]>
|
/retest |
1 similar comment
|
/retest |
What problem does this PR solve?
Issue Number: close #65994
Problem Summary:
a=b OR 0) are not simplified, which prevents join key extraction and can lead to incorrect plans/results after predicate pushdown.What changed and how does it work?
OtherConditionsto eliminate trivial OR constants and keep join keys.Check List
Tests
Side effects
Documentation
Release note