sdf-jkl commented on code in PR #18789:
URL: https://github.com/apache/datafusion/pull/18789#discussion_r2543185972
##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -1956,6 +1962,36 @@ impl<S: SimplifyInfo> TreeNodeRewriter for
Simplifier<'_, S> {
}))
}
+ // =======================================
Review Comment:
I was under the impression that the `simplify` method takes in the arguments
of the scalar function. However, if the `simplify` arguments can be anything we
want, it should be doable.
There is, however, an issue that `args` is a `Vec<Expr>` while we also need
to include an `Operator` in the arguments.
```rust
/// Optionally apply per-UDF simplification / rewrite rules.
/// ...
/// # Arguments
/// * `args`: The arguments of the function <---- This gave me the idea
/// * `info`: The necessary information for simplification
/// ...
/// # Notes
///
/// The returned expression must have the same schema as the original
/// expression, including both the data type and nullability. For
example,
/// if the original expression is nullable, the returned expression must
/// also be nullable, otherwise it may lead to schema verification errors
/// later in query planning.
fn simplify(
&self,
args: Vec<Expr>, // <---- the args are a Vec<Expr>. How to include
Operator?
_info: &dyn SimplifyInfo,
) -> Result<ExprSimplifyResult> {
Ok(ExprSimplifyResult::Original(args))
}
```
--
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]