-
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 wrong flen from baseFunctionClass #56607
Conversation
Hi @joechenrh. 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. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #56607 +/- ##
================================================
+ Coverage 72.8325% 74.8608% +2.0283%
================================================
Files 1672 1717 +45
Lines 462833 472049 +9216
================================================
+ Hits 337093 353380 +16287
+ Misses 104947 96604 -8343
- Partials 20793 22065 +1272
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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/builtin_string.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
argFieldTp := args[0].GetType(ctx.GetEvalCtx()) | ||
// Use UTF8MB4 as default. | ||
if argLen != types.UnspecifiedLength { | ||
bf.tp.SetFlen(argLen * 4 * 2) | ||
} | ||
bf.tp.SetFlen(argFieldTp.GetFlen() * 4 * 2) |
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.
This line need to be removed?
if err != nil { | ||
return nil, err | ||
} | ||
argFieldTp := args[0].GetType(ctx.GetEvalCtx()) | ||
// Use UTF8MB4 as default. | ||
if argLen != types.UnspecifiedLength { |
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.
I think it's better to use argFieldTp.GetFlen()
as the argLen
because inside newBaseBuiltinFuncWithTp
, args[0] maybe changed by wrap some implict cast function
if err != nil { | ||
return nil, err | ||
} | ||
bf.tp.SetFlen(args[0].GetType(ctx.GetEvalCtx()).GetFlen() * 2) | ||
if argLen != types.UnspecifiedLength { | ||
bf.tp.SetFlen(argLen * 2) |
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.
Ditto, better to use argFieldTp.GetFlen()
as the argLen
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
/test check-dev |
@yibin87: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
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: windtalker, yibin87 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 |
[LGTM Timeline notifier]Timeline:
|
/retest |
@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
/retest |
@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
/ok-to-test |
/retest |
1 similar comment
/retest |
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #56587
Problem Summary:
What changed and how does it work?
Previously,
quoteFunctionClass
may return type with flen = 0 when the underlying argument has theUnspecifiedLength
which equals to -1.tidb/pkg/expression/builtin_string.go
Line 2899 in f0b3bf0
And this type will be passed into
LogicalUnionAll
and a wrong type is deduced.tidb/pkg/planner/core/logical_plan_builder.go
Lines 1586 to 1591 in f0b3bf0
Some other functions also have this problem, for example:
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.