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: do not build MPP plan for scan with virtual columns #23980

Merged
merged 20 commits into from
Apr 15, 2021

Conversation

eurekaka
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #23886

Problem Summary:

Planner reports resolve index failure for MPP plan on virtual columns.

What is changed and how it works?

What's Changed:

Avoid generating MPP plan when the scan contains virtual columns.

How it Works:

If we enable MPP plan for such kind of cases, we need to add an extra projection node above to prune the newly appended columns, as what we do for copTask, otherwise we would get wrong query results. However, for a MPP task, we may attach plan nodes such as projection, hash aggregation and hash join upon the scan node, which would change the schema of the plan tree, so we have no idea of the target schema that the plan tree should be projected to then. Unlike copTask in which the PhysicalTableReader is the counterpart of DataSource, so we can add the projection upon the PhysicalTableReader, while in mppTask, the PhysicalTableReader is acting more like a data receiver, instead of the counterpart of the DataSource.

Meanwhile, I am not sure whether MPP execution engine can handle plan snippets which contain virtual columns, since I noticed that in addPushedDownSelectionToMppTask, no MPP task would be produced if the pushed down filter contains virtual columns.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects

N/A

Release note

  • Do not build MPP plan for scan with virtual columns

@eurekaka eurekaka requested review from a team as code owners April 13, 2021 03:57
@eurekaka eurekaka requested review from qw4990 and removed request for a team April 13, 2021 03:57
@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 13, 2021
@eurekaka eurekaka removed the request for review from a team April 13, 2021 03:57
@github-actions github-actions bot added the sig/execution SIG execution label Apr 13, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 13, 2021
@wjhuang2016
Copy link
Member

/lgtm

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • hanfei1991
  • wjhuang2016

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@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 Apr 13, 2021
@eurekaka
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: f4d2e50

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 13, 2021
@eurekaka
Copy link
Contributor Author

/run-all-tests

@eurekaka
Copy link
Contributor Author

/run-sqllogic-test-1

@eurekaka
Copy link
Contributor Author

/run-check_dev_2
/run-unit-test

@ichn-hu
Copy link
Contributor

ichn-hu commented Apr 13, 2021

Hi @eurekaka the e2e-test's failing is not your fault, I'll help you redo the check

@eurekaka
Copy link
Contributor Author

/merge

1 similar comment
@eurekaka
Copy link
Contributor Author

/merge

@eurekaka
Copy link
Contributor Author

/run-all-tests

1 similar comment
@eurekaka
Copy link
Contributor Author

/run-all-tests

@eurekaka
Copy link
Contributor Author

/merge

1 similar comment
@eurekaka
Copy link
Contributor Author

/merge

@eurekaka
Copy link
Contributor Author

/merge

@eurekaka
Copy link
Contributor Author

/merge

@Rustin170506
Copy link
Member

/run-all-tests

@Rustin170506
Copy link
Member

/run-all-tests

@ti-chi-bot ti-chi-bot merged commit 05e584f into pingcap:master Apr 15, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 15, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #24058

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/execution SIG execution sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 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.

Can't find column in schema Column: [] Unique key: [] when using hash_agg() hint and tiflash engine
7 participants