Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a size overflow bug in hash groupby #16053

Merged
Merged
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
3 changes: 2 additions & 1 deletion cpp/src/groupby/hash/groupby.cu
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ std::unique_ptr<table> groupby(table_view const& keys,
rmm::cuda_stream_view stream,
rmm::device_async_resource_ref mr)
{
auto const num_keys = keys.num_rows();
// convert to int64_t to avoid potential overflow with large `keys`
auto const num_keys = static_cast<int64_t>(keys.num_rows());
auto const null_keys_are_equal = null_equality::EQUAL;
auto const has_null = nullate::DYNAMIC{cudf::has_nested_nulls(keys)};

Expand Down
3 changes: 2 additions & 1 deletion java/src/test/java/ai/rapids/cudf/TableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7838,11 +7838,12 @@ void testSumWithStrings() {
.build();
Table result = t.groupBy(0).aggregate(
GroupByAggregation.sum().onColumn(1));
Table sorted = result.orderBy(OrderByArg.asc(0));
Table expected = new Table.TestBuilder()
.column("1-URGENT", "3-MEDIUM")
.column(5289L + 5303L, 5203L + 5206L)
.build()) {
assertTablesAreEqual(expected, result);
assertTablesAreEqual(expected, sorted);
}
}

Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ def pipe(self, func, *args, **kwargs):
To get the difference between each groups maximum and minimum value
in one pass, you can do

>>> df.groupby('A').pipe(lambda x: x.max() - x.min())
>>> df.groupby('A', sort=True).pipe(lambda x: x.max() - x.min())
B
A
a 2
Expand Down
Loading