Toby1009 opened a new pull request, #25409:
URL: https://github.com/apache/datafusion/pull/25409
## Which issue does this PR close?
Closes #25353.
## Rationale for this change
`ORDER BY date_trunc(...)` can return incorrectly ordered results across
named timezone transitions because the optimizer treats `date_trunc` as
order-preserving and removes a required sort.
## What changes are included in this PR?
Return `SortProperties::Unordered` for timezone-aware timestamp inputs.
Keep the existing ordering propagation for timezone-free timestamps and
time values when the precision is constant.
UTC and fixed-offset timestamps are also excluded from ordering propagation.
Recognizing safe timezone-aware cases is left for a follow-up.
## What is the testing strategy for this PR?
- A unit test checks ordering propagation with and without a timezone.
- A regression test in `datetime/timestamps.slt` covers the
`America/Goose_Bay` reproducer from the issue.
- Full lint and workspace extended tests pass locally.
## Are there any user-facing changes?
Queries affected by #25353 now return correctly ordered results.
Some timezone-aware queries may retain sorts that were previously
eliminated.
--
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]