SteveLauC commented on code in PR #9401:
URL: https://github.com/apache/arrow-datafusion/pull/9401#discussion_r1507435726


##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -134,9 +134,25 @@ impl ExprSchemable for Expr {
                             )
                         })?;
 
+                        // perform additional function arguments validation 
(due to limited
+                        // expressiveness of `TypeSignature`), then infer 
return type
                         fun.return_type(&arg_data_types)
                     }
                     ScalarFunctionDefinition::UDF(fun) => {
+                        // verify that function is invoked with correct number 
and type of arguments as defined in `TypeSignature`
+                        data_types(&arg_data_types, 
fun.signature()).map_err(|_| {
+                            plan_datafusion_err!(
+                                "{}",
+                                utils::generate_signature_error_msg(
+                                    fun.name(),
+                                    fun.signature().clone(),
+                                    &arg_data_types,
+                                )
+                            )
+                        })?;

Review Comment:
   Thanks for this! Doing it during the planning stage eliminates so much 
duplicate code:)
   
   FYI @jonahgao, this addresses the TODO we talked about in this 
[comment](https://github.com/apache/arrow-datafusion/pull/9297#issuecomment-1958566729)



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

Reply via email to