Skip to content

Commit

Permalink
Throw when null structs are excluded
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed May 24, 2022
1 parent b76677c commit efd497e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cpp/src/groupby/hash/groupby.cu
Original file line number Diff line number Diff line change
Expand Up @@ -653,12 +653,12 @@ std::pair<std::unique_ptr<table>, std::vector<aggregation_result>> 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());
Expand Down
3 changes: 2 additions & 1 deletion cpp/tests/groupby/keys_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ TYPED_TEST(groupby_keys_test, structs)
auto expect_vals = FWCW<R>{6, 1, 8, 7};

auto agg = cudf::make_argmax_aggregation<groupby_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 <typename T>
Expand Down

0 comments on commit efd497e

Please sign in to comment.