You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jayzhan211 (via GitHub)" <gi...@apache.org> on 2023/12/04 01:25:03 UTC

Re: [PR] Move Coercion for MakeArray to `coerce_arguments_for_signature` and introduce another one for ArrayAppend [arrow-datafusion]

jayzhan211 commented on code in PR #8317:
URL: https://github.com/apache/arrow-datafusion/pull/8317#discussion_r1413281259


##########
datafusion/expr/src/type_coercion/functions.rs:
##########
@@ -85,6 +91,24 @@ fn get_valid_types(
             .iter()
             .map(|valid_type| (0..*number).map(|_| valid_type.clone()).collect())
             .collect(),
+        TypeSignature::VariadicCoerced => {
+            let new_type = current_types.iter().skip(1).try_fold(
+                current_types.first().unwrap().clone(),
+                |acc, x| {
+                    let corced_type = comparison_coercion(&acc, x);
+                    if let Some(corced_type) = corced_type {
+                        Ok(corced_type)
+                    } else {
+                        internal_err!("Coercion from {acc:?} to {x:?} failed.")

Review Comment:
   We call unwrap_or previously so `select [1, true, null]` unexpectedly correct since true is castable to 1 in arrow-rs but not in datafusion.  `select [true, 1, null]` failed. It is better that we just return error if not coercible.



-- 
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-unsubscribe@arrow.apache.org

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