You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/11/06 13:57:22 UTC
[GitHub] [arrow] lidavidm commented on a change in pull request #11623: ARROW-14583: [C++] Handle empty chunked arrays in Take, empty datasets in GroupByNode
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org