Toby1009 opened a new pull request, #25635: URL: https://github.com/apache/datafusion/pull/25635
## Which issue does this PR close? Closes #25464. ## Rationale for this change `date_trunc` currently treats all timezone-aware inputs as unordered, retaining redundant sorts even for UTC and fixed-offset timestamps. These timezones have no transitions that could reverse the order after truncation. ## What changes are included in this PR? - Propagate input ordering for UTC and numeric fixed-offset timestamps when the truncation precision is constant. - Add a shared `is_fixed_offset_timezone` utility for `date_trunc` and cast ordering inference, using Arrow's timezone parser to validate numeric offsets. - Keep unknown input types and other timezone names conservative, including fixed aliases such as `Etc/UTC` that this check does not recognize. - Resolve two existing Clippy warnings in the narrow-decimal group-by benchmark with equivalent expressions and a local type alias, allowing the full lint checks to pass. ## What is the testing strategy for this PR? - Unit tests cover timezone classification and ordering properties across timestamp units, sort directions, null placement, and nonconstant precision. - A seeded property test checks monotonic array outputs across fixed timezones and truncation granularities, including negative timestamps, calendar boundaries, and nulls. - `timestamps.slt` checks results and plans for UTC and positive/negative offsets, plus a compound sort that must reorder a trailing key after timestamps collapse into the same bucket. Existing named-timezone and unknown-range regressions remain covered. Validation: the extended workspace suite passed (12,089 tests passed, 8 ignored; 522/522 SQL test files completed). `cargo fmt --all`, the full `dev/rust_lint.sh` suite, `cargo clippy --all-targets --all-features -- -D warnings`, and diff checks also passed. The new ordering test was previously checked against the unchanged implementation and failed for UTC as expected. ## Are there any user-facing changes? Queries over inputs with known ordering can avoid redundant sorts for UTC and numeric fixed-offset timestamps. Timestamp values and truncation behavior are unchanged. -- 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]
