pitrou commented on code in PR #44184:
URL: https://github.com/apache/arrow/pull/44184#discussion_r2180372067


##########
cpp/src/arrow/compute/kernels/hash_aggregate_numeric.cc:
##########
@@ -154,17 +154,29 @@ struct GroupedReducingAggregator : public 
GroupedAggregator {
   std::shared_ptr<DataType> out_type() const override { return out_type_; }
 
   template <typename T = Type>
-  static enable_if_t<!is_decimal_type<T>::value, std::shared_ptr<DataType>> 
GetOutType(
+  enable_if_t<!is_decimal_type<T>::value, Result<std::shared_ptr<DataType>>> 
GetOutType(
       const std::shared_ptr<DataType>& in_type) {
     return TypeTraits<AccType>::type_singleton();
   }
 
   template <typename T = Type>
-  static enable_if_decimal<T, std::shared_ptr<DataType>> GetOutType(
+  enable_if_decimal<T, Result<std::shared_ptr<DataType>>> GetOutType(
       const std::shared_ptr<DataType>& in_type) {
-    return in_type;
+    if (PromoteDecimal()) {
+      return WidenDecimalToMaxPrecision(in_type);
+    } else {
+      return in_type;
+    }
   }
 
+  /// If this returns true, then the aggregator will promote a decimal

Review Comment:
   Kind of a nit, but it might be better to avoid docstring notation (`///`) in 
`.cc` files because those are not APIs for which we want to expose a 
documentation.



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