Lists Contains#
- group lists_contains
Enums
-
enum class duplicate_find_option : int32_t#
Option to choose whether
index_of()
returns the first or last match of a search key in a list row.Values:
-
enumerator FIND_FIRST#
Finds first instance of a search key in a list row.
-
enumerator FIND_LAST#
Finds last instance of a search key in a list row.
-
enumerator FIND_FIRST#
Functions
-
std::unique_ptr<column> contains(cudf::lists_column_view const &lists, cudf::scalar const &search_key, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())#
Create a column of
bool
values indicating whether the specified scalar is an element of each row of a list column.The output column has as many elements as the input
lists
column. Outputcolumn[i]
is set to true if the lists rowlists[i]
contains the value specified insearch_key
. Otherwise, it is set to false.Output
column[i]
is set to null if one or more of the following are true:The search key
search_key
is nullThe list row
lists[i]
is null
- Parameters:
lists – Lists column whose
n
rows are to be searchedsearch_key – The scalar key to be looked up in each list row
stream – CUDA stream used for device memory operations and kernel launches.
mr – Device memory resource used to allocate the returned column’s device memory
- Returns:
BOOL8 column of
n
rows with the result of the lookup
-
std::unique_ptr<column> contains(cudf::lists_column_view const &lists, cudf::column_view const &search_keys, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())#
Create a column of
bool
values indicating whether the list rows of the first column contain the corresponding values in the second column.The output column has as many elements as the input
lists
column. Outputcolumn[i]
is set to true if the lists rowlists[i]
contains the value insearch_keys[i]
. Otherwise, it is set to false.Output
column[i]
is set to null if one or more of the following are true:The row
search_keys[i]
is nullThe list row
lists[i]
is null
- Parameters:
lists – Lists column whose
n
rows are to be searchedsearch_keys – Column of elements to be looked up in each list row.
stream – CUDA stream used for device memory operations and kernel launches.
mr – Device memory resource used to allocate the returned column’s device memory
- Returns:
BOOL8 column of
n
rows with the result of the lookup
-
std::unique_ptr<column> contains_nulls(cudf::lists_column_view const &lists, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())#
Create a column of
bool
values indicating whether each row in thelists
column contains at least one null element.The output column has as many elements as the input
lists
column. Outputcolumn[i]
is set to null if the rowlists[i]
is null. Otherwise,column[i]
is set to a non-null boolean value, depending on whether that list contains a null element.A row with an empty list will always return false. Nulls inside non-null nested elements (such as lists or structs) are not considered.
- Parameters:
lists – Lists column whose
n
rows are to be searched.stream – CUDA stream used for device memory operations and kernel launches.
mr – Device memory resource used to allocate the returned column’s device memory
- Returns:
BOOL8 column of
n
rows with the result of the lookup
-
std::unique_ptr<column> index_of(cudf::lists_column_view const &lists, cudf::scalar const &search_key, duplicate_find_option find_option = duplicate_find_option::FIND_FIRST, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())#
Create a column of values indicating the position of a search key within each list row in the
lists
column.The output column has as many elements as there are rows in the input
lists
column. Outputcolumn[i]
contains a 0-based index indicating the position of the search key in each list, counting from the beginning of the list. Note:If the
search_key
is null, all output rows are set to null.If the row
lists[i]
is null,output[i]
is also null.If the row
lists[i]
does not contain thesearch_key
,output[i]
is set to-1
.In all other cases,
output[i]
is set to a non-negativesize_type
index.
If the
find_option
is set toFIND_FIRST
, the position of the first match forsearch_key
is returned. Iffind_option == FIND_LAST
, the position of the last match in the list row is returned.- Throws:
cudf::data_type_error – If
search_keys
type does not match the element type inlists
- Parameters:
lists – Lists column whose
n
rows are to be searchedsearch_key – The scalar key to be looked up in each list row
find_option – Whether to return the position of the first match (
FIND_FIRST
) or last (FIND_LAST
)stream – CUDA stream used for device memory operations and kernel launches
mr – Device memory resource used to allocate the returned column’s device memory
- Returns:
column of
n
rows with the location of thesearch_key
-
std::unique_ptr<column> index_of(cudf::lists_column_view const &lists, cudf::column_view const &search_keys, duplicate_find_option find_option = duplicate_find_option::FIND_FIRST, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())#
Create a column of values indicating the position of a search key row within the corresponding list row in the
lists
column.The output column has as many elements as there are rows in the input
lists
column. Outputcolumn[i]
contains a 0-based index indicating the position of each search key row in its corresponding list row, counting from the beginning of the list. Note:If
search_keys[i]
is null,output[i]
is also null.If the row
lists[i]
is null,output[i]
is also null.If the row
lists[i]
does not containsearch_key[i]
,output[i]
is set to-1
.In all other cases,
output[i]
is set to a non-negativesize_type
index.
If the
find_option
is set toFIND_FIRST
, the position of the first match forsearch_key
is returned. Iffind_option == FIND_LAST
, the position of the last match in the list row is returned.- Throws:
cudf::logic_error – If
search_keys
does not matchlists
in its number of rowscudf::data_type_error – If
search_keys
type does not match the element type inlists
- Parameters:
lists – Lists column whose
n
rows are to be searchedsearch_keys – A column of search keys to be looked up in each corresponding row of
lists
find_option – Whether to return the position of the first match (
FIND_FIRST
) or last (FIND_LAST
)stream – CUDA stream used for device memory operations and kernel launches
mr – Device memory resource used to allocate the returned column’s device memory
- Returns:
column of
n
rows with the location of thesearch_key
-
enum class duplicate_find_option : int32_t#