Skip to content
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/cascades: support outer join implementation and push down selection for outer join #13996

Merged
merged 20 commits into from
Dec 23, 2019

Conversation

lzmhhh123
Copy link
Contributor

What problem does this PR solve?

As the title says.

What is changed and how it works?

support outer join implementation rule and push down selection for outer join

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change
  • Has exported variable/fields change

@lzmhhh123 lzmhhh123 added the sig/planner SIG: Planner label Dec 9, 2019
@lzmhhh123 lzmhhh123 requested a review from a team as a code owner December 9, 2019 11:36
@ghost ghost requested review from francis0407 and alivxxx and removed request for a team December 9, 2019 11:36
"SQL": "select t2.a, t2.b from t1 right join t2 on t1.a = t2.a where t1.a > 2 and t2.b > 200",
"Plan": [
"Projection_12 10000.00 root test.t2.a, test.t2.b",
"└─HashRightJoin_14 10000.00 root right outer join, inner:TableReader_17 (REVERSED), equal:[eq(test.t1.a, test.t2.a)]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the t1.a>2?

planner/cascades/implementation_rules.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 10, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@8666a6f). Click here to learn what that means.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #13996   +/-   ##
===========================================
  Coverage          ?   80.2254%           
===========================================
  Files             ?        484           
  Lines             ?     121707           
  Branches          ?          0           
===========================================
  Hits              ?      97640           
  Misses            ?      16322           
  Partials          ?       7745

@@ -320,6 +322,9 @@ type LogicalSelection struct {
// but after we converted to CNF(Conjunctive normal form), it can be
// split into a list of AND conditions.
Conditions []expression.Expression
// HasBeenPushed means whether the selection is applied rule `PushSelDown`,
// it's used in cascades planner.
HasBeenPushed bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a general solution to solve the recursive rule applying. There's also other cases that would cause endless loop.
You can add a TODO here first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be done by AppliedRuleSet. When we apply the rule PushSelDownJoin, we should add this rule to AppliedRuleSet of the new created Selection, so that the new Selection will not match this rule again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the AppliedRuleSet?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still working on it >.<

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK...Don't forget to remove this when you finish it. 0.0

planner/cascades/transformation_rules.go Outdated Show resolved Hide resolved
Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@francis0407
Copy link
Member

The field HashBeenPushed is really confusing and not friendly to new contributors.
Could we merge this PR after I finish AppliedRuleSet? I'm working on it these days, and will file a PR this weekend or next week.

@lzmhhh123
Copy link
Contributor Author

The field HashBeenPushed is really confusing and not friendly to new contributors.
Could we merge this PR after I finish AppliedRuleSet? I'm working on it these days, and will file a PR this weekend or next week.

That's alright. Go ahead.

@lzmhhh123
Copy link
Contributor Author

/run-unit-test

Copy link
Member

@francis0407 francis0407 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lzmhhh123 lzmhhh123 added the status/can-merge Indicates a PR has been approved by a committer. label Dec 23, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Dec 23, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Dec 23, 2019

@lzmhhh123 merge failed.

@lzmhhh123
Copy link
Contributor Author

/run-integration-copr-test

@lzmhhh123
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Dec 23, 2019

/run-all-tests

@sre-bot sre-bot merged commit 558d9e2 into pingcap:master Dec 23, 2019
@lzmhhh123 lzmhhh123 deleted the dev/outerjoin-implement branch December 23, 2019 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants