felipecrv commented on code in PR #35674:
URL: https://github.com/apache/arrow/pull/35674#discussion_r1198161449


##########
cpp/src/arrow/array/array_nested.cc:
##########
@@ -177,6 +177,8 @@ Result<std::shared_ptr<Array>> FlattenListArray(const 
ListArrayT& list_array,
   // Final attempt to avoid invoking Concatenate().
   if (non_null_fragments.size() == 1) {
     return non_null_fragments[0];
+  } else if (non_null_fragments.size() == 0) {
+    return MakeEmptyArray(value_array->type(), memory_pool);

Review Comment:
   Might also be worth it to add and `} else if (list_array.null_count() == 
list_array->length()) {` to the `if (list_array.null_count() == 0)` above and 
avoid the calculation of fragments altogether when we are lucky and 
`null_count` is already calculated for us.



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

Reply via email to