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) #20333

Merged
merged 2 commits into from
Oct 13, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #20325 to release-4.0


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

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot added contribution This PR is from a community contributor. type/4.0-cherry-pick labels Oct 3, 2020
@ti-srebot ti-srebot added this to the v4.0.8 milestone Oct 3, 2020
@ti-srebot ti-srebot self-assigned this Oct 3, 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 added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 3, 2020
@zz-jason
Copy link
Member

zz-jason commented Oct 3, 2020

/merge

@ti-srebot
Copy link
Contributor Author

@zz-jason Oops! This PR requires at least 2 LGTMs to merge. The current number of LGTM is 1

@zz-jason zz-jason requested a review from winoros October 13, 2020 05:39
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

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 13, 2020
@winoros
Copy link
Member

winoros commented Oct 13, 2020

/merge

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

/run-all-tests

@ti-srebot ti-srebot merged commit 8c6879c into pingcap:release-4.0 Oct 13, 2020
@winoros winoros deleted the release-4.0-b565ee0546d3 branch October 13, 2020 06:10
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. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants