khwilson commented on code in PR #44184:
URL: https://github.com/apache/arrow/pull/44184#discussion_r2138010388
##########
cpp/src/arrow/compute/kernels/aggregate_test.cc:
##########
@@ -495,51 +495,67 @@ TEST_F(TestSumKernelRoundOff, Basics) {
}
TEST(TestDecimalSumKernel, SimpleSum) {
- for (const auto& ty : {decimal128(3, 2), decimal256(3, 2)}) {
+ std::vector<std::shared_ptr<DataType>> init_types = {decimal128(3, 2),
+ decimal256(3, 2)};
+ std::vector<std::shared_ptr<DataType>> out_types = {decimal128(38, 2),
+ decimal256(76, 2)};
+
+ for (size_t i = 0; i < init_types.size(); ++i) {
+ auto& ty = init_types[i];
+ auto& out_ty = out_types[i];
+
EXPECT_THAT(Sum(ArrayFromJSON(ty, R"([])")),
- ResultWith(ScalarFromJSON(ty, R"(null)")));
+ ResultWith(ScalarFromJSON(out_ty, R"(null)")));
EXPECT_THAT(Sum(ArrayFromJSON(ty, R"([null])")),
- ResultWith(ScalarFromJSON(ty, R"(null)")));
+ ResultWith(ScalarFromJSON(out_ty, R"(null)")));
EXPECT_THAT(
Sum(ArrayFromJSON(ty, R"(["0.00", "1.01", "2.02", "3.03", "4.04",
"5.05"])")),
- ResultWith(ScalarFromJSON(ty, R"("15.15")")));
+ ResultWith(ScalarFromJSON(out_ty, R"("15.15")")));
Datum chunks =
ChunkedArrayFromJSON(ty, {R"(["0.00", "1.01", "2.02", "3.03", "4.04",
"5.05"])"});
- EXPECT_THAT(Sum(chunks), ResultWith(ScalarFromJSON(ty, R"("15.15")")));
+ EXPECT_THAT(Sum(chunks), ResultWith(ScalarFromJSON(out_ty, R"("15.15")")));
chunks = ChunkedArrayFromJSON(
ty, {R"(["0.00", "1.01", "2.02"])", R"(["3.03", "4.04", "5.05"])"});
- EXPECT_THAT(Sum(chunks), ResultWith(ScalarFromJSON(ty, R"("15.15")")));
+ EXPECT_THAT(Sum(chunks), ResultWith(ScalarFromJSON(out_ty, R"("15.15")")));
chunks = ChunkedArrayFromJSON(
ty, {R"(["0.00", "1.01", "2.02"])", "[]", R"(["3.03", "4.04",
"5.05"])"});
- EXPECT_THAT(Sum(chunks), ResultWith(ScalarFromJSON(ty, R"("15.15")")));
+ EXPECT_THAT(Sum(chunks), ResultWith(ScalarFromJSON(out_ty, R"("15.15")")));
ScalarAggregateOptions options(/*skip_nulls=*/true, /*min_count=*/0);
EXPECT_THAT(Sum(ArrayFromJSON(ty, R"([])"), options),
- ResultWith(ScalarFromJSON(ty, R"("0.00")")));
+ ResultWith(ScalarFromJSON(out_ty, R"("0.00")")));
EXPECT_THAT(Sum(ArrayFromJSON(ty, R"([null])"), options),
- ResultWith(ScalarFromJSON(ty, R"("0.00")")));
+ ResultWith(ScalarFromJSON(out_ty, R"("0.00")")));
chunks = ChunkedArrayFromJSON(ty, {});
- EXPECT_THAT(Sum(chunks, options), ResultWith(ScalarFromJSON(ty,
R"("0.00")")));
+ EXPECT_THAT(Sum(chunks, options), ResultWith(ScalarFromJSON(out_ty,
R"("0.00")")));
EXPECT_THAT(
Sum(ArrayFromJSON(ty, R"(["1.01", null, "3.03", null, "5.05", null,
"7.07"])"),
options),
- ResultWith(ScalarFromJSON(ty, R"("16.16")")));
+ ResultWith(ScalarFromJSON(out_ty, R"("16.16")")));
EXPECT_THAT(Sum(ScalarFromJSON(ty, R"("5.05")")),
- ResultWith(ScalarFromJSON(ty, R"("5.05")")));
+ ResultWith(ScalarFromJSON(out_ty, R"("5.05")")));
EXPECT_THAT(Sum(ScalarFromJSON(ty, R"(null)")),
- ResultWith(ScalarFromJSON(ty, R"(null)")));
+ ResultWith(ScalarFromJSON(out_ty, R"(null)")));
EXPECT_THAT(Sum(ScalarFromJSON(ty, R"(null)"), options),
- ResultWith(ScalarFromJSON(ty, R"("0.00")")));
+ ResultWith(ScalarFromJSON(out_ty, R"("0.00")")));
Review Comment:
I dont think it does. Those situations (decimal32 and 64 support) were
removed for a future PR. All these cases were previously supported, we’re just
changing the return types
--
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]