rluvaton commented on code in PR #23807:
URL: https://github.com/apache/datafusion/pull/23807#discussion_r3651093020


##########
datafusion/expr/src/udf.rs:
##########
@@ -981,10 +986,44 @@ pub trait ScalarUDFImpl: Debug + DynEq + DynHash + Send + 
Sync + Any {
     /// the input ordering.
     ///
     /// For example, `concat(a || b)` preserves lexicographical ordering, but 
`abs(a)` does not.
+    ///
+    /// This is a *non-strict* (monotone) property: distinct inputs may map to
+    /// equal outputs. See [`Self::strictly_order_preserving`] for a related
+    /// strict property and [`ExprProperties::strictly_order_preserving`] for
+    /// an explanation of the difference.
     fn preserves_lex_ordering(&self, _inputs: &[ExprProperties]) -> 
Result<bool> {
         Ok(false)
     }
 
+    /// Returns true if the function is strictly order-preserving with respect

Review Comment:
   `output_ordering` does not tell you whether you can reuse the existing 
ordering when you have multiple order by keys (with how ties are handled)



##########
datafusion/expr/src/udf.rs:
##########
@@ -981,10 +986,44 @@ pub trait ScalarUDFImpl: Debug + DynEq + DynHash + Send + 
Sync + Any {
     /// the input ordering.
     ///
     /// For example, `concat(a || b)` preserves lexicographical ordering, but 
`abs(a)` does not.
+    ///
+    /// This is a *non-strict* (monotone) property: distinct inputs may map to
+    /// equal outputs. See [`Self::strictly_order_preserving`] for a related
+    /// strict property and [`ExprProperties::strictly_order_preserving`] for
+    /// an explanation of the difference.
     fn preserves_lex_ordering(&self, _inputs: &[ExprProperties]) -> 
Result<bool> {
         Ok(false)
     }
 
+    /// Returns true if the function is strictly order-preserving with respect
+    /// to its `Ordered` inputs: assuming those inputs advance simultaneously
+    /// (component-wise, i.e. all of them are sorted in the data), the output
+    /// is ordered in the same direction, equal outputs can only result from
+    /// equal values of those inputs (i.e. the mapping is one-to-one), and
+    /// nulls map to nulls.
+    ///
+    /// i.e. setting this to true means that `a.cmp(b) == f(a).cmp(f(b))`
+    ///
+    /// This is not simply a stricter [`Self::preserves_lex_ordering`] — the
+    /// two properties also assume different input orderings, and with
+    /// multiple ordered inputs neither implies the other. Monotone but

Review Comment:
   moved



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