mbrobbel commented on a change in pull request #11937:
URL: https://github.com/apache/arrow/pull/11937#discussion_r771354239
##########
File path: cpp/src/arrow/compute/api_vector.h
##########
@@ -188,6 +188,35 @@ class ARROW_EXPORT PartitionNthOptions : public
FunctionOptions {
NullPlacement null_placement;
};
+/// \brief Options for IsMonotonic
+class ARROW_EXPORT IsMonotonicOptions : public FunctionOptions {
+ public:
+ enum NullHandling {
+ /// Ignore nulls.
+ IGNORE_NULLS,
+ /// Use min value of element type as the value of nulls.
+ /// -Inf for floating point numbers.
+ USE_MIN_VALUE,
+ /// Use max value of element type as the value of nulls.
+ /// Inf for floating point numbers.
+ USE_MAX_VALUE
+ };
Review comment:
Yes, I agree that a sort before invoking this kernel should result in
true for the corresponding check. However I feel the null handling variants are
a bit confusing: `AtStart` defines `NaN > null` and `AtEnd` defines `NaN <
null`. Also, the sorting kernel can ignore equality, but this kernels considers
it to check if values are unique (strictly increasing/decreasing).
I think if we want to allow users to define order of unordered values (both
for sorting and this kernel) we need something like this:
```c++
bool compare_nulls = false; // default: any null results in false outputs
(or error in case of sort)
bool compare_nans = false; // default: any nan results in false outputs (or
error in case of sort)
// these are not needed when sorting
bool nulls_equal = false; // when nulls are compared, are they considered
equal?
bool nans_equal = false; // when nans are compared, are they considered
equal?
// when both nulls and nans are compared
enum Ordering { Less, Equal, Greater }
Ordering nan_compared_with_null; // when comparing nulls and nans, what
ordering should be used?
```
--
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]