Files | Functions
Sorting

Files

file  sorting.hpp
 API for segmented sorting of elements within each row of a list column.
 

Functions

std::unique_ptr< columncudf::lists::sort_lists (lists_column_view const &source_column, order column_order, null_order null_precedence, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 Segmented sort of the elements within a list in each row of a list column. More...
 
std::unique_ptr< columncudf::lists::stable_sort_lists (lists_column_view const &source_column, order column_order, null_order null_precedence, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 Segmented sort of the elements within a list in each row of a list column using stable sort. More...
 

Detailed Description

Function Documentation

◆ sort_lists()

std::unique_ptr<column> cudf::lists::sort_lists ( lists_column_view const &  source_column,
order  column_order,
null_order  null_precedence,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

Segmented sort of the elements within a list in each row of a list column.

The source_column child may be of any type whose leaf elements are relationally comparable, including arbitrarily nested LIST and STRUCT children.

source_column : [{4, 2, 3, 1}, {1, 2, NULL, 4}, {-10, 10, 0}]
Ascending, Null After : [{1, 2, 3, 4}, {1, 2, 4, NULL}, {-10, 0, 10}]
Ascending, Null Before : [{1, 2, 3, 4}, {NULL, 1, 2, 4}, {-10, 0, 10}]
Descending, Null After : [{4, 3, 2, 1}, {NULL, 4, 2, 1}, {10, 0, -10}]
Descending, Null Before : [{4, 3, 2, 1}, {4, 2, 1, NULL}, {10, 0, -10}]
Parameters
source_columnView of the list column to sort
column_orderThe desired sort order
null_precedenceThe desired order of null compared to other elements in the list
streamCUDA stream used for device memory operations and kernel launches
mrDevice memory resource to allocate any returned objects
Returns
list column with elements in each list sorted.

◆ stable_sort_lists()

std::unique_ptr<column> cudf::lists::stable_sort_lists ( lists_column_view const &  source_column,
order  column_order,
null_order  null_precedence,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

Segmented sort of the elements within a list in each row of a list column using stable sort.

Segmented sort of the elements within a list in each row of a list column. The source_column child may be of any type whose leaf elements are relationally comparable, including arbitrarily nested LIST and STRUCT children.

source_column : [{4, 2, 3, 1}, {1, 2, NULL, 4}, {-10, 10, 0}]
Ascending, Null After : [{1, 2, 3, 4}, {1, 2, 4, NULL}, {-10, 0, 10}]
Ascending, Null Before : [{1, 2, 3, 4}, {NULL, 1, 2, 4}, {-10, 0, 10}]
Descending, Null After : [{4, 3, 2, 1}, {NULL, 4, 2, 1}, {10, 0, -10}]
Descending, Null Before : [{4, 3, 2, 1}, {4, 2, 1, NULL}, {10, 0, -10}]
Parameters
source_columnView of the list column to sort
column_orderThe desired sort order
null_precedenceThe desired order of null compared to other elements in the list
streamCUDA stream used for device memory operations and kernel launches
mrDevice memory resource to allocate any returned objects
Returns
list column with elements in each list sorted.