duongcongtoai commented on code in PR #10148:
URL: https://github.com/apache/datafusion/pull/10148#discussion_r1581818121


##########
datafusion/physical-expr/src/scalar_function.rs:
##########
@@ -146,11 +146,22 @@ impl PhysicalExpr for ScalarFunctionExpr {
         // evaluate the function
         match self.fun {
             ScalarFunctionDefinition::UDF(ref fun) => {
-                if self.args.is_empty() {
-                    fun.invoke_no_args(batch.num_rows())
-                } else {
-                    fun.invoke(&inputs)
+                let output = match self.args.is_empty() {
+                    true => fun.invoke_no_args(batch.num_rows()),
+                    false => fun.invoke(&inputs),
+                }?;
+
+                if fun.validate_number_of_rows() {
+                    let output_size = match &output {
+                        ColumnarValue::Array(array) => array.len(),
+                        ColumnarValue::Scalar(_) => 1,

Review Comment:
   oh then perhaps the current implementation of arrow_typeof can be wrong, if 
we have a map like this:
   ```
   {id:1,name:"bob"}
   {id:"string_id",name:"alice"}
   ```
   then arrow_typeof(map.id) will returns
   ```
   int64
   int64
   ```
   Is it possible to have this kind of input, because a map's schema can be 
dynamic per row



-- 
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-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to