expression: avoid mutating folded child metadata#68451
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThis PR fixes a charset-leakage bug where CASE/IF/IFNULL expressions with BINARY branches incorrectly propagate binary charset to unrelated SELECT expressions. Changes clone return-type pointers during constant folding and expression cloning to isolate type metadata mutations. ChangesCharset Preservation in Conditional Folding
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #68451 +/- ##
================================================
- Coverage 77.2762% 76.4859% -0.7904%
================================================
Files 2010 1992 -18
Lines 555477 557671 +2194
================================================
- Hits 429252 426540 -2712
- Misses 125305 131087 +5782
+ Partials 920 44 -876
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/test check-dev |
|
@hawkingrei: The specified target(s) for Use DetailsIn 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 kubernetes-sigs/prow repository. |
ecde50b to
3388c64
Compare
|
/retest |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/test idc-jenkins-ci-tidb/mysql-test |
|
@hawkingrei: The specified target(s) for The following commands are available to trigger optional jobs: Use DetailsIn 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 kubernetes-sigs/prow repository. |
|
@hawkingrei: The specified target(s) for Use DetailsIn 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 kubernetes-sigs/prow repository. |
|
/test mysql-test |
|
@hawkingrei: The specified target(s) for Use DetailsIn 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 kubernetes-sigs/prow repository. |
|
/retest-required |
|
/test mysql-test |
|
@hawkingrei: The specified target(s) for Use DetailsIn 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 kubernetes-sigs/prow repository. |
|
@hawkingrei: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: close #68053
Problem Summary:
Constant folding can return an existing child expression from a folded parent expression.
FoldConstantthen copies the parent expression's coercibility, charset, collation, and repertoire onto the returned expression.For a mixed-type
CASEexpression folded to a child column, this mutates the shared columnRetTypefromutf8mb4tobinary. Later expressions in the same statement can then observe the polluted metadata and evaluate string functions such asREVERSE()with binary semantics.What changed and how does it work?
When
FoldConstantreturns a different top-level expression from the original expression, clone the returnedColumn,CorrelatedColumn, orScalarFunctionreturn type before applying the parent metadata.For cloned scalar functions, keep the scalar function return type and the cloned builtin signature return type aligned.
This keeps the narrow folded-result metadata override while avoiding mutation of shared child expressions.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Summary by CodeRabbit
Bug Fixes
Tests