rok commented on a change in pull request #9758:
URL: https://github.com/apache/arrow/pull/9758#discussion_r616096806
##########
File path: cpp/src/arrow/compute/kernels/aggregate_basic.cc
##########
@@ -232,9 +238,9 @@ namespace {
const FunctionDoc count_doc{"Count the number of null / non-null values",
("By default, non-null values are counted.\n"
- "This can be changed through CountOptions."),
+ "This can be changed through
ScalarAggregateOptions."),
{"array"},
- "CountOptions"};
+ "ScalarAggregateOptions"};
const FunctionDoc sum_doc{
"Sum values of a numeric array", ("Null values are ignored."), {"array"}};
Review comment:
Done.
##########
File path: cpp/src/arrow/compute/kernels/aggregate_basic_internal.h
##########
@@ -71,41 +72,51 @@ struct SumImpl : public ScalarAggregator {
void MergeFrom(KernelContext*, KernelState&& src) override {
const auto& other = checked_cast<const ThisType&>(src);
+ this->length += other.length;
this->count += other.count;
this->sum += other.sum;
}
void Finalize(KernelContext*, Datum* out) override {
- if (this->count == 0) {
+ if (this->count < options.min_count) {
out->value = std::make_shared<OutputType>();
} else {
out->value = MakeScalar(this->sum);
}
}
+ size_t length = 0;
size_t count = 0;
typename SumType::c_type sum = 0;
+ ScalarAggregateOptions options;
};
template <typename ArrowType, SimdLevel::type SimdLevel>
struct MeanImpl : public SumImpl<ArrowType, SimdLevel> {
void Finalize(KernelContext*, Datum* out) override {
- if (this->count == 0) {
+ if (this->count == 0 || this->count < options.min_count) {
Review comment:
Done.
--
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:
[email protected]