-
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
expression: Fix unexpected panic when using IF function. (#21132) #21711
expression: Fix unexpected panic when using IF function. (#21132) #21711
Conversation
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
/run-all-tests |
@wshwsh12 you're already a collaborator in bot's repo. |
expression/integration_test.go
Outdated
@@ -7282,6 +7282,75 @@ func (s *testIntegrationSuite) TestIssue20860(c *C) { | |||
c.Assert(tk.ExecToErr("update t set d = adddate(d, interval 1 day) where id < 10"), NotNil) | |||
} | |||
|
|||
<<<<<<< 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.
conflicts
@lzmhhh123 @XuHuaiyu PTAL |
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
@wshwsh12 Please resolve conflicts again... |
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 |
/run-all-tests |
@ti-srebot merge failed. |
/merge |
/run-all-tests |
cherry-pick #21132 to release-4.0
What problem does this PR solve?
Issue Number: close #15847
Problem Summary:
When rewrite expression, IF(null column,null,null) will get an evalTp TpString. And it will wrap arg0 with isTruth.
Above IF function, there has a CastToReal function.
So the final expression is CastStringToReal(IFString(isTruth(null column), null , null))
In other optimization, maybe it will refactor the expression.
IFString(isTruth(null column), null, null) will be refactored to IFINT(isTruth(null column), null, null)
(See InferType4ControlFuncs and typeInferForNull)
It will cause panic, since CastStringToReal will try to call evalString().
What is changed and how it works?
Proposal: xxx
What's Changed:
How it Works:
Related changes
Check List
Tests
Side effects
Release note