viirya opened a new pull request, #25692: URL: https://github.com/apache/datafusion/pull/25692
## Which issue does this PR close? - Closes #25690. ## Rationale for this change `date_bin` advertises its input ordering even when scaling a coarse timestamp to nanoseconds can overflow and produce a per-row `NULL`. The optimizer can then remove a required sort and return `NULL` values in the wrong position. ## What changes are included in this PR? `date_bin` now reports unordered output for timestamp and time representations whose conversion to nanoseconds can overflow. Nanosecond inputs keep their existing ordering propagation, including the sorted unbounded execution path. ## What is the testing strategy for this PR? The new `timestamps.slt` regression reproduces the missing final sort and wrong `NULLS LAST` result on `main`, and passes with this change. Ablation testing confirmed that the regression fails without the fix. The focused `timestamps.slt` test passes on this branch. Before the two independent fixes were split into separate branches, they also passed `cargo fmt --all`, the extended workspace test suite, and clippy across the workspace except `datafusion-benchmarks` (the local host has CMake 3.16.3 while `snmalloc-sys` requires 3.21) with two pre-existing Rust 1.98 lints allowed. ## Are there any user-facing changes? Queries involving coarse-precision `date_bin` overflow now honor requested null ordering. There are no public API changes. -- 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]
