strings/combine.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2024, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include <cudf/column/column.hpp>
20 #include <cudf/scalar/scalar.hpp>
24 
25 namespace CUDF_EXPORT cudf {
26 namespace strings {
38 enum class separator_on_nulls {
39  YES,
40  NO
41 };
42 
48  EMPTY_STRING,
50 };
51 
77 std::unique_ptr<column> join_strings(
78  strings_column_view const& input,
79  string_scalar const& separator = string_scalar(""),
80  string_scalar const& narep = string_scalar("", false),
83 
143 std::unique_ptr<column> concatenate(
144  table_view const& strings_columns,
145  strings_column_view const& separators,
146  string_scalar const& separator_narep = string_scalar("", false),
147  string_scalar const& col_narep = string_scalar("", false),
148  separator_on_nulls separate_nulls = separator_on_nulls::YES,
151 
199 std::unique_ptr<column> concatenate(
200  table_view const& strings_columns,
201  string_scalar const& separator = string_scalar(""),
202  string_scalar const& narep = string_scalar("", false),
203  separator_on_nulls separate_nulls = separator_on_nulls::YES,
206 
264 std::unique_ptr<column> join_list_elements(
265  lists_column_view const& lists_strings_column,
266  strings_column_view const& separators,
267  string_scalar const& separator_narep = string_scalar("", false),
268  string_scalar const& string_narep = string_scalar("", false),
269  separator_on_nulls separate_nulls = separator_on_nulls::YES,
270  output_if_empty_list empty_list_policy = output_if_empty_list::EMPTY_STRING,
273 
324 std::unique_ptr<column> join_list_elements(
325  lists_column_view const& lists_strings_column,
326  string_scalar const& separator = string_scalar(""),
327  string_scalar const& narep = string_scalar("", false),
328  separator_on_nulls separate_nulls = separator_on_nulls::YES,
329  output_if_empty_list empty_list_policy = output_if_empty_list::EMPTY_STRING,
332  // end of doxygen group
334 } // namespace strings
335 } // namespace CUDF_EXPORT cudf
Given a column-view of lists type, an instance of this class provides a wrapper on this compound colu...
An owning class to represent a string in device memory.
Definition: scalar.hpp:429
Given a column-view of strings type, an instance of this class provides a wrapper on this compound co...
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:200
Class definition for cudf::column.
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
std::unique_ptr< column > concatenate(table_view const &strings_columns, string_scalar const &separator=string_scalar(""), string_scalar const &narep=string_scalar("", false), separator_on_nulls separate_nulls=separator_on_nulls::YES, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Row-wise concatenates the given list of strings columns and returns a single strings column result.
std::unique_ptr< column > join_list_elements(lists_column_view const &lists_strings_column, string_scalar const &separator=string_scalar(""), string_scalar const &narep=string_scalar("", false), separator_on_nulls separate_nulls=separator_on_nulls::YES, output_if_empty_list empty_list_policy=output_if_empty_list::EMPTY_STRING, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Given a lists column of strings (each row is a list of strings), concatenates the strings within each...
std::unique_ptr< column > join_strings(strings_column_view const &input, string_scalar const &separator=string_scalar(""), string_scalar const &narep=string_scalar("", false), rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Concatenates all strings in the column into one new string delimited by an optional separator string.
output_if_empty_list
Setting for specifying what will be output from join_list_elements when an input list is empty.
separator_on_nulls
Setting for specifying how separators are added with null strings elements.
@ NULL_ELEMENT
Empty list will result in a null.
@ EMPTY_STRING
Empty list will result in empty string.
Class definition for cudf::lists_column_view.
cuDF interfaces
Definition: host_udf.hpp:39
Class definitions for cudf::scalar.
Class definition for cudf::strings_column_view.
Class definitions for (mutable)_table_view