-
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: handle max_allowed_packet warnings for repeat function. #7181
Conversation
Hi contributor, thanks for your PR. This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically. |
/run-all-tests |
/run-all-tests |
@zz-jason ok, thanks for notify. |
/run-all-tests |
1 similar comment
/run-all-tests |
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
@XuHuaiyu PTAL
/run-unit-test |
@hhxcc There are so many irrelevant changes, I think you may need to do some code clean work. |
@zz-jason sorry for that , I have already fixed it. |
LGTM |
@@ -575,6 +582,7 @@ func (b *builtinRepeatSig) evalString(row chunk.Row) (d string, isNull bool, err | |||
if isNull || err != nil { | |||
return "", isNull, errors.Trace(err) | |||
} | |||
byteLength := len(str) |
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.
It seems that this is rune length, not byte length?
I think we need to add some test cased for multi-byte characters, like Chinese character.
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.
Len of String will return the byte length, you can check it on https://golang.org/pkg/builtin/#len .
I have added some test of Chinese character.
@@ -398,6 +398,53 @@ func (s *testEvaluatorSuite) TestRepeat(c *C) { | |||
c.Assert(v.GetString(), Equals, "") | |||
} | |||
|
|||
func (s *testEvaluatorSuite) TestRepeatSig(c *C) { |
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.
Could you refine the test?
Maybe you can keep style with another tests.
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
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 |
@hhxcc It would be great if you can cherrypick this PR to the |
@zz-jason ok |
What have you changed? (mandatory)
Return NULL and a warning when the result of repeat exceeds max_allowed_packetbs.
Before this PR:
After this PR:
What is the type of the changes? (mandatory)
Bug fix (non-breaking change which fixes an issue)
How has this PR been tested? (mandatory)
Does this PR affect documentation (docs/docs-cn) update? (mandatory)
No
Does this PR affect tidb-ansible update? (mandatory)
No
Does this PR need to be added to the release notes? (mandatory)
Yes
release note:
Refer to a related PR or issue link (optional)
to #7153
Benchmark result if necessary (optional)
Add a few positive/negative examples (optional)