From ca48a52946203904da8170cdf723b3044a50bd3f Mon Sep 17 00:00:00 2001 From: David Wendt Date: Thu, 29 Feb 2024 14:30:17 -0500 Subject: [PATCH] Change strings_column_view::char_size to return int64 --- cpp/benchmarks/string/case.cpp | 4 +++- cpp/include/cudf/strings/strings_column_view.hpp | 2 +- cpp/src/strings/strings_column_view.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cpp/benchmarks/string/case.cpp b/cpp/benchmarks/string/case.cpp index 639a3dc1181..a7db972d39f 100644 --- a/cpp/benchmarks/string/case.cpp +++ b/cpp/benchmarks/string/case.cpp @@ -45,7 +45,9 @@ void bench_case(nvbench::state& state) cudf::type_id::INT8, distribution_id::UNIFORM, 32, 126); // nice ASCII range auto input = cudf::strings_column_view(col_view); auto ascii_column = create_random_column( - cudf::type_id::INT8, row_count{input.chars_size(cudf::get_default_stream())}, ascii_profile); + cudf::type_id::INT8, + row_count{static_cast(input.chars_size(cudf::get_default_stream()))}, + ascii_profile); auto ascii_data = ascii_column->view(); col_view = cudf::column_view(col_view.type(), diff --git a/cpp/include/cudf/strings/strings_column_view.hpp b/cpp/include/cudf/strings/strings_column_view.hpp index 840a2dd1165..036589e17fe 100644 --- a/cpp/include/cudf/strings/strings_column_view.hpp +++ b/cpp/include/cudf/strings/strings_column_view.hpp @@ -112,7 +112,7 @@ class strings_column_view : private column_view { * @param stream CUDA stream used for device memory operations and kernel launches * @return Number of bytes in the chars child column */ - [[nodiscard]] size_type chars_size(rmm::cuda_stream_view stream) const noexcept; + [[nodiscard]] int64_t chars_size(rmm::cuda_stream_view stream) const noexcept; /** * @brief Return an iterator for the chars child column. diff --git a/cpp/src/strings/strings_column_view.cpp b/cpp/src/strings/strings_column_view.cpp index 6be22d8e729..83ae916afc3 100644 --- a/cpp/src/strings/strings_column_view.cpp +++ b/cpp/src/strings/strings_column_view.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include #include #include @@ -45,10 +45,10 @@ strings_column_view::offset_iterator strings_column_view::offsets_end() const return offsets_begin() + size() + 1; } -size_type strings_column_view::chars_size(rmm::cuda_stream_view stream) const noexcept +int64_t strings_column_view::chars_size(rmm::cuda_stream_view stream) const noexcept { - if (size() == 0) return 0; - return detail::get_value(offsets(), offsets().size() - 1, stream); + if (size() == 0) { return 0L; } + return cudf::strings::detail::get_offset_value(offsets(), offsets().size() - 1, stream); } strings_column_view::chars_iterator strings_column_view::chars_begin(rmm::cuda_stream_view) const