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

##########
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:
   ```
   [SQL] select array_union(column1, column2) from 
arrays_with_repeating_elements_for_union;
   [Diff] (-expected|+actual)
   -   [0, 1]
   -   [1, 2]
   +   [0, 1, 1]
   +   [1, 1]
       [2, 3]
   -   [3, 4]
   +   [3]
   at test_files/array.slt:4380
   ```



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