libcudf  24.02.00
Files | Functions
Counting

Files

file  count_elements.hpp
 

Functions

std::unique_ptr< columncudf::lists::count_elements (lists_column_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Returns a numeric column containing the number of rows in each list element in the given lists column. More...
 

Detailed Description

Function Documentation

◆ count_elements()

std::unique_ptr<column> cudf::lists::count_elements ( lists_column_view const &  input,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Returns a numeric column containing the number of rows in each list element in the given lists column.

The output column will have the same number of rows as the input lists column. Each output[i] will be input[i].size().

l = { {1, 2, 3}, {4}, {5, 6} }
r = count_elements(l)
r is now {3, 1, 2}

Any null input element will result in a corresponding null entry in the output column.

Parameters
inputInput lists column
streamCUDA stream used for device memory operations and kernel launches
mrDevice memory resource used to allocate the returned column's device memory
Returns
New column with the number of elements for each row