expression: clone constant before PropagateType mutation#68433
Conversation
|
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 (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughClone Constant nodes during ETReal type propagation to avoid mutating decimal metadata; add unit test and cascades regression test validating SIGN() on view-returned decimals preserves scale and emits no warnings. ChangesDecimal scale leak fix in type propagation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #68433 +/- ##
================================================
- Coverage 77.2798% 75.7084% -1.5715%
================================================
Files 2010 2008 -2
Lines 555326 563442 +8116
================================================
- Hits 429155 426573 -2582
- Misses 125251 136812 +11561
+ Partials 920 57 -863
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest-required |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: guo-shaoge, windtalker The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
f4d2d8b to
f3ff867
Compare
|
/retest |
What problem does this PR solve?
Issue Number: close #66706
Problem Summary:
When a view projects a DECIMAL constant and an outer predicate applies
SIGN()to that view column, the implicit cast-to-real path can propagate widened DECIMAL metadata back into the shared constant. The projected view column can then be displayed with a widened scale, for example0.990000000000000000000000000000instead of0.99.What changed and how does it work?
PropagateTypenow clones*expression.Constantbefore mutating propagated type metadata, matching the existing clone-before-mutate handling forColumnandCorrelatedColumn. This keeps the cast-local widened metadata from leaking back into a shared view projection constant.This PR also adds:
pkg/expressionunit assertion that the original constant keeps DECIMAL(5,2) while the cast-local clone gets the propagated type;Check List
Tests
Manual test:
go test ./.tmp/issue66706 -run TestIssue66706Replay -count=1 -tags=intest,deadlock -vBefore the fix, the direct view-predicate query returned
0.990000000000000000000000000000with result field DECIMAL(48,30), while the derived-table control returned0.99. After the fix, both returned0.99and the direct result field stayed DECIMAL(5,2).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