jayzhan211 commented on code in PR #10148: URL: https://github.com/apache/datafusion/pull/10148#discussion_r1581838538
########## 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: In Duckdb, map keys can be **different value** for each row, but the types should not be different. In OLAP which has the columnar format (we use arrow), it does not make sense to have different types on different rows. -- 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