Repository navigation
feat: use exact integer statistics for ordering inference - #26776
Open
haohuaijin wants to merge 8 commits into
Open
haohuaijin wants to merge 8 commits into
haohuaijin wants to merge 8 commits into
Conversation
Resolve equivalence property conflicts by preserving both trusted integer bounds and grouping propagation.
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?
Rationale for this change
An ordered integer column with exact extrema can still require a redundant sort for expressions such as
a + 1, because ordering analysis starts with an unbounded interval. Whenais ascending and its exact bounds are[1, 3], those bounds prove that adding one cannot overflow and preserves the input ordering.What changes are included in this PR?
EquivalenceProperties.What is the testing strategy for this PR?
Extend the existing
parquet_sorted_statistics.sltwith plan and result checks for safe arithmetic, signed overflow and unsigned underflow, consecutive and reordered projections, grouping, windows, filters and dynamic filters, and unions with bounded or unknown branches. The tests use the SLT runner's four target partitions and default sort pushdown.Strengthen the existing filtered Parquet scan round-trip test with exact integer extrema. The existing TPC-H round-trip test also verifies plans with multiple bounded columns.
Validation passed:
cargo fmt --allcargo clippy --all-targets --all-features -- -D warningsparquet_sorted_statistics.sltfileAre there any user-facing changes?
Ordered integer arithmetic can avoid redundant
SortExecoperators when exact bounds prove it safe. Bounds do not establish ordering on their own.The additive
EquivalenceProperties::with_column_statisticsAPI accepts exact integer extrema. Range propagation adds planning metadata work; it does not calculate bounds per row.