lidavidm commented on a change in pull request #10876:
URL: https://github.com/apache/arrow/pull/10876#discussion_r695910432
##########
File path: cpp/src/arrow/compute/kernels/hash_aggregate.cc
##########
@@ -1900,6 +1900,97 @@ struct GroupedAllImpl : public
GroupedBooleanAggregator<GroupedAllImpl> {
num_groups, /*out_offset=*/0, no_nulls);
}
};
+
+// ----------------------------------------------------------------------
+// CountDistinct/Distinct implementation
+
+struct GroupedCountDistinctImpl : public GroupedAggregator {
+ Status Init(ExecContext* ctx, const FunctionOptions* options) override {
+ ctx_ = ctx;
+ pool_ = ctx->memory_pool();
+ return Status::OK();
+ }
+
+ Status Resize(int64_t new_num_groups) override {
+ num_groups_ = new_num_groups;
+ return Status::OK();
+ }
+
+ Status Consume(const ExecBatch& batch) override {
+ return grouper_->Consume(batch).status();
+ }
+
+ Status Merge(GroupedAggregator&& raw_other,
+ const ArrayData& group_id_mapping) override {
+ auto other = checked_cast<GroupedCountDistinctImpl*>(&raw_other);
+
+ // Get (group_id, value) pairs, then translate the group IDs and consume
them
Review comment:
Indeed. Thanks, fixed.
--
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]