Skip to content
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

ddl, expression: fix some string functions' flen and refine error message for expression index #27376

Merged
merged 14 commits into from
Aug 20, 2021

Conversation

wjhuang2016
Copy link
Member

@wjhuang2016 wjhuang2016 commented Aug 19, 2021

Signed-off-by: wjhuang2016 huangwenjun1997@gmail.com

What problem does this PR solve?

Issue Number: close #27296, close #27361

Problem Summary:
These functions' flen are wrong.

What is changed and how it works?

For exportSet(), set it flen to 508(the same as MySQL)
For concatWS(), consider the flen of the first argument, make it the same as concat().
For fromBase64(), calculate it flen.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

'None'

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 19, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • AilinKid
  • tangenta

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 19, 2021
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 19, 2021
// Max length is (64 * 2 -1) * 4
// For example:
// "Y,Y,Y,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N"
bf.tp.Flen = 508
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen if arg[1]/arg[2] is too long?
I think using the formula in mysql is better.. https://github.com/mysql/mysql-server/blob/8.0/sql/item_strfunc.cc#L3646

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will fix it.

@wjhuang2016
Copy link
Member Author

/run-check_dev_2

@ichn-hu ichn-hu mentioned this pull request Aug 19, 2021
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 19, 2021
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 19, 2021
Copy link
Contributor

@wshwsh12 wshwsh12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

errno/errcode.go Show resolved Hide resolved
@ti-chi-bot
Copy link
Member

@wshwsh12: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

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 ti-community-infra/tichi repository.

Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

if len(args) > 3 {
sepL = args[3].GetType().Flen
}
bf.tp.Flen = (l*64 + sepL*63) * 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any calculation reference link for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to @wshwsh12 's comment.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 20, 2021
@wjhuang2016
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

@wjhuang2016: /merge in this pull request requires 2 approval(s).

In response to this:

/merge

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 ti-community-infra/tichi repository.

@wjhuang2016
Copy link
Member Author

/merge

1 similar comment
@wjhuang2016
Copy link
Member Author

/merge

@wjhuang2016
Copy link
Member Author

/run-check_dev_2

@wjhuang2016
Copy link
Member Author

/run-check_dev_2

1 similar comment
@wjhuang2016
Copy link
Member Author

/run-check_dev_2

@zhouqiang-cl
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

@zhouqiang-cl: /merge is only allowed for the committers, you can assign this pull request to the committer in list by filling /assign @committer in the comment to help merge this pull request.

In response to this:

/merge

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 ti-community-infra/tichi repository.

@zhouqiang-cl
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

@zhouqiang-cl: /merge is only allowed for the committers, you can assign this pull request to the committer in list by filling /assign @committer in the comment to help merge this pull request.

In response to this:

/merge

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 ti-community-infra/tichi repository.

@wjhuang2016
Copy link
Member Author

/run-check_dev_2

@wjhuang2016
Copy link
Member Author

/run-unit-test

@wjhuang2016
Copy link
Member Author

/run-check_dev_2

4 similar comments
@wjhuang2016
Copy link
Member Author

/run-check_dev_2

@wjhuang2016
Copy link
Member Author

/run-check_dev_2

@tisonkun
Copy link
Contributor

/run-check_dev_2

@wjhuang2016
Copy link
Member Author

/run-check_dev_2

@tisonkun
Copy link
Contributor

/run-check_dev_2

@zhouqiang-cl zhouqiang-cl merged commit 90626b8 into pingcap:master Aug 20, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 20, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.2 in PR #27461

@wjhuang2016 wjhuang2016 deleted the fix_strfuc_flen branch November 17, 2022 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression needs-cherry-pick-release-5.2 release-note-none Denotes a PR that doesn't merit a release note. sig/sql-infra SIG: SQL Infra size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
8 participants