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 2020/11/14 02:58:12 UTC

[GitHub] [arrow] arw2019 commented on a change in pull request #8474: ARROW-10301: [C++][Compute] Implement "all" reduction kernel for boolean data

arw2019 commented on a change in pull request #8474:
URL: https://github.com/apache/arrow/pull/8474#discussion_r523365931



##########
File path: cpp/src/arrow/compute/kernels/aggregate_basic.cc
##########
@@ -151,6 +151,45 @@ std::unique_ptr<KernelState> MinMaxInit(KernelContext* ctx, const KernelInitArgs
   return visitor.Create();
 }
 
+// ----------------------------------------------------------------------
+// All implementation
+
+struct BooleanAllImpl : public ScalarAggregator {
+  void Consume(KernelContext*, const ExecBatch& batch) override {
+    // short-circuit if seen a false already
+    if (this->all == false) {
+      return;
+    }
+
+    const auto& data = *batch[0].array();
+    arrow::internal::OptionalBinaryBitBlockCounter counter(
+        data.buffers[1], data.offset, data.buffers[0], data.offset, data.length);
+    int64_t position = 0;
+    while (position < data.length) {
+      const auto block = counter.NextOrNotBlock();

Review comment:
       I named it after the bit operation we're using, which in this case is 
   https://github.com/apache/arrow/blob/7efb373ace6489dbebf2367dd91b05208e48a1bb/cpp/src/arrow/util/bit_block_counter.h#L196-L197




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org