alamb commented on code in PR #10086:
URL:
https://github.com/apache/arrow-datafusion/pull/10086#discussion_r1570559031
##########
datafusion/functions/src/math/log.rs:
##########
@@ -146,51 +151,74 @@ impl ScalarUDFImpl for LogFunc {
/// 3. Log(a, a) ===> 1
fn simplify(
&self,
- args: Vec<Expr>,
+ mut args: Vec<Expr>,
info: &dyn SimplifyInfo,
) -> Result<ExprSimplifyResult> {
- let mut number = &args[0];
- let mut base =
-
&Expr::Literal(ScalarValue::new_ten(&info.get_data_type(number)?)?);
- if args.len() == 2 {
- base = &args[0];
- number = &args[1];
+ // Args are either
+ // log(number)
+ // log(base, number)
+ let num_args = args.len();
+ if args.len() > 2 {
+ return plan_err!("Expected log to have 1 or 2 arguments, got
{num_args}");
Review Comment:
I think the idea here is that simplify gets called as part of planning (not
execution) so planning makes sense to me. Though I am not sure what practical
difference it makes in this case 🤔
--
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]