andygrove commented on code in PR #3254:
URL: https://github.com/apache/arrow-datafusion/pull/3254#discussion_r963838566
##########
datafusion/optimizer/src/type_coercion.rs:
##########
@@ -116,18 +117,61 @@ impl ExprRewriter for TypeCoercionRewriter {
}
}
}
+ Expr::ScalarUDF { fun, args } => {
+ let new_expr = coerce_arguments_for_signature(
+ args.as_slice(),
+ &self.schema,
+ &fun.signature,
+ )?;
+ Ok(Expr::ScalarUDF {
+ fun: fun.clone(),
+ args: new_expr,
+ })
+ }
_ => Ok(expr),
}
}
}
+/// Returns `expressions` coerced to types compatible with
+/// `signature`, if possible.
+///
+/// See the module level documentation for more detail on coercion.
+pub fn coerce_arguments_for_signature(
Review Comment:
Yes, this is adapted from the `coerce` method in the `physical-expr` crate
that operates on physical expressions rather than logical expressions.
--
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]