Toby1009 opened a new pull request, #25575:
URL: https://github.com/apache/datafusion/pull/25575

   ## Which issue does this PR close?
   
   - Closes #25465.
   
   ## Rationale for this change
   
   `date_bin` and `from_unixtime` currently report an unbounded `Null` interval 
from `evaluate_bounds`. This loses their output type during physical property 
analysis, so safe timezone-free expressions can retain redundant sorts.
   
   ## What changes are included in this PR?
   
   - Return typed unbounded bounds from `date_bin` using its source type.
   - Return typed unbounded bounds from `from_unixtime` when its session or 
explicit timezone is known, while keeping value-dependent unknown timezones 
unknown.
   - Document when scalar UDFs should provide typed unbounded bounds.
   - Add plan coverage for redundant sort removal and retain the named-timezone 
correctness regression case.
   
   ## What is the testing strategy for this PR?
   
   Unit tests cover timestamp, timezone-aware timestamp, `Time32`, `Time64`, 
session timezone, constant explicit timezone, and unknown timezone bounds. SQL 
logic tests cover redundant sort removal through timezone-free `date_bin` and 
`from_unixtime`, plus named-timezone correctness.
   
   The following checks pass:
   
   - `cargo fmt --all`
   - `cargo clippy --all-targets --all-features -- -D warnings`
   - `cargo test -p datafusion-functions evaluate_bounds --lib`
   - `cargo test --test sqllogictests -- timestamps.slt`
   - The extended workspace test suite required by the contributor guide
   
   ## Are there any user-facing changes?
   
   Queries that apply `date_trunc` to timezone-free `date_bin` or 
`from_unixtime` results can avoid redundant sorts. Named-timezone cases remain 
conservatively unordered.
   


-- 
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]

Reply via email to