Toby1009 opened a new issue, #25464: URL: https://github.com/apache/datafusion/issues/25464
### Is your feature request related to a problem or challenge? #25409 conservatively stops `date_trunc` from propagating ordering for timezone-aware timestamps because named timezone transitions can make truncation non-monotonic. UTC and fixed-offset timezones do not have these transitions, so treating them as unordered can retain sorts that could safely be removed. ### Describe the solution you'd like Identify and test timezone-aware cases where `date_trunc` is guaranteed to preserve ordering, starting with UTC and fixed-offset timezones. Propagate input ordering for these cases when the truncation precision is constant, while remaining conservative for unknown types and unsupported timezone cases. Add property tests and SQL regression coverage showing that safe cases can eliminate redundant sorts while the named-timezone counterexample in #25353 remains correctly ordered. Other possible extensions, such as particular granularities or bounded input ranges, can be evaluated separately once their ordering guarantees are established. ### Describe alternatives you've considered Keep the conservative behavior from #25409. This preserves correctness but may retain unnecessary sorts. ### Additional context Follow-up to #25409, requested during review. #25353 tracks the incorrect ordering; this issue tracks restoring optimization for safe timezone-aware inputs. -- 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]
