-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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) #22353
planner: do not cache prepared plan if optimization depends on mutable constant (#22349) #22353
Conversation
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
/run-all-tests |
@xuyifangreeneyes you're already a collaborator in bot's repo. |
planner/core/prepare_test.go
Outdated
@@ -830,3 +830,68 @@ func (s *testPrepareSuite) TestPrepareForGroupByMultiItems(c *C) { | |||
tk.MustExec(`prepare stmt2 from "select sum(b) from t group by ?, ?"`) | |||
tk.MustQuery(`execute stmt2 using @v1, @v2`).Check(testkit.Rows("10")) | |||
} | |||
<<<<<<< HEAD |
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.
PTAL @xuyifangreeneyes
/run-all-tests |
/run-tics-test |
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 @Reminiscent |
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
cherry-pick #22349 to release-4.0
You can switch your code base to this Pull Request by using git-extras:
# In tidb repo: git pr 22353
After apply modifications, you can push your change to this PR via:
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