-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
planner: reserve the OFFSET when outer join's inner side is unique #56483
planner: reserve the OFFSET when outer join's inner side is unique #56483
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #56483 +/- ##
================================================
+ Coverage 72.9059% 73.4575% +0.5515%
================================================
Files 1672 1672
Lines 461836 461913 +77
================================================
+ Hits 336706 339310 +2604
+ Misses 104424 101935 -2489
+ Partials 20706 20668 -38
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Rest LGTM
innerChild := p.Children()[1] | ||
innerJoinKey := make([]*expression.Column, 0, len(p.EqualConditions)) | ||
for _, eqCond := range p.EqualConditions { | ||
innerJoinKey = append(innerJoinKey, eqCond.GetArgs()[1].(*expression.Column)) |
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.
eq-cond can ensure the arg1 is from inner side?
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.
Yes, but the layout of the LogicalJoin or PhysicalJoin should be optimized.
Currently, it's too complex to use.
/retest |
1 similar comment
/retest |
[LGTM Timeline notifier]Timeline:
|
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.
others lgtm
// If the join key is nulleq, then we can only push the offset down when the inner side is unique key. | ||
// Only when the join key is normal eq, we can push the offset down when the inner side is unique(could be null). | ||
if innerChild.Schema().IsUnique(true, innerJoinKey...) || | ||
(innerChild.Schema().IsUnique(false, innerJoinKey...) && !isNullEQ) { |
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.
check !isNullEQ first?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, hawkingrei, windtalker The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
b2514fa
to
257a2c0
Compare
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #56321
Problem Summary:
What changed and how does it work?
When the outer join's inner side has a unique key on the join key.
The relationship between the outer join's output and its outer child's output is one-to-one.
So we can reserve the OFFSET of the LIMIT.
This can reduce the input to the outer join.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.