LuQQiu commented on code in PR #15039:
URL: https://github.com/apache/datafusion/pull/15039#discussion_r1982505448


##########
datafusion/functions-nested/src/array_has.rs:
##########
@@ -439,6 +439,14 @@ fn array_has_all_and_any_dispatch<O: OffsetSizeTrait>(
 ) -> Result<ArrayRef> {
     let haystack = as_generic_list_array::<O>(haystack)?;
     let needle = as_generic_list_array::<O>(needle)?;
+    if needle.values().len() == 0 {
+        let result_value = match comparison_type {
+            ComparisonType::All => true,
+            ComparisonType::Any => false,
+        };
+        let result = BooleanArray::from(vec![result_value; haystack.len()]);

Review Comment:
   Using 
   ```
       if needle.values().len() == 0 {
           return match comparison_type {
               ComparisonType::All => 
Ok(Arc::new(BooleanBuffer::new_set(haystack.len()))),
               ComparisonType::Any =>  
Ok(Arc::new(BooleanBuffer::new_unset(haystack.len())))
           };
       }
   ```
   Runs into
   ```
   the trait bound `BooleanBuffer: arrow::array::Array` is not satisfied
   the following other types implement trait `arrow::array::Array`:
     &T
     BooleanArray
     DictionaryArray<T>
     FixedSizeBinaryArray
     FixedSizeListArray
     GenericByteArray<T>
     GenericByteViewArray<T>
     GenericListArray<OffsetSize>
   and 10 others
   required for the cast from `std::sync::Arc<BooleanBuffer>` to 
`std::sync::Arc<dyn arrow::array::Array>`rustc[Click for full compiler 
diagnostic](rust-analyzer-diagnostics-view:/diagnostic%20message%20[0]?0#file:///Users/lu/Projects/Github/Work/datafusion/datafusion/functions-nested/src/array_has.rs)
   ```



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