-
Notifications
You must be signed in to change notification settings - Fork 6k
planner: Fix expression rewriting and method signature mismatch in plan cache #58506
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
Conversation
Hi @dash12653. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Hi @dash12653. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
pkg/expression/util.go
Outdated
@@ -1599,7 +1599,10 @@ func RemoveMutableConst(ctx BuildContext, exprs []Expression) (err error) { | |||
} | |||
v.DeferredExpr = nil // do nothing since v.Value has already been evaluated in this case. | |||
case *ScalarFunction: | |||
return RemoveMutableConst(ctx, v.GetArgs()) | |||
err := RemoveMutableConst(ctx, v.GetArgs()) |
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 catch
sorry for didn't notice github notification for sometime, do you mind resolve conflict it runs into |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, qw4990, windtalker The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/ok-to-test |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #58506 +/- ##
================================================
+ Coverage 72.9617% 73.3606% +0.3988%
================================================
Files 1750 1751 +1
Lines 484506 489486 +4980
================================================
+ Hits 353504 359090 +5586
+ Misses 109381 108536 -845
- Partials 21621 21860 +239
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
…fix-scalar-func-init * commit '5ec4f36c855574b64be98e4c9f6b4485ceb4143d': (48 commits) dxf: use correct store in add-index, checksum by copr in import-into, and enable DXF service (pingcap#62224) infoschema: Add new fields in tiflash system table (pingcap#62296) lightning: fix panic on checksum manager close when checksum is off (pingcap#62300) *: Add owners cfg file for pkg/metrics module (pingcap#62292) autoid: reserve a table ID range for downstream fork (pingcap#62157) planner: Fix expression rewriting and method signature mismatch in plan cache (pingcap#58506) planner: use prop based noCopPushDown mechanism to replace aggregation field. (pingcap#62249) fix: close issue 59457 by trim compare first (pingcap#61915) planner: add skew risk ratio for range pred (pingcap#62035) meta: unify definition of system or memory DB name (pingcap#62247) ddl: add retry for updateSelfVersion (pingcap#62190) *: upgrade client go to add config valid function (pingcap#62246) executor: fix the inappropriate RequiredRows set by `TopNExec` (pingcap#62154) planner: RegardNULLAsPoint should be true as default (pingcap#62194) planner: apply predicate simplification before extract condition (pingcap#62211) test: fix failed test caused by new version of `mc` (pingcap#61356) planner: deprecate the logical interface CanPushToCop and its implementation canPushToCopImpl. (pingcap#62235) fix: shut down test without error (pingcap#61921) planner: lift the canPushToCop check of logical join/window/selection (pingcap#62206) backend/local: add rate limiter for split region and ingest data (pingcap#61555) ...
What problem does this PR solve?
Issue Number: close #56772
Problem Summary:
What changed and how does it work?
In the
expression rewriting
process, when constructing the conditiont1.col1 + 10 > ? + 10
, the argument? + 10
will go throughargument refinement
, and the final result is set toNULL
. The type of NULL is determined asint.
Then, the method signature for
t1.col1 + 10 > ? + 10
is set tobuiltinArithmeticPlusIntSig
. But theDeferredExpr
for the expressionplus(NULL, 10)
is not removed, which results in a conflict method signature ofbuiltinArithmeticPlusRealSig
,which cannot handle int types. This leads to an error during execution.
RemoveMutableConst():
will not traverse all the expressions.tidb/pkg/expression/util.go
Lines 1583 to 1602 in 8ecdb54
I modified the code to ensure that all expressions are properly traversed and DeferredExpr would be removed.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.