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

plan: refine code about maxonerow #5501

Merged
merged 4 commits into from
Dec 29, 2017
Merged

plan: refine code about maxonerow #5501

merged 4 commits into from
Dec 29, 2017

Conversation

hanfei1991
Copy link
Member

move maxOneRow out of schema to do further optimize

plan/plan.go Outdated
case *LogicalMaxOneRow, *LogicalExists:
p.maxOneRow = true
}
if len(p.children) == 1 {
switch p.self.(type) {
case *LogicalExists, *LogicalAggregation, *LogicalProjection:
p.basePlan.schema.Keys = nil
case *LogicalLock:
p.basePlan.schema.Keys = p.basePlan.children[0].Schema().Keys
Copy link
Member

Choose a reason for hiding this comment

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

don't need basePlan too?

{
// Test MaxOneRow for limit.
sql: "select (select * from (select b from t limit 1) x where x.b = t1.b) from t t1",
best: "Join{DataScan(t1)->DataScan(t)->Projection->Limit}(t1.b,x.b)->Projection->Projection",
Copy link
Member

Choose a reason for hiding this comment

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

How can we tell there is a MaxOneRow attribute in the plan?

Copy link
Member Author

Choose a reason for hiding this comment

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

Before this test, the plan contains an Apply op.

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

@winoros winoros added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 27, 2017
@shenli
Copy link
Member

shenli commented Dec 27, 2017

/run-all-tests

@shenli
Copy link
Member

shenli commented Dec 27, 2017

LGTM

@winoros
Copy link
Member

winoros commented Dec 29, 2017

/run-common-test

@shenli
Copy link
Member

shenli commented Dec 29, 2017

/run-all-tests

@shenli
Copy link
Member

shenli commented Dec 29, 2017

@hanfei1991 Please fix CI.

@hanfei1991
Copy link
Member Author

/run-common-test -tidb-test=pr/439

@hanfei1991
Copy link
Member Author

/run-integration-common-test -tidb-test=pr/439

@winoros winoros merged commit f817799 into pingcap:master Dec 29, 2017
@hanfei1991 hanfei1991 deleted the mor branch December 29, 2017 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants