2010YOUY01 commented on code in PR #8180:
URL: https://github.com/apache/arrow-datafusion/pull/8180#discussion_r1393450192


##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -89,25 +89,39 @@ impl ExprSchemable for Expr {
                     .collect::<Result<Vec<_>>>()?;
                 Ok((fun.return_type)(&data_types)?.as_ref().clone())
             }
-            Expr::ScalarFunction(ScalarFunction { fun, args }) => {
-                let arg_data_types = args
-                    .iter()
-                    .map(|e| e.get_type(schema))
-                    .collect::<Result<Vec<_>>>()?;
-
-                // verify that input data types is consistent with function's 
`TypeSignature`
-                data_types(&arg_data_types, &fun.signature()).map_err(|_| {
-                    plan_datafusion_err!(
-                        "{}",
-                        utils::generate_signature_error_msg(
-                            &format!("{fun}"),
-                            fun.signature(),
-                            &arg_data_types,
-                        )
-                    )
-                })?;
-
-                fun.return_type(&arg_data_types)
+            Expr::ScalarFunction(ScalarFunction { func_def, args }) => {

Review Comment:
   There might have ~10 similar changes like this one during 
optimization/planning.
   `Expr::ScalarUDF` branch above will be moved inside



##########
datafusion/expr/src/expr.rs:
##########
@@ -338,19 +338,33 @@ impl Between {
     }
 }
 
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+pub enum ScalarFunctionDefinition {
+    /// Resolved to a built in scalar function
+    /// (will be removed long term)
+    BuiltIn(built_in_function::BuiltinScalarFunction),
+    /// Resolved to a user defined function
+    UDF(crate::ScalarUDF),
+    /// A scalar function that will be called by name
+    Name(Arc<str>),
+}
+
 /// ScalarFunction expression
 #[derive(Clone, PartialEq, Eq, Hash, Debug)]
 pub struct ScalarFunction {
     /// The function
-    pub fun: built_in_function::BuiltinScalarFunction,
+    pub func_def: ScalarFunctionDefinition,

Review Comment:
   This is the API change



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