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: don't DoOptimze when build show #12005

Merged
merged 6 commits into from
Sep 9, 2019

Conversation

winoros
Copy link
Member

@winoros winoros commented Sep 3, 2019

What problem does this PR solve?

A quick change to make buildShow in plan building more reasonable.

What is changed and how it works?

Put it as a source of the TableDual.

Check List

Tests

  • existing Unit test

Code changes

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

@winoros winoros added the sig/planner SIG: Planner label Sep 3, 2019
@winoros winoros changed the title planner don't DoOptimze when build show planner: don't DoOptimze when build show Sep 3, 2019
@codecov
Copy link

codecov bot commented Sep 3, 2019

Codecov Report

Merging #12005 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #12005   +/-   ##
===========================================
  Coverage   81.9889%   81.9889%           
===========================================
  Files           447        447           
  Lines         98362      98362           
===========================================
  Hits          80646      80646           
  Misses        12136      12136           
  Partials       5580       5580

@@ -30,7 +30,7 @@ import (

var (
stmtNodeCounterUse = metrics.StmtNodeCounter.WithLabelValues("Use")
stmtNodeCounterShow = metrics.StmtNodeCounter.WithLabelValues("Show")
stmtNodeCounterShow = metrics.StmtNodeCounter.WithLabelValues("LogicalShow")
Copy link
Contributor

Choose a reason for hiding this comment

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

Show is better?

return nil, err
}
return substitutePlaceHolderDual(physical, p), nil
return proj, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to eliminate projection here?

Copy link
Member Author

@winoros winoros Sep 5, 2019

Choose a reason for hiding this comment

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

Prvious one is not a valid project elimination.
For now, show cannot remove any of its output column.
So the project should be remained.

Also note that, now the output is logical plan. It will pass all optimizations. So the project cannot be removed now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Prvious one is not a valid project elimination.
For now, show cannot remove any of its output column.
So the project should be remained.

Sorry I didn't understand this, please explain a little bit more. Also, shall we set flagEliminateProjection of b.optFlag here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, sorry i misread the comment.
We can add flag here.
But the project in the that test won't be removed

// DeriveStats implement LogicalPlan DeriveStats interface.
func (p *LogicalShow) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error) {
profile := &property.StatsInfo{
RowCount: 1,
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 to explain the reason?

@winoros
Copy link
Member Author

winoros commented Sep 5, 2019

/run-unit-test

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

@winoros winoros added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 5, 2019
@@ -41,6 +41,20 @@ func (p *LogicalTableDual) DeriveStats(childStats []*property.StatsInfo) (*prope
return p.stats, nil
}

// DeriveStats implement LogicalPlan DeriveStats interface.
Copy link
Member

Choose a reason for hiding this comment

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

implement -> implements

@eurekaka eurekaka removed their request for review September 6, 2019 02:32
Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

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

@winoros Please resolve the conflicts and LGTM.

@lzmhhh123 lzmhhh123 added status/LGT2 Indicates that a PR has LGTM 2. status/can-merge Indicates a PR has been approved by a committer. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 9, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Sep 9, 2019

/run-all-tests

@sre-bot sre-bot merged commit 4b911b8 into pingcap:master Sep 9, 2019
@winoros winoros deleted the build-show-refactor branch September 9, 2019 09:09
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. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants