Taepper commented on code in PR #46926:
URL: https://github.com/apache/arrow/pull/46926#discussion_r3404782037
##########
cpp/src/arrow/compute/kernels/vector_select_k.cc:
##########
@@ -205,19 +339,38 @@ class ChunkedArraySelector : public TypeVisitor {
if (k_ > chunked_array_.length()) {
k_ = chunked_array_.length();
}
+
+ ARROW_ASSIGN_OR_RAISE(auto take_indices,
+ MakeMutableUInt64Array(k_, ctx_->memory_pool()));
+ auto* output_begin = take_indices->GetMutableValues<uint64_t>(1);
+
+ int64_t null_count = chunked_array_.null_count();
+ int64_t nan_count = ComputeNanCount<InType>();
+ int64_t non_null_like_count = chunked_array_.length() - null_count -
nan_count;
+
Review Comment:
This indeed worked out quite nicely! The temporary storage of all `indices`
for the individual chunks could still be a bit better. Maybe I should introduce
a struct that holds all three of `array`, `indices` and `partitions`?
And I hope naming the individual parts of a `ChunkedArray` `chunks` and not
`arrays` is consistent. At least other code I checked also referred to the
parts as `chunks`
--
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]