-
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 builtin 'CharLength' for binary string input #7410
Conversation
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
/run-all-tests |
expression/builtin_string.go
Outdated
if isNull || err != nil { | ||
return 0, isNull, errors.Trace(err) | ||
} | ||
return int64(len([]byte(val))), false, nil |
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.
Just len(val)
will do.
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.
ok
/run-all-tests |
@spongedu Have you considered adding a field to |
At first sight I think we need only distinguish binary strings and non-binary strings. I'm not sure about this for now. I'll look into it and make some tests today or so. |
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
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
/run-all-tests |
What problem does this PR solve?
Currently in TiDB, builtin
CharLength
's behavior is not consistent with MySQL when deal with binary strings.In MySQL:
While in TiDB:
What is changed and how it works?
take special care for binary strings when create
builtinSig
Check List
Tests
Code changes
Side effects
Related changes