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: disable plan cache for query containing SubqueryExpr #8064

Merged
merged 2 commits into from
Oct 26, 2018

Conversation

eurekaka
Copy link
Contributor

What problem does this PR solve?

Fix #8062

What is changed and how it works?

The reason of the wrong result is: during first execute in session 1, a plan would be built and cached; during the expression rewriting of the plan building step, un-correlated subquery is detected and evaluated in optimizer, so the query is simplified to select * from t where a = null, thus the ParamMarkerExpr is lost in the plan, so we get empty result in the second execute.

Check the AST and mark it uncacheable if it contains SubqueryExpr.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

N/A

Related changes

  • Need to cherry-pick to the release branch

@eurekaka eurekaka added type/bugfix This PR fixes a bug. sig/planner SIG: Planner labels Oct 25, 2018
@eurekaka
Copy link
Contributor Author

/run-all-tests

@eurekaka
Copy link
Contributor Author

@zz-jason @lamxTyler @winoros PTAL.

@zz-jason
Copy link
Member

LGTM

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 26, 2018
Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

LGTM

@eurekaka eurekaka added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 26, 2018
@eurekaka eurekaka merged commit 3024a5a into pingcap:master Oct 26, 2018
@eurekaka eurekaka deleted the plancache_subquery branch October 26, 2018 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner 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.

3 participants