rluvaton commented on code in PR #23923:
URL: https://github.com/apache/datafusion/pull/23923#discussion_r3658634187


##########
datafusion/functions-nested/src/empty.rs:
##########
@@ -122,9 +122,17 @@ fn array_empty_inner(args: &[ArrayRef]) -> 
Result<ArrayRef> {
 }
 
 fn general_array_empty<O: OffsetSizeTrait>(array: &ArrayRef) -> 
Result<ArrayRef> {
-    let result = as_generic_list_array::<O>(array)?
-        .iter()
-        .map(|arr| arr.map(|arr| arr.is_empty()))
-        .collect::<BooleanArray>();
+    let result = as_generic_list_array::<O>(array)?;
+    // No nulls, just look at the offsets
+    let is_empty_iter = result.offsets().lengths().map(|n| n == 0);

Review Comment:
   this is faster since we only need to look at one buffer and can make it very 
fast
   the values of the list are irrelevent



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

Reply via email to