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

Add exception when trying to create large strings with cudf::test::strings_column_wrapper #16049

Merged
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
7 changes: 6 additions & 1 deletion cpp/include/cudf_test/column_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,12 @@ auto make_chars_and_offsets(StringsIterator begin, StringsIterator end, Validity
for (auto str = begin; str < end; ++str) {
std::string tmp = (*v++) ? std::string(*str) : std::string{};
chars.insert(chars.end(), std::cbegin(tmp), std::cend(tmp));
offsets.push_back(offsets.back() + tmp.length());
auto const last_offset = static_cast<std::size_t>(offsets.back());
auto const next_offset = last_offset + tmp.length();
CUDF_EXPECTS(
next_offset < static_cast<std::size_t>(std::numeric_limits<cudf::size_type>::max()),
"Cannot use strings_column_wrapper to build a large strings column");
offsets.push_back(static_cast<cudf::size_type>(next_offset));
}
return std::pair(std::move(chars), std::move(offsets));
};
Expand Down
Loading