From 366b82e01f3eb8c9127f2efc0e93b6ac23e4aed0 Mon Sep 17 00:00:00 2001 From: David Wendt Date: Tue, 14 Mar 2023 11:57:28 -0400 Subject: [PATCH 1/2] Fix cudf::segmented_reduce gtest for ANY aggregation --- .../reductions/segmented_reduction_tests.cpp | 38 ++++++------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/cpp/tests/reductions/segmented_reduction_tests.cpp b/cpp/tests/reductions/segmented_reduction_tests.cpp index 74c5e7fb504..72ba5b53ae7 100644 --- a/cpp/tests/reductions/segmented_reduction_tests.cpp +++ b/cpp/tests/reductions/segmented_reduction_tests.cpp @@ -31,11 +31,9 @@ #define XXX 0 // null placeholder template -struct SegmentedReductionTest : public cudf::test::BaseFixture { -}; +struct SegmentedReductionTest : public cudf::test::BaseFixture {}; -struct SegmentedReductionTestUntyped : public cudf::test::BaseFixture { -}; +struct SegmentedReductionTestUntyped : public cudf::test::BaseFixture {}; TYPED_TEST_CASE(SegmentedReductionTest, cudf::test::NumericTypes); @@ -251,36 +249,25 @@ TYPED_TEST(SegmentedReductionTest, AnyExcludeNulls) {false, false, true, true, bool{XXX}, false, true, bool{XXX}, bool{XXX}}, {true, true, true, true, false, true, true, false, false}}; - auto res = - cudf::segmented_reduce(input, - d_offsets, - *cudf::make_any_aggregation(), - cudf::data_type{cudf::type_id::BOOL8}, - cudf::null_policy::EXCLUDE); + auto const agg = cudf::make_any_aggregation(); + auto const output_type = cudf::data_type{cudf::type_id::BOOL8}; + auto const policy = cudf::null_policy::EXCLUDE; + + auto res = cudf::segmented_reduce(input, d_offsets, *agg, output_type, policy); CUDF_TEST_EXPECT_COLUMNS_EQUAL(*res, expect); // Test with initial value - auto const init_scalar = cudf::make_fixed_width_scalar(1); + auto const init_scalar = cudf::make_fixed_width_scalar(0); auto const init_expect = cudf::test::fixed_width_column_wrapper{ - {true, true, true, true, true, true, true, true, true}, + {false, false, true, true, false, false, true, false, false}, {true, true, true, true, true, true, true, true, true}}; - res = cudf::segmented_reduce(input, - d_offsets, - *cudf::make_any_aggregation(), - cudf::data_type{cudf::type_id::BOOL8}, - cudf::null_policy::EXCLUDE, - *init_scalar); + res = cudf::segmented_reduce(input, d_offsets, *agg, output_type, policy, *init_scalar); CUDF_TEST_EXPECT_COLUMNS_EQUAL(*res, init_expect); // Test with null initial value init_scalar->set_valid_async(false); - res = cudf::segmented_reduce(input, - d_offsets, - *cudf::make_any_aggregation(), - cudf::data_type{cudf::type_id::BOOL8}, - cudf::null_policy::EXCLUDE, - *init_scalar); + res = cudf::segmented_reduce(input, d_offsets, *agg, output_type, policy, *init_scalar); CUDF_TEST_EXPECT_COLUMNS_EQUAL(*res, expect); } @@ -1089,8 +1076,7 @@ TEST_F(SegmentedReductionTestUntyped, EmptyInputWithOffsets) } template -struct SegmentedReductionFixedPointTest : public cudf::test::BaseFixture { -}; +struct SegmentedReductionFixedPointTest : public cudf::test::BaseFixture {}; TYPED_TEST_SUITE(SegmentedReductionFixedPointTest, cudf::test::FixedPointTypes); From b99c028c6f9c67ce99c43dc557b2cf4d9a297ea5 Mon Sep 17 00:00:00 2001 From: David Wendt Date: Tue, 14 Mar 2023 11:58:43 -0400 Subject: [PATCH 2/2] fix style violation --- cpp/tests/reductions/segmented_reduction_tests.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cpp/tests/reductions/segmented_reduction_tests.cpp b/cpp/tests/reductions/segmented_reduction_tests.cpp index 72ba5b53ae7..47bcbb874cf 100644 --- a/cpp/tests/reductions/segmented_reduction_tests.cpp +++ b/cpp/tests/reductions/segmented_reduction_tests.cpp @@ -31,9 +31,11 @@ #define XXX 0 // null placeholder template -struct SegmentedReductionTest : public cudf::test::BaseFixture {}; +struct SegmentedReductionTest : public cudf::test::BaseFixture { +}; -struct SegmentedReductionTestUntyped : public cudf::test::BaseFixture {}; +struct SegmentedReductionTestUntyped : public cudf::test::BaseFixture { +}; TYPED_TEST_CASE(SegmentedReductionTest, cudf::test::NumericTypes); @@ -1076,7 +1078,8 @@ TEST_F(SegmentedReductionTestUntyped, EmptyInputWithOffsets) } template -struct SegmentedReductionFixedPointTest : public cudf::test::BaseFixture {}; +struct SegmentedReductionFixedPointTest : public cudf::test::BaseFixture { +}; TYPED_TEST_SUITE(SegmentedReductionFixedPointTest, cudf::test::FixedPointTypes);