Crystrix commented on a change in pull request #10486:
URL: https://github.com/apache/arrow/pull/10486#discussion_r757835647



##########
File path: cpp/src/arrow/compute/kernels/aggregate_basic_internal.h
##########
@@ -164,6 +195,20 @@ struct MeanImpl : public SumImpl<ArrowType, SimdLevel> {
   using SumImpl<ArrowType, SimdLevel>::options;
 };
 
+struct NullMeanImpl : public NullSumImpl {
+  explicit NullMeanImpl(const ScalarAggregateOptions& options_) : 
NullSumImpl(options_) {}
+
+  Status Finalize(KernelContext*, Datum* out) override {
+    if ((options.skip_nulls || this->is_empty) && options.min_count == 0) {
+      // Return 0 if the remaining data is empty
+      out->value = std::make_shared<DoubleScalar>(0);
+    } else {
+      out->value = MakeNullScalar(float64());

Review comment:
       `mean(null)` is different with `sum(null)` as the returned value should 
be a `DoubleScalar`




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


Reply via email to