-
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 issue that TimeIsNull
is not compatible with MySQL
#10957
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10957 +/- ##
===============================================
- Coverage 81.222% 80.9774% -0.2446%
===============================================
Files 420 419 -1
Lines 90031 89373 -658
===============================================
- Hits 73125 72372 -753
- Misses 11675 11765 +90
- Partials 5231 5236 +5 |
expression/distsql_builtin.go
Outdated
@@ -336,7 +336,12 @@ func getSignatureByPB(ctx sessionctx.Context, sigCode tipb.ScalarFuncSig, tp *ti | |||
case tipb.ScalarFuncSig_RealIsNull: | |||
f = &builtinRealIsNullSig{base} | |||
case tipb.ScalarFuncSig_TimeIsNull: | |||
f = &builtinTimeIsNullSig{base} | |||
isNotNull := false | |||
if len(expr.Children) > 0 && mysql.HasNotNullFlag(uint(expr.Children[0].FieldType.Flag)) { |
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.
No need for this check any more?
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.
Which check? len(expr.Children) > 0
?.
aea4cee
to
95b1dd9
Compare
@lamxTyler @breeswish PTAL~ |
a2ea4af
to
d1bc2c5
Compare
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
@@ -799,7 +799,12 @@ func (c *isNullFunctionClass) getFunction(ctx sessionctx.Context, args []Express | |||
sig = &builtinRealIsNullSig{bf} | |||
sig.setPbCode(tipb.ScalarFuncSig_RealIsNull) | |||
case types.ETDatetime: | |||
sig = &builtinTimeIsNullSig{bf} | |||
isNotNull := false | |||
_, isCol := args[0].(*Column) |
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.
_, isCol := args[0].(*Column) | |
col, isCol := args[0].(*Column) |
sig = &builtinTimeIsNullSig{bf} | ||
isNotNull := false | ||
_, isCol := args[0].(*Column) | ||
if isCol && mysql.HasNotNullFlag(args[0].GetType().Flag) { |
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.
if isCol && mysql.HasNotNullFlag(args[0].GetType().Flag) { | |
if isCol && mysql.HasNotNullFlag(col.GetType().Flag) { |
There is no need to index the slice again.
@qw4990 You should override the |
The way in this PR to fix this issue is not appropriate, so I close it and fix it by another PR. |
What problem does this PR solve?
Fix #9763.
What is changed and how it works?
Introduce a new variable
isNotNull
tobuiltinTimeIsNullSig
to judge if this column has aNotNull
attribution and push it down toTiKV
.Check List
Tests