jayzhan211 commented on PR #26111:
URL: https://github.com/apache/datafusion/pull/26111#issuecomment-6245173908

   Same gap as the `to_timestamp_*` one, now on `to_unixtime`: integer (`Int64` 
cast, overflow errors), Date32 (`days * 86400`) and `Timestamp(Second, _)` 
(identity) are one-to-one, but no strict flag is set, so `ORDER BY 
to_unixtime(d), id` over `(d, id)` still keeps a `SortExec`. Date64 and 
sub-second timestamps truncate and should stay non-strict. Fine to handle in a 
follow-up.
   
   ```rs
   fn preserves_lex_ordering(&self, input: &[ExprProperties]) -> Result<bool> {
       Ok(self.output_ordering(input)? != SortProperties::Unordered
           || matches!(input, [value] if is_supported(value.range.data_type())))
   }
   
   fn strictly_order_preserving(&self, input: &[ExprProperties]) -> 
Result<bool> {
       // Exact or scaled-by-constant conversions are one-to-one; Date64 and
       // sub-second timestamps truncate to seconds.
       Ok(matches!(
           input,
           [value] if value.strictly_order_preserving
               && (value.range.data_type().is_integer()
                   || matches!(
                       value.range.data_type(),
                       DataType::Date32 | DataType::Timestamp(TimeUnit::Second, 
_)
                   ))
       ))
   }
   ```


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