haohuaijin opened a new pull request, #26776: URL: https://github.com/apache/datafusion/pull/26776
## Which issue does this PR close? Closes #25220. ## 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. For example, when `a` is 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? - Seed trusted non-null integer bounds from the original file-scan statistics into `EquivalenceProperties`. - Propagate bounds through computed projections, preserve them when extending properties for windows, and take the bounds covering every branch of a union. Unknown bounds remain conservative. - Preserve original scan statistics across protobuf round-trips so decoding retains the bounds used to establish ordering. Public statistics still apply the existing filter-precision policy. ## What is the testing strategy for this PR? Extend the existing `parquet_sorted_statistics.slt` with plan and result checks for safe arithmetic, overflow and unsigned underflow, consecutive and reordered projections, grouping, windows, filters and dynamic filters, and unions with bounded or unknown branches. The staged snapshot passes `cargo fmt --all` and `cargo clippy --all-targets --all-features -- -D warnings`. Relevant SLT, expression-property, datasource and protobuf tests were also run during development. ## Are there any user-facing changes? Ordered integer additions and subtractions can avoid redundant `SortExec` operators when exact bounds prove the arithmetic safe. Bounds do not establish an ordering on their own. Range propagation adds planning-time metadata work proportional to schema width and expression size; it does not add per-row bounds calculations. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
