felipecrv commented on code in PR #35345:
URL: https://github.com/apache/arrow/pull/35345#discussion_r1337675042
##########
cpp/src/arrow/array/concatenate.cc:
##########
@@ -602,8 +691,11 @@ class ConcatenateImpl {
} // namespace
Result<std::shared_ptr<Array>> Concatenate(const ArrayVector& arrays,
MemoryPool* pool) {
- if (arrays.size() == 0) {
- return Status::Invalid("Must pass at least one array");
+ switch (arrays.size()) {
+ case 0:
+ return Status::Invalid("Must pass at least one array");
+ case 1:
+ return arrays[0];
Review Comment:
I'm keeping the original code in `array_nested.cc` as `FlattenListArray` can
totally return non-trimmed slices of arrays.
```cpp
// 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);
}
return Concatenate(non_null_fragments, memory_pool);
```
So my change was just reverting the commit that added the fast path to
`Concatenate()`.
--
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]