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

util: the incorrectly handle string compare with whitespace #53036

Conversation

fanrenhoo
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #52938

Problem Summary: TiDB incorrectly handle the comparision of Strings with whitespace ending

What changed and how does it work?

In collation string compare functions, remove the TrimRightSpace(str) for Compare and Key funcs

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects
No

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

Documentation
No

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

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Fix the issue that in expression the comparision of strings with whitespaces padding will be treated as same

Signed-off-by: fanrenhoo <fanrenhoo@sina.com>
Copy link

ti-chi-bot bot commented May 6, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign xuhuaiyu for approval. For more information see the Code Review Process.

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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-test labels May 6, 2024
Copy link

ti-chi-bot bot commented May 6, 2024

Hi @fanrenhoo. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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/test-infra repository.

@fanrenhoo
Copy link
Contributor Author

/cc @xiongjiwei

Copy link

ti-chi-bot bot commented May 6, 2024

@fanrenhoo: GitHub didn't allow me to request PR reviews from the following users: xiongjiwei.

Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @xiongjiwei

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/test-infra repository.

@fanrenhoo
Copy link
Contributor Author

/cc @lance6716

@ti-chi-bot ti-chi-bot bot requested a review from lance6716 May 6, 2024 13:43
@fanrenhoo
Copy link
Contributor Author

Hi, I found it seems TiDB intendly to trim the spaces at the ending of characters before comparision, including hashjoin with columns, or raw strings. But it does not comply with MySQL. So please review if this fix is correct

@fanrenhoo fanrenhoo changed the title fix #52938: the incorrectly handle string compare with whitespace util: the incorrectly handle string compare with whitespace May 6, 2024
@fanrenhoo
Copy link
Contributor Author

/test

Copy link

ti-chi-bot bot commented May 7, 2024

@fanrenhoo: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test

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/test-infra repository.

@lance6716
Copy link
Contributor

/ok-to-test

Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 73.5822%. Comparing base (3ca57c1) to head (5f541d0).
Report is 4 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #53036        +/-   ##
================================================
+ Coverage   72.0269%   73.5822%   +1.5553%     
================================================
  Files          1499       1499                
  Lines        431250     431883       +633     
================================================
+ Hits         310616     317789      +7173     
+ Misses       101328      94193      -7135     
- Partials      19306      19901       +595     
Flag Coverage Δ
integration 29.0856% <80.0000%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 46.3671% <ø> (+8.0212%) ⬆️

Copy link

ti-chi-bot bot commented May 7, 2024

@fanrenhoo: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/unit-test 5f541d0 link true /test unit-test
idc-jenkins-ci-tidb/mysql-test 5f541d0 link true /test mysql-test
pull-integration-ddl-test 5f541d0 link true /test pull-integration-ddl-test
idc-jenkins-ci-tidb/check_dev 5f541d0 link true /test check-dev
idc-jenkins-ci-tidb/check_dev_2 5f541d0 link true /test check-dev2

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@xiongjiwei
Copy link
Contributor

do not fix like this. create table with collate utf8mb4_unicode_ci in mysql, you will get the same result with tidb

@fanrenhoo
Copy link
Contributor Author

do not fix like this. create table with collate utf8mb4_unicode_ci in mysql, you will get the same result with tidb

OK,so this issue dont need fix. I will close this issue and pull requet

@fanrenhoo
Copy link
Contributor Author

close

@fanrenhoo fanrenhoo closed this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/needs-triage-completed ok-to-test release-note size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In the GROUP BY clause, TiDB incorrectly handled ' ' and NULL
3 participants