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: prune duplicate expr in sort #20325

Merged
merged 2 commits into from
Oct 2, 2020
Merged

Conversation

mightyguava
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #20322

Problem Summary: Duplicated ORDER BY condition causes bad execution plan

What is changed and how it works?

What's Changed: Duplicated expressions are pruned from the logical plan during the preprocessing phase

How it Works: Iterate through the ByItems in the sort plan in order and prune columns that have already been seen. Any duplicates found are always noop sort steps.

Check List

Tests

  • Unit test

Side effects

Release note

  • Duplicate order by conditions are eliminated

@mightyguava mightyguava requested a review from a team as a code owner October 1, 2020 03:15
@mightyguava mightyguava requested review from hanfei1991 and removed request for a team October 1, 2020 03:15
@ti-srebot ti-srebot added the contribution This PR is from a community contributor. label Oct 1, 2020
@CLAassistant
Copy link

CLAassistant commented Oct 1, 2020

CLA assistant check
All committers have signed the CLA.

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

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 1, 2020
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Oct 2, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Oct 2, 2020
@zz-jason
Copy link
Member

zz-jason commented Oct 2, 2020

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 2, 2020
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@mightyguava merge failed.

@zz-jason
Copy link
Member

zz-jason commented Oct 2, 2020

/run-sqllogic-test

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #20333

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Oct 3, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
ti-srebot added a commit that referenced this pull request Oct 13, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. 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.

Duplicated ORDER BY condition causes bad execution plan
5 participants