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 overflow check in cudf::merge #14345

Merged
merged 2 commits into from
Oct 31, 2023
Merged
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
15 changes: 8 additions & 7 deletions cpp/src/merge/merge.cu
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,14 @@ table_ptr_type merge(std::vector<table_view> const& tables_to_merge,

CUDF_EXPECTS(key_cols.size() == column_order.size(),
"Mismatched size between key_cols and column_order");
CUDF_EXPECTS(std::accumulate(tables_to_merge.cbegin(),
tables_to_merge.cend(),
cudf::size_type{0},
[](auto const& running_sum, auto const& tbl) {
return running_sum + tbl.num_rows();
}) <= std::numeric_limits<cudf::size_type>::max(),
"Total number of merged rows exceeds row limit");
CUDF_EXPECTS(
std::accumulate(tables_to_merge.cbegin(),
tables_to_merge.cend(),
std::size_t{0},
[](auto const& running_sum, auto const& tbl) {
return running_sum + static_cast<std::size_t>(tbl.num_rows());
}) <= static_cast<std::size_t>(std::numeric_limits<cudf::size_type>::max()),
"Total number of merged rows exceeds row limit");

// This utility will ensure all corresponding dictionary columns have matching keys.
// It will return any new dictionary columns created as well as updated table_views.
Expand Down