neilconway commented on code in PR #23922:
URL: https://github.com/apache/datafusion/pull/23922#discussion_r3666245650
##########
datafusion/functions/src/math/floor.rs:
##########
@@ -234,6 +234,11 @@ impl ScalarUDFImpl for FloorFunc {
Ok(input[0].sort_properties)
}
+ fn strictly_order_preserving(&self, _inputs: &[ExprProperties]) ->
Result<bool> {
+ // floor allow distinct inputs to collapse into equal outputs
Review Comment:
"allows"
##########
datafusion/functions/src/math/factorial.rs:
##########
@@ -116,6 +117,17 @@ impl ScalarUDFImpl for FactorialFunc {
}
}
+ fn output_ordering(&self, inputs: &[ExprProperties]) ->
Result<SortProperties> {
+ // Keep the same ordering as the input
+ Ok(inputs[0].sort_properties)
+ }
+
+ fn strictly_order_preserving(&self, _inputs: &[ExprProperties]) ->
Result<bool> {
+ // There is one-to-one mapping between input and output and nulls maps
to nulls
+ // and because overflow will be resulted in an error and not wrapping
or saturating we are ok
+ Ok(true)
Review Comment:
I don't think this is right: `factorial(0) == factorial(1) == 1`.
##########
datafusion/functions/src/string/repeat.rs:
##########
@@ -160,6 +161,12 @@ impl ScalarUDFImpl for RepeatFunc {
fn documentation(&self) -> Option<&Documentation> {
self.doc()
}
+
+ fn strictly_order_preserving(&self, _inputs: &[ExprProperties]) ->
Result<bool> {
+ // repeat does not strictly preserve ordering since for the following
2 rows:
+ // "bc" and "bca" and repeat(2) the result will be "bcbc" and "bcabca"
which now the order is different
Review Comment:
```suggestion
// repeat('bc', 2) = 'bcbc' > repeat('bca', 2) = 'bcabca', so
ordering is not preserved
```
--
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]