js8544 commented on code in PR #37536:
URL: https://github.com/apache/arrow/pull/37536#discussion_r1325277342


##########
cpp/src/arrow/compute/kernels/aggregate_test.cc:
##########
@@ -147,60 +151,76 @@ void ValidateBooleanAgg(const std::string& json,
   AssertScalarsEqual(*expected, *result.scalar(), /*verbose=*/true);
 }
 
-TEST(TestBooleanAggregation, Sum) {
+template <UnaryOp& SumOp>
+void TestBooleanAggregationSum() {

Review Comment:
   The template parameter is removed



##########
cpp/src/arrow/compute/kernels/aggregate_test.cc:
##########
@@ -592,25 +649,54 @@ TEST(TestNullSumKernel, Basics) {
   Datum null_result = std::make_shared<Int64Scalar>();
   Datum zero_result = std::make_shared<Int64Scalar>(0);
 
-  EXPECT_THAT(Sum(ScalarFromJSON(ty, "null")), ResultWith(null_result));
-  EXPECT_THAT(Sum(ArrayFromJSON(ty, "[]")), ResultWith(null_result));
-  EXPECT_THAT(Sum(ArrayFromJSON(ty, "[null]")), ResultWith(null_result));
-  EXPECT_THAT(Sum(ChunkedArrayFromJSON(ty, {"[null]", "[]", "[null, null]"})),
-              ResultWith(null_result));
+  for (auto func : {Sum, SumChecked}) {
+    SCOPED_TRACE(func);
+    auto default_options = ScalarAggregateOptions::Defaults();
+    EXPECT_THAT(func(ScalarFromJSON(ty, "null"), default_options, nullptr),
+                ResultWith(null_result));
+    EXPECT_THAT(func(ArrayFromJSON(ty, "[]"), default_options, nullptr),
+                ResultWith(null_result));
+    EXPECT_THAT(func(ArrayFromJSON(ty, "[null]"), default_options, nullptr),
+                ResultWith(null_result));
+    EXPECT_THAT(func(ChunkedArrayFromJSON(ty, {"[null]", "[]", "[null, 
null]"}),
+                     default_options, nullptr),
+                ResultWith(null_result));
 
-  ScalarAggregateOptions options(/*skip_nulls=*/true, /*min_count=*/0);
-  EXPECT_THAT(Sum(ScalarFromJSON(ty, "null"), options), 
ResultWith(zero_result));
-  EXPECT_THAT(Sum(ArrayFromJSON(ty, "[]"), options), ResultWith(zero_result));
-  EXPECT_THAT(Sum(ArrayFromJSON(ty, "[null]"), options), 
ResultWith(zero_result));
-  EXPECT_THAT(Sum(ChunkedArrayFromJSON(ty, {"[null]", "[]", "[null, null]"}), 
options),
-              ResultWith(zero_result));
+    ScalarAggregateOptions options(/*skip_nulls=*/true, /*min_count=*/0);
+    EXPECT_THAT(func(ScalarFromJSON(ty, "null"), options, nullptr),
+                ResultWith(zero_result));
+    EXPECT_THAT(func(ArrayFromJSON(ty, "[]"), options, nullptr), 
ResultWith(zero_result));
+    EXPECT_THAT(func(ArrayFromJSON(ty, "[null]"), options, nullptr),
+                ResultWith(zero_result));
+    EXPECT_THAT(func(ChunkedArrayFromJSON(ty, {"[null]", "[]", "[null, 
null]"}), options,
+                     nullptr),
+                ResultWith(zero_result));
+
+    options = ScalarAggregateOptions(/*skip_nulls=*/false, /*min_count=*/0);
+    EXPECT_THAT(func(ScalarFromJSON(ty, "null"), options, nullptr),
+                ResultWith(null_result));
+    EXPECT_THAT(func(ArrayFromJSON(ty, "[]"), options, nullptr), 
ResultWith(zero_result));
+    EXPECT_THAT(func(ArrayFromJSON(ty, "[null]"), options, nullptr),
+                ResultWith(null_result));
+    EXPECT_THAT(func(ChunkedArrayFromJSON(ty, {"[null]", "[]", "[null, 
null]"}), options,
+                     nullptr),
+                ResultWith(null_result));
+  }
+}
 
-  options = ScalarAggregateOptions(/*skip_nulls=*/false, /*min_count=*/0);
-  EXPECT_THAT(Sum(ScalarFromJSON(ty, "null"), options), 
ResultWith(null_result));
-  EXPECT_THAT(Sum(ArrayFromJSON(ty, "[]"), options), ResultWith(zero_result));
-  EXPECT_THAT(Sum(ArrayFromJSON(ty, "[null]"), options), 
ResultWith(null_result));
-  EXPECT_THAT(Sum(ChunkedArrayFromJSON(ty, {"[null]", "[]", "[null, null]"}), 
options),
-              ResultWith(null_result));
+TEST(TestSumKernel, Overflow) {
+  for (const auto& ty : {uint64(), int64()}) {

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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to