You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "2010YOUY01 (via GitHub)" <gi...@apache.org> on 2023/10/13 22:04:34 UTC
[PR] Move `Monotonicity` to `expr` crate [arrow-datafusion]
2010YOUY01 opened a new pull request, #7820:
URL: https://github.com/apache/arrow-datafusion/pull/7820
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
NA
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
I'm working on something related to functions and would like to use `Monotonicity` inside `expr` crate.
But now `Monotonicity` is defined in `physical-expr` crate, which depends on `expr`
Since it should be part of the function definition, it's better to move it into `expr` crate.
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Move `Monotonicity` to `expr` crate [arrow-datafusion]
Posted by "2010YOUY01 (via GitHub)" <gi...@apache.org>.
2010YOUY01 commented on code in PR #7820:
URL: https://github.com/apache/arrow-datafusion/pull/7820#discussion_r1359693096
##########
datafusion/physical-expr/src/functions.rs:
##########
@@ -964,47 +957,6 @@ fn func_order_in_one_dimension(
}
}
-/// This function specifies monotonicity behaviors for built-in scalar functions.
-/// The list can be extended, only mathematical and datetime functions are
-/// considered for the initial implementation of this feature.
-pub fn get_func_monotonicity(fun: &BuiltinScalarFunction) -> Option<FuncMonotonicity> {
Review Comment:
Thank you, I also think deprecation is better
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Move `Monotonicity` to `expr` crate [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #7820:
URL: https://github.com/apache/arrow-datafusion/pull/7820
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Minor: Move `Monotonicity` to `expr` crate [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #7820:
URL: https://github.com/apache/arrow-datafusion/pull/7820#discussion_r1359317116
##########
datafusion/physical-expr/src/functions.rs:
##########
@@ -964,47 +957,6 @@ fn func_order_in_one_dimension(
}
}
-/// This function specifies monotonicity behaviors for built-in scalar functions.
-/// The list can be extended, only mathematical and datetime functions are
-/// considered for the initial implementation of this feature.
-pub fn get_func_monotonicity(fun: &BuiltinScalarFunction) -> Option<FuncMonotonicity> {
Review Comment:
Can we please avoid a breaking api change by at least adding `pub use datafusion_expr::get_func_monotonicity` in this file?
However, since we are going to move this code anyways, what would you think about putting this code as a method on `BuiltinScalarFunction` itself, so that it was easier to find
Something like
```rust
impl BuiltinScalarFunction {
pub fn monotonicity(&self) -> Option<FuncMonotonicity> {
...
}
}
```
And leaving the `get_func_monotonicity` as a deprecated function, perhaps like
```rust
#[deprecated(message="use BuiltinScalarFunction::monotonicity")]
pub fn get_func_monotonicity(fun: &BuiltinScalarFunction) -> Option<FuncMonotonicity> {
fun.monotonicity()
}
```
##########
datafusion/physical-expr/src/functions.rs:
##########
@@ -903,14 +904,6 @@ pub fn create_physical_fun(
})
}
-/// Monotonicity of the `ScalarFunctionExpr` with respect to its arguments.
-/// 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.
-pub type FuncMonotonicity = Vec<Option<bool>>;
Review Comment:
Perhaps we can leave a `pub use datafusion_expr::FuncMonotonicty` in this module to ease backwards compatibility?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org