izveigor commented on code in PR #7207:
URL: https://github.com/apache/arrow-datafusion/pull/7207#discussion_r1285067561


##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -327,21 +363,34 @@ fn array(values: &[ColumnarValue]) -> 
Result<ColumnarValue> {
         })
         .collect();
 
-    let mut data_type = DataType::Null;
+    let mut data_type = None;
     for arg in &arrays {
         let arg_data_type = arg.data_type();
         if !arg_data_type.equals_datatype(&DataType::Null) {
-            data_type = arg_data_type.clone();
+            data_type = Some(arg_data_type.clone());
             break;
+        } else {
+            data_type = Some(DataType::Null);
         }
     }
 
     match data_type {
-        DataType::Null => Ok(ColumnarValue::Scalar(ScalarValue::new_list(
+        None => Ok(ColumnarValue::Scalar(ScalarValue::new_list(
             Some(vec![]),
             DataType::Null,
         ))),
-        _ => Ok(ColumnarValue::Array(array_array(
+        Some(DataType::Null) => {

Review Comment:
   See the discussion about supporting `DataType::Null`: 
https://github.com/apache/arrow-datafusion/issues/7144#issuecomment-1658270935. 
I don't think we should support `DataType::Null` in array functions. It would 
be better to cast `Null` into the same datatype as array (For example, if we 
have the array with `Int64Type`, then `Null` argument must be 
`ScalarValue::Int64(None)`.



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