jorgecarleitao commented on a change in pull request #7967:
URL: https://github.com/apache/arrow/pull/7967#discussion_r471134155



##########
File path: rust/datafusion/src/sql/planner.rs
##########
@@ -523,10 +523,14 @@ impl<S: SchemaProvider> SqlToRel<S> {
 
                             let mut safe_args: Vec<Expr> = vec![];
                             for i in 0..rex_args.len() {
-                                safe_args.push(
-                                    rex_args[i]
-                                        .cast_to(fm.args()[i].data_type(), 
schema)?,
-                                );
+                                let expr = if fm.args()[i]
+                                    .contains(&rex_args[i].get_type(schema)?)
+                                {
+                                    rex_args[i].clone()
+                                } else {
+                                    rex_args[i].cast_to(&fm.args()[i][0], 
schema)?

Review comment:
       I am not sure we can easily declare a zero-argument UDF: we do not know 
how many rows we should build because we have no `ArrayRef` to count them. IMO 
this is something that we will have to re-visit.
   
   I will add a test for 2 arguments of various types.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to