You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This function specifies monotonicity behaviors for User defined scalar functions.fnmonotonicity(&self) -> Result<Option<Vec<Option<bool>>>,DataFusionError>{..}
The challenge is the cognative complexity of understanding what Result<Option<Vec<Option<bool>>> means
However, since it is a typedef it doesn't show up in the Rust docs
Describe the solution you'd like
An easy to understand Monotonicity API
Describe alternatives you've considered
I think it would be great to have an API like this:
// This function specifies monotonicity behaviors for User defined scalar functions.fnmonotonicity(&self) -> Result<Monotonicity>,DataFusionError> {..}
And then we could make Monotonicity an enum that captured the relevant data. This would both be easier to understand and likely more efficient as well
Something like
/// Monotonicity of a function with respect to its arguments.////// A function is [monotonic] if it preserves the relative order of its inputs. ////// [monotonic]: https://en.wikipedia.org/wiki/Monotonic_functionpubenumMonotonicity{/// not monotonic or unknown monotonicityNone,/// Increasing with respect to all of its argumentsIncreasing,/// Decreasing with respect to all of its argumentsDecreasing,/// Each element of this vector corresponds to an argument and indicates whether/// the function's behavior is monotonic, or non-monotonic/unknown for that argument, namely:/// - `None` signifies unknown monotonicity or non-monotonicity./// - `Some(true)` indicates that the function is monotonically increasing w.r.t. the argument in question./// - Some(false) indicates that the function is monotonically decreasing w.r.t. the argument in question.Mixed(Vec<bool>),}
I think this would be much eaiser to reason about
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem or challenge?
While reviewing #9869 from @tinfoil-knight I was confused about the
ScalarUDFImpl::monotonicity
APIThe challenge is the cognative complexity of understanding what
Result<Option<Vec<Option<bool>>>
meansThe actual code is defined in terms
FuncMonotonicity
https://github.com/apache/arrow-datafusion/blob/57c0bc65280c467ef6f5a498c6e78a616401b286/datafusion/expr/src/signature.rs#L350-L356However, since it is a typedef it doesn't show up in the Rust docs
Describe the solution you'd like
An easy to understand Monotonicity API
Describe alternatives you've considered
I think it would be great to have an API like this:
And then we could make
Monotonicity
an enum that captured the relevant data. This would both be easier to understand and likely more efficient as wellSomething like
I think this would be much eaiser to reason about
Additional context
No response
The text was updated successfully, but these errors were encountered: