planner: The length function could not be substitute when collation of mapped column is utfxxx_bin (#54179)
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
/test unit-test
@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.
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%> (?) |
[LGTM Timeline notifier]
Timeline:
[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
- ~~OWNERS~~ [AilinKid,XuHuaiyu,qw4990]
- ~~pkg/expression/OWNERS~~ [XuHuaiyu]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/retest