Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 33 additions & 27 deletions cpp/tests/groupby/argmax_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -33,10 +33,11 @@ TYPED_TEST(groupby_argmax_test, basic)
cudf::test::fixed_width_column_wrapper<R> expect_vals{0, 1, 2};

auto agg = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

TYPED_TEST(groupby_argmax_test, zero_valid_keys)
Expand All @@ -53,10 +54,11 @@ TYPED_TEST(groupby_argmax_test, zero_valid_keys)
cudf::test::fixed_width_column_wrapper<R> expect_vals{};

auto agg = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

TYPED_TEST(groupby_argmax_test, zero_valid_values)
Expand All @@ -73,10 +75,11 @@ TYPED_TEST(groupby_argmax_test, zero_valid_values)
cudf::test::fixed_width_column_wrapper<R> expect_vals({0}, cudf::test::iterators::all_nulls());

auto agg = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

TYPED_TEST(groupby_argmax_test, null_keys_and_values)
Expand All @@ -99,10 +102,11 @@ TYPED_TEST(groupby_argmax_test, null_keys_and_values)
cudf::test::fixed_width_column_wrapper<R> expect_vals({3, 4, 7, 0}, {1, 1, 1, 0});

auto agg = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

struct groupby_argmax_string_test : public cudf::test::BaseFixture {};
Expand All @@ -119,10 +123,11 @@ TEST_F(groupby_argmax_string_test, basic)
cudf::test::fixed_width_column_wrapper<R> expect_vals({0, 4, 2});

auto agg = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

TEST_F(groupby_argmax_string_test, zero_valid_values)
Expand All @@ -136,10 +141,11 @@ TEST_F(groupby_argmax_string_test, zero_valid_values)
cudf::test::fixed_width_column_wrapper<R> expect_vals({0}, cudf::test::iterators::all_nulls());

auto agg = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

struct groupby_dictionary_argmax_test : public cudf::test::BaseFixture {};
Expand All @@ -156,17 +162,17 @@ TEST_F(groupby_dictionary_argmax_test, basic)
cudf::test::fixed_width_column_wrapper<R> expect_vals({ 0, 4, 2 });
// clang-format on

test_single_agg(keys,
vals,
expect_keys,
expect_vals,
cudf::make_argmax_aggregation<cudf::groupby_aggregation>());
test_single_agg(keys,
vals,
expect_keys,
expect_vals,
cudf::make_argmax_aggregation<cudf::groupby_aggregation>(),
force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(keys,
vals,
expect_keys,
expect_vals,
cudf::make_argmax_aggregation<cudf::groupby_aggregation>());
CUDF_TEST_SINGLE_AGG(keys,
vals,
expect_keys,
expect_vals,
cudf::make_argmax_aggregation<cudf::groupby_aggregation>(),
force_use_sort_impl::YES);
}

struct groupby_argmax_struct_test : public cudf::test::BaseFixture {};
Expand All @@ -185,7 +191,7 @@ TEST_F(groupby_argmax_struct_test, basic)
auto const expect_indices = cudf::test::fixed_width_column_wrapper<int32_t>{0, 4, 2};

auto agg = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg));
}

TEST_F(groupby_argmax_struct_test, slice_input)
Expand Down Expand Up @@ -218,7 +224,7 @@ TEST_F(groupby_argmax_struct_test, slice_input)
auto const expect_indices = cudf::test::fixed_width_column_wrapper<int32_t>{0, 4, 2};

auto agg = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg));
}

TEST_F(groupby_argmax_struct_test, null_keys_and_values)
Expand All @@ -241,7 +247,7 @@ TEST_F(groupby_argmax_struct_test, null_keys_and_values)
{0, 4, 2, null}, cudf::test::iterators::null_at(3)};

auto agg = cudf::make_argmax_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg));
}

CUDF_TEST_PROGRAM_MAIN()
60 changes: 33 additions & 27 deletions cpp/tests/groupby/argmin_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -34,10 +34,11 @@ TYPED_TEST(groupby_argmin_test, basic)
cudf::test::fixed_width_column_wrapper<R> expect_vals{6, 9, 8};

auto agg = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

TYPED_TEST(groupby_argmin_test, zero_valid_keys)
Expand All @@ -54,10 +55,11 @@ TYPED_TEST(groupby_argmin_test, zero_valid_keys)
cudf::test::fixed_width_column_wrapper<R> expect_vals{};

auto agg = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

TYPED_TEST(groupby_argmin_test, zero_valid_values)
Expand All @@ -74,10 +76,11 @@ TYPED_TEST(groupby_argmin_test, zero_valid_values)
cudf::test::fixed_width_column_wrapper<R> expect_vals({0}, all_nulls());

auto agg = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

TYPED_TEST(groupby_argmin_test, null_keys_and_values)
Expand All @@ -99,11 +102,12 @@ TYPED_TEST(groupby_argmin_test, null_keys_and_values)
cudf::test::fixed_width_column_wrapper<R> expect_vals({3, 9, 8, 0}, {1, 1, 1, 0});

auto agg = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

// TODO: explore making this a gtest parameter
auto agg2 = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

struct groupby_argmin_string_test : public cudf::test::BaseFixture {};
Expand All @@ -120,10 +124,11 @@ TEST_F(groupby_argmin_string_test, basic)
cudf::test::fixed_width_column_wrapper<R> expect_vals({3, 5, 7});

auto agg = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

TEST_F(groupby_argmin_string_test, zero_valid_values)
Expand All @@ -137,10 +142,11 @@ TEST_F(groupby_argmin_string_test, zero_valid_values)
cudf::test::fixed_width_column_wrapper<R> expect_vals({0}, all_nulls());

auto agg = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_vals, std::move(agg));

auto agg2 = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(
keys, vals, expect_keys, expect_vals, std::move(agg2), force_use_sort_impl::YES);
}

struct groupby_dictionary_argmin_test : public cudf::test::BaseFixture {};
Expand All @@ -157,17 +163,17 @@ TEST_F(groupby_dictionary_argmin_test, basic)
cudf::test::fixed_width_column_wrapper<R> expect_vals({ 3, 5, 7 });
// clang-format on

test_single_agg(keys,
vals,
expect_keys,
expect_vals,
cudf::make_argmin_aggregation<cudf::groupby_aggregation>());
test_single_agg(keys,
vals,
expect_keys,
expect_vals,
cudf::make_argmin_aggregation<cudf::groupby_aggregation>(),
force_use_sort_impl::YES);
CUDF_TEST_SINGLE_AGG(keys,
vals,
expect_keys,
expect_vals,
cudf::make_argmin_aggregation<cudf::groupby_aggregation>());
CUDF_TEST_SINGLE_AGG(keys,
vals,
expect_keys,
expect_vals,
cudf::make_argmin_aggregation<cudf::groupby_aggregation>(),
force_use_sort_impl::YES);
}

struct groupby_argmin_struct_test : public cudf::test::BaseFixture {};
Expand All @@ -186,7 +192,7 @@ TEST_F(groupby_argmin_struct_test, basic)
auto const expect_indices = cudf::test::fixed_width_column_wrapper<int32_t>{3, 5, 7};

auto agg = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg));
}

TEST_F(groupby_argmin_struct_test, slice_input)
Expand Down Expand Up @@ -219,7 +225,7 @@ TEST_F(groupby_argmin_struct_test, slice_input)
auto const expect_indices = cudf::test::fixed_width_column_wrapper<int32_t>{3, 5, 7};

auto agg = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg));
}

TEST_F(groupby_argmin_struct_test, null_keys_and_values)
Expand All @@ -241,5 +247,5 @@ TEST_F(groupby_argmin_struct_test, null_keys_and_values)
cudf::test::fixed_width_column_wrapper<int32_t>{{3, 1, 8, null}, null_at(3)};

auto agg = cudf::make_argmin_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_indices, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, vals, expect_keys, expect_indices, std::move(agg));
}
28 changes: 14 additions & 14 deletions cpp/tests/groupby/collect_list_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -29,7 +29,7 @@ TYPED_TEST(groupby_collect_list_test, CollectWithoutNulls)
cudf::test::lists_column_wrapper<V, int32_t> expect_vals{{1, 2, 3}, {4, 5, 6}};

auto agg = cudf::make_collect_list_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg));
}

TYPED_TEST(groupby_collect_list_test, CollectWithNulls)
Expand All @@ -48,7 +48,7 @@ TYPED_TEST(groupby_collect_list_test, CollectWithNulls)
{{1, 2}, validity.begin()}, {{3, 4}, validity.begin()}, {{5, 6}, validity.begin()}};

auto agg = cudf::make_collect_list_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg));
}

TYPED_TEST(groupby_collect_list_test, CollectWithNullExclusion)
Expand All @@ -67,7 +67,7 @@ TYPED_TEST(groupby_collect_list_test, CollectWithNullExclusion)

auto agg =
cudf::make_collect_list_aggregation<cudf::groupby_aggregation>(cudf::null_policy::EXCLUDE);
test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg));
}

TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInput)
Expand All @@ -83,7 +83,7 @@ TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInput)

auto agg =
cudf::make_collect_list_aggregation<cudf::groupby_aggregation>(cudf::null_policy::EXCLUDE);
test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg));
}

TYPED_TEST(groupby_collect_list_test, CollectLists)
Expand All @@ -103,7 +103,7 @@ TYPED_TEST(groupby_collect_list_test, CollectLists)
{{1, 2}, {3, 4}}, {{5, 6, 7}, LCW{}}, {{9, 10}, {11}}};

auto agg = cudf::make_collect_list_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg));
}

TYPED_TEST(groupby_collect_list_test, CollectListsWithNullExclusion)
Expand All @@ -124,7 +124,7 @@ TYPED_TEST(groupby_collect_list_test, CollectListsWithNullExclusion)

auto agg =
cudf::make_collect_list_aggregation<cudf::groupby_aggregation>(cudf::null_policy::EXCLUDE);
test_single_agg(keys, values, expect_keys, expect_vals, std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, values, expect_keys, expect_vals, std::move(agg));
}

TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputLists)
Expand All @@ -148,7 +148,7 @@ TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputLists)
cudf::make_lists_column(0, cudf::make_empty_column(offsets), std::move(expect_child), 0, {});

auto agg = cudf::make_collect_list_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, values->view(), expect_keys, expect_values->view(), std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, values->view(), expect_keys, expect_values->view(), std::move(agg));
}

TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputListsOfStructs)
Expand Down Expand Up @@ -188,7 +188,7 @@ TYPED_TEST(groupby_collect_list_test, CollectOnEmptyInputListsOfStructs)
{});

auto agg = cudf::make_collect_list_aggregation<cudf::groupby_aggregation>();
test_single_agg(keys, values->view(), expect_keys, expect_values->view(), std::move(agg));
CUDF_TEST_SINGLE_AGG(keys, values->view(), expect_keys, expect_values->view(), std::move(agg));
}

TYPED_TEST(groupby_collect_list_test, dictionary)
Expand All @@ -209,9 +209,9 @@ TYPED_TEST(groupby_collect_list_test, dictionary)
0,
rmm::device_buffer{});

test_single_agg(keys,
vals,
expect_keys,
expect_vals->view(),
cudf::make_collect_list_aggregation<cudf::groupby_aggregation>());
CUDF_TEST_SINGLE_AGG(keys,
vals,
expect_keys,
expect_vals->view(),
cudf::make_collect_list_aggregation<cudf::groupby_aggregation>());
}
Loading