diff --git a/cpp/include/cudf/strings/detail/copy_if_else.cuh b/cpp/include/cudf/strings/detail/copy_if_else.cuh index bffcb5c1a31..6d9bd9af8da 100644 --- a/cpp/include/cudf/strings/detail/copy_if_else.cuh +++ b/cpp/include/cudf/strings/detail/copy_if_else.cuh @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -62,7 +61,7 @@ std::unique_ptr copy_if_else( rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { auto strings_count = std::distance(lhs_begin, lhs_end); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); // create null mask auto valid_mask = cudf::detail::valid_if( diff --git a/cpp/include/cudf/strings/detail/gather.cuh b/cpp/include/cudf/strings/detail/gather.cuh index dcd17245ee6..9215f1f5a0f 100644 --- a/cpp/include/cudf/strings/detail/gather.cuh +++ b/cpp/include/cudf/strings/detail/gather.cuh @@ -292,7 +292,7 @@ std::unique_ptr gather( { auto const output_count = std::distance(begin, end); auto const strings_count = strings.size(); - if (output_count == 0) return make_empty_strings_column(stream, mr); + if (output_count == 0) return make_empty_column(data_type{type_id::STRING}); // allocate offsets column and use memory to compute string size in each output row auto out_offsets_column = make_numeric_column( diff --git a/cpp/include/cudf/strings/detail/merge.cuh b/cpp/include/cudf/strings/detail/merge.cuh index 8d893a120dc..cd9790b1545 100644 --- a/cpp/include/cudf/strings/detail/merge.cuh +++ b/cpp/include/cudf/strings/detail/merge.cuh @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -54,7 +53,7 @@ std::unique_ptr merge(strings_column_view const& lhs, { using cudf::detail::side; size_type strings_count = static_cast(std::distance(begin, end)); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); auto lhs_column = column_device_view::create(lhs.parent(), stream); auto d_lhs = *lhs_column; diff --git a/cpp/include/cudf/strings/detail/scatter.cuh b/cpp/include/cudf/strings/detail/scatter.cuh index 342afae7336..0522ceace1a 100644 --- a/cpp/include/cudf/strings/detail/scatter.cuh +++ b/cpp/include/cudf/strings/detail/scatter.cuh @@ -61,7 +61,7 @@ std::unique_ptr scatter( rmm::cuda_stream_view stream = rmm::cuda_stream_default, rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { - if (target.is_empty()) return make_empty_strings_column(stream, mr); + if (target.is_empty()) return make_empty_column(data_type{type_id::STRING}); // create vector of string_view's to scatter into rmm::device_uvector target_vector = create_string_vector_from_column(target, stream); diff --git a/cpp/include/cudf/strings/detail/strings_column_factories.cuh b/cpp/include/cudf/strings/detail/strings_column_factories.cuh index 166deb6560d..7a6006a8292 100644 --- a/cpp/include/cudf/strings/detail/strings_column_factories.cuh +++ b/cpp/include/cudf/strings/detail/strings_column_factories.cuh @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -63,7 +62,7 @@ std::unique_ptr make_strings_column(IndexPairIterator begin, { CUDF_FUNC_RANGE(); size_type strings_count = thrust::distance(begin, end); - if (strings_count == 0) return strings::detail::make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); using string_index_pair = thrust::pair; @@ -167,7 +166,7 @@ std::unique_ptr make_strings_column(CharIterator chars_begin, CUDF_FUNC_RANGE(); size_type strings_count = thrust::distance(offsets_begin, offsets_end) - 1; size_type bytes = std::distance(chars_begin, chars_end) * sizeof(char); - if (strings_count == 0) return strings::detail::make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(null_count < strings_count, "null strings column not yet supported"); CUDF_EXPECTS(bytes >= 0, "invalid offsets data"); diff --git a/cpp/include/cudf/strings/detail/utilities.hpp b/cpp/include/cudf/strings/detail/utilities.hpp index 4eff3f2dafc..0cee185068e 100644 --- a/cpp/include/cudf/strings/detail/utilities.hpp +++ b/cpp/include/cudf/strings/detail/utilities.hpp @@ -41,17 +41,6 @@ std::unique_ptr create_chars_child_column( rmm::cuda_stream_view stream = rmm::cuda_stream_default, rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()); -/** - * @brief Create a strings column with no strings. - * - * @param stream CUDA stream used for device memory operations and kernel launches. - * @param mr Device memory resource used to allocate the returned column's device memory. - * @return Empty strings column - */ -std::unique_ptr make_empty_strings_column( - rmm::cuda_stream_view stream = rmm::cuda_stream_default, - rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()); - /** * @brief Creates a string_view vector from a strings column. * diff --git a/cpp/src/copying/copy.cpp b/cpp/src/copying/copy.cpp index 670c147aa7e..8cc5549b3c5 100644 --- a/cpp/src/copying/copy.cpp +++ b/cpp/src/copying/copy.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -59,15 +58,6 @@ struct scalar_empty_like_functor_impl { } }; -template <> -struct scalar_empty_like_functor_impl { - std::unique_ptr operator()(scalar const& input) - { - return cudf::strings::detail::make_empty_strings_column(rmm::cuda_stream_default, - rmm::mr::get_current_device_resource()); - } -}; - template <> struct scalar_empty_like_functor_impl { std::unique_ptr operator()(scalar const& input) diff --git a/cpp/src/interop/from_arrow.cu b/cpp/src/interop/from_arrow.cu index 9475d3136e5..ee80f06e861 100644 --- a/cpp/src/interop/from_arrow.cu +++ b/cpp/src/interop/from_arrow.cu @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -272,7 +271,7 @@ std::unique_ptr dispatch_to_cudf_column::operator()( rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (array.length() == 0) { return cudf::strings::detail::make_empty_strings_column(stream, mr); } + if (array.length() == 0) { return make_empty_column(data_type{type_id::STRING}); } auto str_array = static_cast(&array); auto offset_array = std::make_unique( str_array->value_offsets()->size() / sizeof(int32_t), str_array->value_offsets(), nullptr); diff --git a/cpp/src/io/utilities/column_buffer.cpp b/cpp/src/io/utilities/column_buffer.cpp index d60c7e4fad4..40a5d411290 100644 --- a/cpp/src/io/utilities/column_buffer.cpp +++ b/cpp/src/io/utilities/column_buffer.cpp @@ -21,7 +21,6 @@ #include "column_buffer.hpp" #include -#include namespace cudf { namespace io { @@ -191,8 +190,6 @@ std::unique_ptr empty_like(column_buffer& buffer, mr); } break; - case type_id::STRING: return cudf::strings::detail::make_empty_strings_column(stream, mr); - default: return cudf::make_empty_column(buffer.type); } } diff --git a/cpp/src/reshape/interleave_columns.cu b/cpp/src/reshape/interleave_columns.cu index 9024584a16b..9a6df2a664c 100644 --- a/cpp/src/reshape/interleave_columns.cu +++ b/cpp/src/reshape/interleave_columns.cu @@ -62,7 +62,7 @@ struct interleave_columns_functor { auto strings_count = strings_columns.num_rows(); if (strings_count == 0) // All columns have 0 rows - return strings::detail::make_empty_strings_column(stream, mr); + return make_empty_column(data_type{type_id::STRING}); // Create device views from the strings columns. auto table = table_device_view::create(strings_columns, stream); diff --git a/cpp/src/strings/capitalize.cu b/cpp/src/strings/capitalize.cu index b6526a5f52c..bbc420d5990 100644 --- a/cpp/src/strings/capitalize.cu +++ b/cpp/src/strings/capitalize.cu @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -172,7 +171,7 @@ std::unique_ptr capitalize(strings_column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (input.is_empty()) return detail::make_empty_strings_column(stream, mr); + if (input.is_empty()) return make_empty_column(data_type{type_id::STRING}); auto d_column = column_device_view::create(input.parent(), stream); return capitalize_utility(capitalize_fn{*d_column}, input, stream, mr); } @@ -181,7 +180,7 @@ std::unique_ptr title(strings_column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (input.is_empty()) return detail::make_empty_strings_column(stream, mr); + if (input.is_empty()) return make_empty_column(data_type{type_id::STRING}); auto d_column = column_device_view::create(input.parent(), stream); return capitalize_utility(title_fn{*d_column}, input, stream, mr); } diff --git a/cpp/src/strings/case.cu b/cpp/src/strings/case.cu index a7934e6641b..cc0edb49a33 100644 --- a/cpp/src/strings/case.cu +++ b/cpp/src/strings/case.cu @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -126,7 +125,7 @@ std::unique_ptr convert_case(strings_column_view const& strings, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (strings.is_empty()) return detail::make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); auto strings_column = column_device_view::create(strings.parent(), stream); auto d_column = *strings_column; diff --git a/cpp/src/strings/combine/concatenate.cu b/cpp/src/strings/combine/concatenate.cu index 1329ad3113f..b2db61942d2 100644 --- a/cpp/src/strings/combine/concatenate.cu +++ b/cpp/src/strings/combine/concatenate.cu @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -130,7 +129,7 @@ std::unique_ptr concatenate(table_view const& strings_columns, "All columns must be of type string"); auto const strings_count = strings_columns.num_rows(); if (strings_count == 0) // empty begets empty - return detail::make_empty_strings_column(stream, mr); + return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(separator.is_valid(), "Parameter separator must be a valid string_scalar"); string_view d_separator(separator.data(), separator.size()); @@ -222,7 +221,7 @@ std::unique_ptr concatenate(table_view const& strings_columns, CUDF_EXPECTS(strings_count == separators.size(), "Separators column should be the same size as the strings columns"); if (strings_count == 0) // Empty begets empty - return detail::make_empty_strings_column(stream, mr); + return make_empty_column(data_type{type_id::STRING}); // Invalid output column strings - null rows string_view const invalid_str{nullptr, 0}; diff --git a/cpp/src/strings/combine/join.cu b/cpp/src/strings/combine/join.cu index cdfaf856513..ffe95118f19 100644 --- a/cpp/src/strings/combine/join.cu +++ b/cpp/src/strings/combine/join.cu @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -44,7 +43,7 @@ std::unique_ptr join_strings(strings_column_view const& strings, rmm::mr::device_memory_resource* mr) { auto strings_count = strings.size(); - if (strings_count == 0) return detail::make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(separator.is_valid(), "Parameter separator must be a valid string_scalar"); diff --git a/cpp/src/strings/combine/join_list_elements.cu b/cpp/src/strings/combine/join_list_elements.cu index 7edb0cd8e7b..c012663794b 100644 --- a/cpp/src/strings/combine/join_list_elements.cu +++ b/cpp/src/strings/combine/join_list_elements.cu @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -160,7 +159,7 @@ std::unique_ptr join_list_elements(lists_column_view const& lists_string CUDF_EXPECTS(separator.is_valid(), "Parameter separator must be a valid string_scalar"); auto const num_rows = lists_strings_column.size(); - if (num_rows == 0) { return detail::make_empty_strings_column(stream, mr); } + if (num_rows == 0) { return make_empty_column(data_type{type_id::STRING}); } // Accessing the child strings column of the lists column must be done by calling `child()` on the // lists column, not `get_sliced_child()`. This is because calling to `offsets_begin()` on the @@ -233,7 +232,7 @@ std::unique_ptr join_list_elements(lists_column_view const& lists_string "Separators column should be the same size as the lists columns"); auto const num_rows = lists_strings_column.size(); - if (num_rows == 0) { return detail::make_empty_strings_column(stream, mr); } + if (num_rows == 0) { return make_empty_column(data_type{type_id::STRING}); } // Accessing the child strings column of the lists column must be done by calling `child()` on the // lists column, not `get_sliced_child()`. This is because calling to `offsets_begin()` on the diff --git a/cpp/src/strings/convert/convert_booleans.cu b/cpp/src/strings/convert/convert_booleans.cu index b0543366a8e..c69bb39bdae 100644 --- a/cpp/src/strings/convert/convert_booleans.cu +++ b/cpp/src/strings/convert/convert_booleans.cu @@ -96,7 +96,7 @@ std::unique_ptr from_booleans(column_view const& booleans, rmm::mr::device_memory_resource* mr) { size_type strings_count = booleans.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(booleans.type().id() == type_id::BOOL8, "Input column must be boolean type"); CUDF_EXPECTS(true_string.is_valid() && true_string.size() > 0, diff --git a/cpp/src/strings/convert/convert_datetime.cu b/cpp/src/strings/convert/convert_datetime.cu index 637a612472b..379ceceaf17 100644 --- a/cpp/src/strings/convert/convert_datetime.cu +++ b/cpp/src/strings/convert/convert_datetime.cu @@ -933,7 +933,7 @@ std::unique_ptr from_timestamps(column_view const& timestamps, rmm::mr::device_memory_resource* mr) { size_type strings_count = timestamps.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(!format.empty(), "Format parameter must not be empty."); timestamp_units units = diff --git a/cpp/src/strings/convert/convert_durations.cu b/cpp/src/strings/convert/convert_durations.cu index 325fa428cc6..6923f8a24fd 100644 --- a/cpp/src/strings/convert/convert_durations.cu +++ b/cpp/src/strings/convert/convert_durations.cu @@ -705,7 +705,7 @@ std::unique_ptr from_durations(column_view const& durations, rmm::mr::device_memory_resource* mr) { size_type strings_count = durations.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); return type_dispatcher( durations.type(), dispatch_from_durations_fn{}, durations, format, stream, mr); diff --git a/cpp/src/strings/convert/convert_fixed_point.cu b/cpp/src/strings/convert/convert_fixed_point.cu index 5674f546c8c..3b2616ebc4f 100644 --- a/cpp/src/strings/convert/convert_fixed_point.cu +++ b/cpp/src/strings/convert/convert_fixed_point.cu @@ -427,7 +427,7 @@ std::unique_ptr from_fixed_point(column_view const& input, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (input.is_empty()) return detail::make_empty_strings_column(stream, mr); + if (input.is_empty()) return make_empty_column(data_type{type_id::STRING}); return type_dispatcher(input.type(), dispatch_from_fixed_point_fn{}, input, stream, mr); } diff --git a/cpp/src/strings/convert/convert_floats.cu b/cpp/src/strings/convert/convert_floats.cu index 0cdbea1d4ef..05142e7e5f2 100644 --- a/cpp/src/strings/convert/convert_floats.cu +++ b/cpp/src/strings/convert/convert_floats.cu @@ -527,7 +527,7 @@ std::unique_ptr from_floats(column_view const& floats, rmm::mr::device_memory_resource* mr) { size_type strings_count = floats.size(); - if (strings_count == 0) return detail::make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); return type_dispatcher(floats.type(), dispatch_from_floats_fn{}, floats, stream, mr); } diff --git a/cpp/src/strings/convert/convert_integers.cu b/cpp/src/strings/convert/convert_integers.cu index 575058eae09..01da56d7254 100644 --- a/cpp/src/strings/convert/convert_integers.cu +++ b/cpp/src/strings/convert/convert_integers.cu @@ -392,7 +392,7 @@ std::unique_ptr from_integers(column_view const& integers, rmm::mr::device_memory_resource* mr) { size_type strings_count = integers.size(); - if (strings_count == 0) return detail::make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); return type_dispatcher(integers.type(), dispatch_from_integers_fn{}, integers, stream, mr); } diff --git a/cpp/src/strings/convert/convert_ipv4.cu b/cpp/src/strings/convert/convert_ipv4.cu index 016b9befe5c..2984069ea23 100644 --- a/cpp/src/strings/convert/convert_ipv4.cu +++ b/cpp/src/strings/convert/convert_ipv4.cu @@ -163,7 +163,7 @@ std::unique_ptr integers_to_ipv4( rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { size_type strings_count = integers.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(integers.type().id() == type_id::INT64, "Input column must be type_id::INT64 type"); diff --git a/cpp/src/strings/convert/convert_urls.cu b/cpp/src/strings/convert/convert_urls.cu index 3be81dbd005..ce145e8a413 100644 --- a/cpp/src/strings/convert/convert_urls.cu +++ b/cpp/src/strings/convert/convert_urls.cu @@ -126,7 +126,7 @@ std::unique_ptr url_encode( rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { size_type strings_count = strings.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); auto strings_column = column_device_view::create(strings.parent(), stream); auto d_strings = *strings_column; @@ -326,7 +326,7 @@ std::unique_ptr url_decode( rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { size_type strings_count = strings.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); auto offset_count = strings_count + 1; auto d_offsets = strings.offsets().data() + strings.offset(); diff --git a/cpp/src/strings/copying/concatenate.cu b/cpp/src/strings/copying/concatenate.cu index 48358cb4a38..2c7d6ebb483 100644 --- a/cpp/src/strings/copying/concatenate.cu +++ b/cpp/src/strings/copying/concatenate.cu @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -217,7 +216,7 @@ std::unique_ptr concatenate(host_span columns, auto const total_bytes = std::get<5>(device_views); auto const offsets_count = strings_count + 1; - if (strings_count == 0) { return make_empty_strings_column(stream, mr); } + if (strings_count == 0) { return make_empty_column(data_type{type_id::STRING}); } CUDF_EXPECTS(offsets_count <= static_cast(std::numeric_limits::max()), "total number of strings is too large for cudf column"); diff --git a/cpp/src/strings/copying/copying.cu b/cpp/src/strings/copying/copying.cu index cdf188bfdc5..a6b1d227f74 100644 --- a/cpp/src/strings/copying/copying.cu +++ b/cpp/src/strings/copying/copying.cu @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -35,7 +34,7 @@ std::unique_ptr copy_slice(strings_column_view const& strings, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (strings.is_empty()) return make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); if (end < 0 || end > strings.size()) end = strings.size(); CUDF_EXPECTS(((start >= 0) && (start < end)), "Invalid start parameter value."); auto const strings_count = end - start; diff --git a/cpp/src/strings/filling/fill.cu b/cpp/src/strings/filling/fill.cu index 996fdf9997b..25e9f7a2412 100644 --- a/cpp/src/strings/filling/fill.cu +++ b/cpp/src/strings/filling/fill.cu @@ -40,7 +40,7 @@ std::unique_ptr fill( rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { auto strings_count = strings.size(); - if (strings_count == 0) return detail::make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS((begin >= 0) && (end <= strings_count), "Parameters [begin,end) are outside the range of the provided strings column"); CUDF_EXPECTS(begin <= end, "Parameters [begin,end) have invalid range values"); diff --git a/cpp/src/strings/filter_chars.cu b/cpp/src/strings/filter_chars.cu index 8c8a2ab05b1..be0715c97df 100644 --- a/cpp/src/strings/filter_chars.cu +++ b/cpp/src/strings/filter_chars.cu @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -116,7 +115,7 @@ std::unique_ptr filter_characters( rmm::mr::device_memory_resource* mr) { size_type strings_count = strings.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(replacement.is_valid(), "Parameter replacement must be valid"); cudf::string_view d_replacement(replacement.data(), replacement.size()); diff --git a/cpp/src/strings/padding.cu b/cpp/src/strings/padding.cu index 22bbb7e7a4a..bce2ee52c1c 100644 --- a/cpp/src/strings/padding.cu +++ b/cpp/src/strings/padding.cu @@ -61,7 +61,7 @@ std::unique_ptr pad( rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { size_type strings_count = strings.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(!fill_char.empty(), "fill_char parameter must not be empty"); char_utf8 d_fill_char = 0; size_type fill_char_size = to_char_utf8(fill_char.c_str(), d_fill_char); @@ -151,7 +151,7 @@ std::unique_ptr zfill( rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { size_type strings_count = strings.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); auto strings_column = column_device_view::create(strings.parent(), stream); auto d_strings = *strings_column; diff --git a/cpp/src/strings/replace/backref_re.cu b/cpp/src/strings/replace/backref_re.cu index 07d5fefc264..2de5141bb00 100644 --- a/cpp/src/strings/replace/backref_re.cu +++ b/cpp/src/strings/replace/backref_re.cu @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -87,7 +86,7 @@ std::unique_ptr replace_with_backrefs( rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { - if (strings.is_empty()) return make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(!pattern.empty(), "Parameter pattern must not be empty"); CUDF_EXPECTS(!repl.empty(), "Parameter repl must not be empty"); diff --git a/cpp/src/strings/replace/multi_re.cu b/cpp/src/strings/replace/multi_re.cu index a59401db24f..12bf0810a64 100644 --- a/cpp/src/strings/replace/multi_re.cu +++ b/cpp/src/strings/replace/multi_re.cu @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -135,7 +134,7 @@ std::unique_ptr replace_re( rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { auto strings_count = strings.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); if (patterns.empty()) // no patterns; just return a copy return std::make_unique(strings.parent(), stream, mr); diff --git a/cpp/src/strings/replace/replace.cu b/cpp/src/strings/replace/replace.cu index 31c6460267c..02e861433a9 100644 --- a/cpp/src/strings/replace/replace.cu +++ b/cpp/src/strings/replace/replace.cu @@ -551,7 +551,7 @@ std::unique_ptr replace(strings_column_view con rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (strings.is_empty()) return make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); if (maxrepl == 0) return std::make_unique(strings.parent(), stream, mr); CUDF_EXPECTS(repl.is_valid(), "Parameter repl must be valid."); CUDF_EXPECTS(target.is_valid(), "Parameter target must be valid."); @@ -590,7 +590,7 @@ std::unique_ptr replace( rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (strings.is_empty()) return make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); if (maxrepl == 0) return std::make_unique(strings.parent(), stream, mr); CUDF_EXPECTS(repl.is_valid(), "Parameter repl must be valid."); CUDF_EXPECTS(target.is_valid(), "Parameter target must be valid."); @@ -623,7 +623,7 @@ std::unique_ptr replace( rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (strings.is_empty()) return make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); if (maxrepl == 0) return std::make_unique(strings.parent(), stream, mr); CUDF_EXPECTS(repl.is_valid(), "Parameter repl must be valid."); CUDF_EXPECTS(target.is_valid(), "Parameter target must be valid."); @@ -683,7 +683,7 @@ std::unique_ptr replace_slice(strings_column_view const& strings, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (strings.is_empty()) return make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(repl.is_valid(), "Parameter repl must be valid."); if (stop > 0) CUDF_EXPECTS(start <= stop, "Parameter start must be less than or equal to stop."); @@ -767,7 +767,7 @@ std::unique_ptr replace(strings_column_view const& strings, rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { - if (strings.is_empty()) return make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(((targets.size() > 0) && (targets.null_count() == 0)), "Parameters targets must not be empty and must not have nulls"); CUDF_EXPECTS(((repls.size() > 0) && (repls.null_count() == 0)), @@ -798,7 +798,7 @@ std::unique_ptr replace_nulls(strings_column_view const& strings, rmm::mr::device_memory_resource* mr) { size_type strings_count = strings.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(repl.is_valid(), "Parameter repl must be valid."); string_view d_repl(repl.data(), repl.size()); diff --git a/cpp/src/strings/replace/replace_re.cu b/cpp/src/strings/replace/replace_re.cu index 9468e80fa1c..9781a3fe7c6 100644 --- a/cpp/src/strings/replace/replace_re.cu +++ b/cpp/src/strings/replace/replace_re.cu @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -109,7 +108,7 @@ std::unique_ptr replace_re( rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { auto strings_count = strings.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(repl.is_valid(), "Parameter repl must be valid"); string_view d_repl(repl.data(), repl.size()); diff --git a/cpp/src/strings/split/split.cu b/cpp/src/strings/split/split.cu index be6ace5e1fe..5194bc6e86a 100644 --- a/cpp/src/strings/split/split.cu +++ b/cpp/src/strings/split/split.cu @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -432,7 +431,7 @@ std::unique_ptr split_fn(strings_column_view const& strings_column, std::vector> results; auto const strings_count = strings_column.size(); if (strings_count == 0) { - results.push_back(make_empty_strings_column(stream, mr)); + results.push_back(make_empty_column(data_type{type_id::STRING})); return std::make_unique
(std::move(results)); } diff --git a/cpp/src/strings/strip.cu b/cpp/src/strings/strip.cu index 95d8eae36d4..8eb56918071 100644 --- a/cpp/src/strings/strip.cu +++ b/cpp/src/strings/strip.cu @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -101,7 +100,7 @@ std::unique_ptr strip( rmm::cuda_stream_view stream = rmm::cuda_stream_default, rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { - if (strings.is_empty()) return detail::make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(to_strip.is_valid(), "Parameter to_strip must be valid"); string_view const d_to_strip(to_strip.data(), to_strip.size()); diff --git a/cpp/src/strings/substring.cu b/cpp/src/strings/substring.cu index 3e7c1181a25..a74f6638a61 100644 --- a/cpp/src/strings/substring.cu +++ b/cpp/src/strings/substring.cu @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -110,7 +109,7 @@ std::unique_ptr slice_strings( rmm::cuda_stream_view stream = rmm::cuda_stream_default, rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { - if (strings.is_empty()) return make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); if (step.is_valid()) CUDF_EXPECTS(step.value(stream) != 0, "Step parameter must not be 0"); @@ -300,7 +299,7 @@ std::unique_ptr slice_strings( rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { size_type strings_count = strings.size(); - if (strings_count == 0) return make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); CUDF_EXPECTS(starts_column.size() == strings_count, "Parameter starts must have the same number of rows as strings."); CUDF_EXPECTS(stops_column.size() == strings_count, diff --git a/cpp/src/strings/translate.cu b/cpp/src/strings/translate.cu index 30fc7d50b3f..cbb2f85c6a6 100644 --- a/cpp/src/strings/translate.cu +++ b/cpp/src/strings/translate.cu @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -88,7 +87,7 @@ std::unique_ptr translate( rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()) { - if (strings.is_empty()) return make_empty_strings_column(stream, mr); + if (strings.is_empty()) return make_empty_column(data_type{type_id::STRING}); size_type table_size = static_cast(chars_table.size()); // convert input table diff --git a/cpp/src/strings/utilities.cu b/cpp/src/strings/utilities.cu index 1b7141ccb18..3326bcab82f 100644 --- a/cpp/src/strings/utilities.cu +++ b/cpp/src/strings/utilities.cu @@ -109,17 +109,6 @@ std::unique_ptr create_chars_child_column(cudf::size_type strings_count, data_type{type_id::INT8}, total_bytes, mask_state::UNALLOCATED, stream, mr); } -// -std::unique_ptr make_empty_strings_column(rmm::cuda_stream_view stream, - rmm::mr::device_memory_resource* mr) -{ - return std::make_unique(data_type{type_id::STRING}, - 0, - rmm::device_buffer{0, stream, mr}, // data - rmm::device_buffer{0, stream, mr}, - 0); // nulls -} - namespace { // The device variables are created here to avoid using a singleton that may cause issues // with RMM initialize/finalize. See PR #3159 for details on this approach. diff --git a/cpp/src/strings/wrap.cu b/cpp/src/strings/wrap.cu index f21477b3582..a9346566e78 100644 --- a/cpp/src/strings/wrap.cu +++ b/cpp/src/strings/wrap.cu @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -99,7 +98,7 @@ std::unique_ptr wrap( CUDF_EXPECTS(width > 0, "Positive wrap width required"); auto strings_count = strings.size(); - if (strings_count == 0) return detail::make_empty_strings_column(stream, mr); + if (strings_count == 0) return make_empty_column(data_type{type_id::STRING}); auto strings_column = column_device_view::create(strings.parent(), stream); auto d_column = *strings_column; diff --git a/cpp/tests/copying/pack_tests.cu b/cpp/tests/copying/pack_tests.cu index 84cf176061d..f3b9cf25357 100644 --- a/cpp/tests/copying/pack_tests.cu +++ b/cpp/tests/copying/pack_tests.cu @@ -15,7 +15,6 @@ */ #include -#include #include #include #include @@ -84,7 +83,7 @@ TEST_F(PackUnpackTest, MultiColumnWithStrings) TEST_F(PackUnpackTest, EmptyColumns) { { - auto empty_string = cudf::strings::detail::make_empty_strings_column(); + auto empty_string = cudf::make_empty_column(cudf::data_type{cudf::type_id::STRING}); cudf::table_view src_table({static_cast(*empty_string)}); this->run_test(src_table); } @@ -356,7 +355,7 @@ TEST_F(PackUnpackTest, NestedEmpty) // this produces an empty strings column with no children, // nested inside a list { - auto empty_string = cudf::strings::detail::make_empty_strings_column(); + auto empty_string = cudf::make_empty_column(cudf::data_type{cudf::type_id::STRING}); auto offsets = cudf::test::fixed_width_column_wrapper({0, 0}); auto list = cudf::make_lists_column( 1, offsets.release(), std::move(empty_string), 0, rmm::device_buffer{}); diff --git a/cpp/tests/copying/split_tests.cpp b/cpp/tests/copying/split_tests.cpp index d4e5a53aa85..c0c1ff727c6 100644 --- a/cpp/tests/copying/split_tests.cpp +++ b/cpp/tests/copying/split_tests.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -1546,7 +1545,7 @@ TEST_F(ContiguousSplitTableCornerCases, NestedEmpty) // this produces an empty strings column with no children, // nested inside a list { - auto empty_string = cudf::strings::detail::make_empty_strings_column(); + auto empty_string = cudf::make_empty_column(cudf::data_type{cudf::type_id::STRING}); auto offsets = cudf::test::fixed_width_column_wrapper({0, 0}); auto list = cudf::make_lists_column( 1, offsets.release(), std::move(empty_string), 0, rmm::device_buffer{});