jayzhan211 commented on code in PR #10098:
URL: https://github.com/apache/datafusion/pull/10098#discussion_r1575897841


##########
datafusion/physical-expr/src/scalar_function.rs:
##########
@@ -144,24 +144,11 @@ impl PhysicalExpr for ScalarFunctionExpr {
     fn evaluate(&self, batch: &RecordBatch) -> Result<ColumnarValue> {
         // evaluate the arguments, if there are no arguments we'll instead 
pass in a null array
         // indicating the batch size (as a convention)
-        let inputs = match (
-            self.args.is_empty(),
-            self.name.parse::<BuiltinScalarFunction>(),
-        ) {
-            // MakeArray support zero argument but has the different behavior 
from the array with one null.
-            (true, Ok(scalar_fun))
-                if scalar_fun
-                    .signature()
-                    .type_signature
-                    .supports_zero_argument() =>
-            {
-                vec![ColumnarValue::create_null_array(batch.num_rows())]
-            }
+        let inputs = match self.args.is_empty() {
             // If the function supports zero argument, we pass in a null array 
indicating the batch size.
             // This is for user-defined functions.
-            (true, Err(_))
-                if self.supports_zero_argument && self.name != "make_array" =>
-            {
+            // MakeArray support zero argument but has the different behavior 
from the array with one null.

Review Comment:
   I think we should even return empty vec instead of null array here. Those 
logic should be handled in each function case by case to avoid adding specific 
assumptions to all the function.



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