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

   ## Which issue does this PR close?
   
   Found while reviewing #26111; no separate issue. This fix is independent of 
that PR.
   
   ## Rationale for this change
   
   `from_unixtime(CAST(seconds AS BIGINT))` could incorrectly eliminate a 
multi-key sort. Ordered input rows `(seconds, id) = (1.1, 1), (1.9, 0)` produce 
the same timestamp, but the IDs must be reordered to `0, 1`.
   
   ## What changes are included in this PR?
   
   Propagate the first argument's strict ordering property instead of 
unconditionally returning `true`.
   
   ## What is the testing strategy for this PR?
   
   Three compact SQL cases in `datetime/timestamps.slt` check the result 
ordering with and without a timezone, including NULLs, and verify that direct 
integer inputs still avoid an extra sort. The two regression cases fail without 
the fix.
   
   Validated with the targeted SQL test file, all 10 `from_unixtime` unit 
tests, formatting, and `git diff --check`.
   
   ## Are there any user-facing changes?
   
   Yes. Queries with lossy nested inputs to `from_unixtime` retain required 
sorts and return correctly ordered rows.
   
   


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