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: keep the original join schema in predicate pushdown #24862

Merged
merged 9 commits into from
Jun 1, 2021

Conversation

eurekaka
Copy link
Contributor

What problem does this PR solve?

Issue Number: close pingcap/tiflash#1978

Problem Summary:

Panic caused by join schema changes in predicate pushdown.

What is changed and how it works?

What's Changed:

Keep the original join schema in predicate pushdown, instead of generating a new one from the child operators.

How it Works:

We don't infer NotNull info from scalar functions now, so we don't need to update the join schema in predicate pushdown. I have tried adding a new projection on top of join if the schema changes, it would break a lot of tests, so I simply remove the mergeSchema() function call.

Related changes

N/A

Check List

Tests

  • Unit test

Side effects

N/A

Release note

  • Keep the original join schema in predicate pushdown

@eurekaka eurekaka added type/bugfix This PR fixes a bug. sig/planner SIG: Planner labels May 24, 2021
@eurekaka eurekaka requested a review from a team as a code owner May 24, 2021 10:44
@eurekaka eurekaka requested review from qw4990 and removed request for a team May 24, 2021 10:44
@ti-chi-bot ti-chi-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 24, 2021
@@ -1792,7 +1792,7 @@ func (s *testPlanSuite) TestUpdateEQCond(c *C) {
}{
{
sql: "select t1.a from t t1, t t2 where t1.a = t2.a+1",
best: "Join{DataScan(t1)->DataScan(t2)->Projection}(test.t.a,Column#25)->Projection",
best: "Join{DataScan(t1)->DataScan(t2)->Projection}(test.t.a,Column#25)->Projection->Projection",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This additional projection is added in join reorder, since the schema of the reordered join contains t2.a+1. These 2 projections would be eliminated in the final physical plan, so I think this test change is fine.

@eurekaka
Copy link
Contributor Author

/run-all-tests

@eurekaka
Copy link
Contributor Author

/run-e2e-test

Copy link
Member

@time-and-fate time-and-fate 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-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 25, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • time-and-fate
  • winoros

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 31, 2021
@winoros
Copy link
Member

winoros commented May 31, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 23669d3

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 31, 2021
@guo-shaoge
Copy link
Collaborator

/label needs-cherry-pick-5.0

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Sep 23, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #28295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. 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.

Tidb panic when colNames2ResultFields
6 participants