Lists Contains#
- group Searching
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 = cudf::get_current_device_resource_ref())#
Create a column of
boolvalues 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
listscolumn. 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_keyis nullThe list row
lists[i]is null
- Parameters:
lists – Lists column whose
nrows 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
nrows 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 = cudf::get_current_device_resource_ref())#
Create a column of
boolvalues 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
listscolumn. 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
nrows 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
nrows 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 = cudf::get_current_device_resource_ref())#
Create a column of
boolvalues indicating whether each row in thelistscolumn contains at least one null element.The output column has as many elements as the input
listscolumn. 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
nrows 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
nrows 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 = cudf::get_current_device_resource_ref())#
Create a column of values indicating the position of a search key within each list row in the
listscolumn.The output column has as many elements as there are rows in the input
listscolumn. 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_keyis 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_typeindex.
If the
find_optionis set toFIND_FIRST, the position of the first match forsearch_keyis returned. Iffind_option == FIND_LAST, the position of the last match in the list row is returned.- Throws:
cudf::data_type_error – If
search_keystype does not match the element type inlists- Parameters:
lists – Lists column whose
nrows 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
nrows 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 = cudf::get_current_device_resource_ref())#
Create a column of values indicating the position of a search key row within the corresponding list row in the
listscolumn.The output column has as many elements as there are rows in the input
listscolumn. 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_typeindex.
If the
find_optionis set toFIND_FIRST, the position of the first match forsearch_keyis returned. Iffind_option == FIND_LAST, the position of the last match in the list row is returned.- Throws:
cudf::logic_error – If
search_keysdoes not matchlistsin its number of rowscudf::data_type_error – If
search_keystype does not match the element type inlists
- Parameters:
lists – Lists column whose
nrows are to be searchedsearch_keys – A column of search keys to be looked up in each corresponding row of
listsfind_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
nrows with the location of thesearch_key
-
enum class duplicate_find_option : int32_t#