lidavidm commented on a change in pull request #11623:
URL: https://github.com/apache/arrow/pull/11623#discussion_r744128125



##########
File path: cpp/src/arrow/compute/kernels/vector_selection.cc
##########
@@ -2013,8 +2013,13 @@ Result<std::shared_ptr<ChunkedArray>> TakeCA(const 
ChunkedArray& values,
     // TODO Case 3: If indices are sorted, can slice them and call Array Take
 
     // Case 4: Else, concatenate chunks and call Array Take
-    ARROW_ASSIGN_OR_RAISE(current_chunk,
-                          Concatenate(values.chunks(), ctx->memory_pool()));
+    if (values.chunks().empty()) {
+      ARROW_ASSIGN_OR_RAISE(current_chunk, MakeArrayOfNull(values.type(), 
/*length=*/0,
+                                                           
ctx->memory_pool()));
+    } else {
+      ARROW_ASSIGN_OR_RAISE(current_chunk,
+                            Concatenate(values.chunks(), ctx->memory_pool()));
+    }

Review comment:
       No, because if we're in the loop body, then we're calling Concatenate on 
the result of TakeCA, and TakeCA always returns one chunk. However, I've added 
more tests for this case.




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