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: support the transformation framework of the cascades planner #7869

Merged
merged 32 commits into from
Dec 5, 2018

Conversation

zz-jason
Copy link
Member

@zz-jason zz-jason commented Oct 11, 2018

What problem does this PR solve?

support framework of the cascades planner.

What is changed and how it works?

- introduce a global session variable "tidb_enable_cascades_planner" to control whether to use the cascades planner. split to #7879
- modify the Optimize() function to share some common code logic between the old planner and cascades planner. split to #7879
- implement the Group and GroupExpr component. split to #7917

  • implement the FindBestPlan() function
  • implement the convert2Group() function to convert a logical plan to Group
  • implement the onPhaseExploration() function, which applies all the possible rules and transforms the expression to its equivalents.
  • implement the ExprIter to extract and iterate all the group expressions which match the rule pattern
  • modify the GetOperand() function to only return the operand.

Check List

Tests

  • Unit test will be added later

Code changes

  • Has exported function/method change

This change is Reviewable

@zz-jason zz-jason dismissed a stale review via 8e0afe4 October 15, 2018 02:43
@zz-jason zz-jason changed the title planner, executor: implement the framework of the cascades planner planner, executor: support group and group expression of the cascades planner Oct 15, 2018
@zz-jason zz-jason changed the title planner, executor: support group and group expression of the cascades planner planner, executor: support Group and GroupExpr of the cascades planner Oct 15, 2018
@zz-jason
Copy link
Member Author

@eurekaka PTAL

planner/cascades/group.go Outdated Show resolved Hide resolved
planner/cascades/optimize.go Outdated Show resolved Hide resolved
planner/cascades/expr_iterator.go Outdated Show resolved Hide resolved
planner/cascades/expr_iterator.go Outdated Show resolved Hide resolved
@zz-jason zz-jason changed the title planner, executor: support Group and GroupExpr of the cascades planner planner: support the transformation framework of the cascades planner Oct 18, 2018
@zz-jason
Copy link
Member Author

@eurekaka @lamxTyler PTAL

planner/cascades/optimize.go Outdated Show resolved Hide resolved
planner/cascades/transformation_rules.go Outdated Show resolved Hide resolved
@eurekaka
Copy link
Contributor

Shall we include LogicalProperty derivation in exploration phase?

@winoros
Copy link
Member

winoros commented Oct 18, 2018

@eurekaka We should, but there's no logical property currently?

planner/cascades/optimize.go Show resolved Hide resolved
planner/cascades/optimize.go Show resolved Hide resolved
planner/cascades/optimize.go Outdated Show resolved Hide resolved
planner/cascades/expr_iterator.go Outdated Show resolved Hide resolved
planner/cascades/expr_iterator.go Outdated Show resolved Hide resolved
planner/cascades/expr_iterator.go Outdated Show resolved Hide resolved
planner/cascades/expr_iterator.go Outdated Show resolved Hide resolved
planner/cascades/expr_iterator.go Outdated Show resolved Hide resolved
planner/cascades/expr_iterator.go Outdated Show resolved Hide resolved
@alivxxx alivxxx added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 26, 2018
@alivxxx
Copy link
Contributor

alivxxx commented Oct 26, 2018

/run-all-tests

@winoros
Copy link
Member

winoros commented Oct 26, 2018

So this pr won't have unit-test?

@zz-jason
Copy link
Member Author

@winoros PTAL

winoros
winoros previously approved these changes Dec 5, 2018
@zz-jason
Copy link
Member Author

zz-jason commented Dec 5, 2018

@lamxTyler Reset() function refactored, PTAL
There is a new unit test for this behavior: https://github.com/pingcap/tidb/pull/7869/files#diff-025d9362a93099177f68b9c57c0204a3R104

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason merged commit f06f3ca into pingcap:master Dec 5, 2018
@zz-jason zz-jason deleted the cascades/framework branch December 5, 2018 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants