feat: recognize more lossless casts for statistics and ordering - #25500
Open
haohuaijin wants to merge 2 commits into
Open
haohuaijin wants to merge 2 commits into
haohuaijin wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25500 +/- ##
========================================
Coverage 82.38% 82.38%
========================================
Files 1138 1138
Lines 433733 433927 +194
Branches 433733 433927 +194
========================================
+ Hits 357331 357509 +178
- Misses 54848 54854 +6
- Partials 21554 21564 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Follow-up to #25227 and its discussion.
Rationale for this change
Some lossless casts unnecessarily discard column statistics or fail to preserve strict ordering information.
For example, UInt32 → Int64 currently requires both bounds to be exact to propagate statistics, even though every UInt32 value fits in Int64. Recognizing this conversion as globally safe preserves available statistics even when one bound is absent or bounds are inexact.
What changes are included in this PR?
check_bigger_cast/is_bigger_castpredicates to recognize these lossless conversions.What is the testing strategy for this PR?
Validation on the latest revision: 25 relevant unit tests passed; one existing test is ignored. Formatting, all-target/all-feature Clippy, and the standard
rust_lint.shsuite passed.Are there any user-facing changes?
More lossless casts retain statistics and strict ordering information, enabling existing optimizer rules.