-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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 cache prepared plan if optimization depends on mutable constant #22349
Conversation
/run-all-tests |
@@ -374,7 +374,7 @@ REBUILD: | |||
e.names = names | |||
e.Plan = p | |||
_, isTableDual := p.(*PhysicalTableDual) | |||
if !isTableDual && prepared.UseCache { | |||
if !isTableDual && prepared.UseCache && !stmtCtx.OptimDependOnMutableConst { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. It seems all places that use ContainMutableConst
should be modified. We can only modify EvaluateExprWithNull
in this PR and change all other places later in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PTAL @eurekaka |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-4.0 in PR #22353 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.0-rc in PR #22354 |
…e constant (#22349) (#22353) Signed-off-by: ti-srebot <[email protected]>
What problem does this PR solve?
Issue Number: close #22167
Problem Summary:
Incorrectly reuse cached plan which turns outer join to inner join.
What is changed and how it works?
What's Changed & How it Works:
EvaluateExprWithNull
is used in several optimizations such as converting outer join to inner join. If the result ofEvaluateExprWithNull
depends on parameters of execute statement, whether the optimizations can be used is affected by the parameters. When optimizing a prepared plan, ifexpr
passed intoEvaluateExprWithNull
contains mutable constant, we still do optimization but do not cache the plan.Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests a
Release note