From efd497e04dce165d15a2822dd8917c46af5f189b Mon Sep 17 00:00:00 2001 From: Yunsong Wang Date: Tue, 24 May 2022 17:02:13 -0400 Subject: [PATCH] Throw when null structs are excluded --- cpp/src/groupby/hash/groupby.cu | 8 ++++---- cpp/tests/groupby/keys_tests.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cpp/src/groupby/hash/groupby.cu b/cpp/src/groupby/hash/groupby.cu index 9fc3d641e9e..ab8d0089347 100644 --- a/cpp/src/groupby/hash/groupby.cu +++ b/cpp/src/groupby/hash/groupby.cu @@ -653,12 +653,12 @@ std::pair, std::vector> groupby( rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - auto const has_list_column = + auto const has_nested_column = std::any_of(keys.begin(), keys.end(), [](cudf::column_view const& col) { - return col.type().id() == type_id::LIST; + return cudf::is_nested(col.type()); }); - if (has_list_column and include_null_keys == cudf::null_policy::EXCLUDE) { - CUDF_FAIL("Null LIST keys cannot be excluded."); + if (has_nested_column and include_null_keys == cudf::null_policy::EXCLUDE) { + CUDF_FAIL("Null keys of nested type cannot be excluded."); } cudf::detail::result_cache cache(requests.size()); diff --git a/cpp/tests/groupby/keys_tests.cpp b/cpp/tests/groupby/keys_tests.cpp index fe1040acd63..19e82c4ffd1 100644 --- a/cpp/tests/groupby/keys_tests.cpp +++ b/cpp/tests/groupby/keys_tests.cpp @@ -294,7 +294,8 @@ TYPED_TEST(groupby_keys_test, structs) auto expect_vals = FWCW{6, 1, 8, 7}; auto agg = cudf::make_argmax_aggregation(); - test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)); + EXPECT_THROW(test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg)), + cudf::logic_error); } template