Weijun-H commented on code in PR #15039:
URL: https://github.com/apache/datafusion/pull/15039#discussion_r1985179602
##########
datafusion/functions-nested/src/array_has.rs:
##########
@@ -439,6 +439,16 @@ 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 {
+ return match comparison_type {
+ ComparisonType::All => Ok(Arc::new(BooleanArray::from(
+ BooleanBuffer::new_set(haystack.len()),
+ ))),
+ ComparisonType::Any => Ok(Arc::new(BooleanArray::from(
+ BooleanBuffer::new_unset(haystack.len()),
+ ))),
+ };
Review Comment:
```suggestion
let buffer = match comparison_type {
ComparisonType::All => BooleanBuffer::new_set(haystack.len()),
ComparisonType::Any => BooleanBuffer::new_unset(haystack.len()),
};
return Ok(Arc::new(BooleanArray::from(buffer)));
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]