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, executor: set new child after injecting Project operator #9684

Merged
merged 11 commits into from
Mar 13, 2019

Conversation

zz-jason
Copy link
Member

@zz-jason zz-jason commented Mar 12, 2019

What problem does this PR solve?

  1. forget to set new child after injecting project operator
  2. remove unnecessary TopN if child is a TableDual in rule topN pushdown

What is changed and how it works?

do as the title said.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Related changes

  • Need to cherry-pick to the release branch
  • Need to be included in the release note

@zz-jason zz-jason added type/bugfix This PR fixes a bug. sig/planner SIG: Planner labels Mar 12, 2019
@CLAassistant
Copy link

CLAassistant commented Mar 12, 2019

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link

codecov bot commented Mar 13, 2019

Codecov Report

Merging #9684 into master will decrease coverage by 0.0017%.
The diff coverage is 30%.

@@               Coverage Diff                @@
##             master      #9684        +/-   ##
================================================
- Coverage   67.3879%   67.3862%   -0.0018%     
================================================
  Files           377        377                
  Lines         79345      79353         +8     
================================================
+ Hits          53469      53473         +4     
- Misses        21104      21108         +4     
  Partials       4772       4772

planner/core/rule_inject_extra_projection.go Outdated Show resolved Hide resolved
@@ -205,5 +206,9 @@ func injectProjBelowSort(p PhysicalPlan, orderByItems []*ByItems) PhysicalPlan {
if origChildProj, isChildProj := childPlan.(*PhysicalProjection); isChildProj {
refine4NeighbourProj(bottomProj, origChildProj)
}

if topProj.Schema().Len() == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment for when will this be true

Copy link
Contributor

Choose a reason for hiding this comment

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

If the schema length is 0, is this whole plan tree below projection needed?

TopN_17 1.00 root tmp.a:desc, offset:0, count:1
└─Union_21 2.00 root
├─Projection_22 1.00 root cast(a)
│ └─Projection_23 1.00 root 4
Copy link
Member Author

Choose a reason for hiding this comment

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

If we have a rule to merge sequential Project operators, these two Project operator can be merged to one.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we change 33 to 3, would this Projection_22 be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, because in this time, FieldTypes of "3" and "4" are equal, no cast function will be added in the logical plan building phase.

@zz-jason zz-jason requested a review from XuHuaiyu March 13, 2019 04:43
@zz-jason
Copy link
Member Author

/run-all-tests

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

LGTM

@XuHuaiyu
Copy link
Contributor

Please fix ci and update the description of this PR.

@zz-jason
Copy link
Member Author

/run-all-tests

Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

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

LGTM

@eurekaka eurekaka added the status/LGT2 Indicates that a PR has LGTM 2. label Mar 13, 2019
@zz-jason zz-jason merged commit 7f27f7d into pingcap:master Mar 13, 2019
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. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants