You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "joroKr21 (via GitHub)" <gi...@apache.org> on 2025/03/10 10:30:47 UTC

Re: [PR] Int64 as default type for make_array function empty or null case [datafusion]

joroKr21 commented on code in PR #10790:
URL: https://github.com/apache/datafusion/pull/10790#discussion_r1987015574


##########
datafusion/functions-array/src/set_ops.rs:
##########
@@ -259,6 +259,17 @@ fn generic_set_lists<OffsetSize: OffsetSizeTrait>(
         return general_array_distinct::<OffsetSize>(l, &field);
     }
 
+    // Handle empty array at rhs case
+    // array_union(arr, []) -> arr;
+    // array_intersect(arr, []) -> [];
+    if r.value_length(0).is_zero() {
+        if set_op == SetOp::Union {
+            return Ok(Arc::new(l.clone()) as ArrayRef);
+        } else {
+            return Ok(Arc::new(r.clone()) as ArrayRef);
+        }
+    }

Review Comment:
   This will panic when `r` is empty and return wrong results when the first value in the `r` array is an empty list but the rest are not empty.



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org