You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/09/07 10:33:50 UTC
[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #3254: Add type coercion for UDFs in logical plan
liukun4515 commented on code in PR #3254:
URL: https://github.com/apache/arrow-datafusion/pull/3254#discussion_r964670550
##########
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:
Do we need to public this method?
I think it's better to make it private.
--
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