tidb icon indicating copy to clipboard operation
tidb copied to clipboard

planner: The length function could not be substitute when collation of mapped column is utfxxx_bin (#54179)

Open ti-chi-bot opened this issue 1 year ago • 2 comments

This is an automated cherry-pick of #54179

What problem does this PR solve?

The constant propagated should consider the collation of mapped column. For example,

set collation = utf8_bin || set collation= utf8mb4_bin
where name='a' and length(name) = 1

The name = 'a' doesn't mean the all of column name data is 'a'. The 'a ' also can match the name='a' condition. The reason is that 'utf8_bin' and 'utf8mb4_bin' are 'PAD SPACE' collation which means that it will ignore the trailing spaces. **This kind of constant couldn't be propagated to 'Length' function. **

So I changed the columnSubstitute function to special due with 'length' function case.

Issue Number: close #53730

Check List

Tests

  • [x] Unit test
  • [x] 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

  • [ ] 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

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

Fix the error unexpected eliminated 'length()' conditions when collation is utf8_bin or utf8mb4_bin

ti-chi-bot avatar Jul 01 '24 06:07 ti-chi-bot

/test unit-test

elsa0520 avatar Jul 03 '24 04:07 elsa0520

@elsa0520: No presubmit jobs available for pingcap/[email protected]

In response to this:

/test unit-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-sigs/prow repository.

tiprow[bot] avatar Jul 03 '24 04:07 tiprow[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Please upload report for BASE (release-7.5@4f5d583). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-7.5     #54352   +/-   ##
================================================
  Coverage               ?   72.0397%           
================================================
  Files                  ?       1411           
  Lines                  ?     410819           
  Branches               ?          0           
================================================
  Hits                   ?     295953           
  Misses                 ?      94962           
  Partials               ?      19904           
Flag Coverage Δ
unit 72.0397% <100.0000%> (?)

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

Components Coverage Δ
dumpling 53.9913% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 53.4363% <0.0000%> (?)

codecov[bot] avatar Jul 03 '24 04:07 codecov[bot]

[LGTM Timeline notifier]

Timeline:

  • 2024-07-03 07:48:12.407967436 +0000 UTC m=+1397018.893456266: :ballot_box_with_check: agreed by qw4990.
  • 2024-07-03 07:50:54.809363329 +0000 UTC m=+1397181.294852161: :ballot_box_with_check: agreed by AilinKid.

ti-chi-bot[bot] avatar Jul 03 '24 07:07 ti-chi-bot[bot]

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, qw4990, XuHuaiyu

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 /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

ti-chi-bot[bot] avatar Jul 03 '24 14:07 ti-chi-bot[bot]

/retest

qw4990 avatar Jul 04 '24 01:07 qw4990