Veeupup commented on code in PR #8333:
URL: https://github.com/apache/arrow-datafusion/pull/8333#discussion_r1408658065


##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -227,16 +227,25 @@ fn compute_array_dims(arr: Option<ArrayRef>) -> 
Result<Option<Vec<Option<u64>>>>
 }
 
 fn check_datatypes(name: &str, args: &[&ArrayRef]) -> Result<()> {
-    let data_type = args[0].data_type();
-    if !args.iter().all(|arg| {
-        arg.data_type().equals_datatype(data_type)
-            || arg.data_type().equals_datatype(&DataType::Null)
-    }) {
-        let types = args.iter().map(|arg| arg.data_type()).collect::<Vec<_>>();
-        return plan_err!("{name} received incompatible types: '{types:?}'.");
+    let mut data_types = args
+        .iter()
+        .map(|arg| arg.data_type())
+        .collect::<HashSet<_>>();
+    match data_types.len() {
+        1 => Ok(()),
+        2 => {
+            if data_types.remove(&DataType::Null) {

Review Comment:
   we do need to really use the modified data_types` because if the 
   `data_types.len()` is 2, if one is `Null` we do not need to another 
data_tpye. 
   
   But if the `data_types` both are not `Null`, which means that input arrays 
have different `data_types` than we can not handle



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