libcudf  24.02.00
Files | Functions

Files

file  copying.hpp
 Column APIs for gather, scatter, split, slice, etc.
 

Functions

std::unique_ptr< tablecudf::gather (table_view const &source_table, column_view const &gather_map, out_of_bounds_policy bounds_policy=out_of_bounds_policy::DONT_CHECK, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Gathers the specified rows (including null values) of a set of columns. More...
 

Detailed Description

Function Documentation

◆ gather()

std::unique_ptr<table> cudf::gather ( table_view const &  source_table,
column_view const &  gather_map,
out_of_bounds_policy  bounds_policy = out_of_bounds_policy::DONT_CHECK,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Gathers the specified rows (including null values) of a set of columns.

Gathers the rows of the source columns according to gather_map such that row "i" in the resulting table's columns will contain row "gather_map[i]" from the source columns. The number of rows in the result table will be equal to the number of elements in gather_map.

A negative value i in the gather_map is interpreted as i+n, where n is the number of rows in the source_table.

For dictionary columns, the keys column component is copied and not trimmed if the gather results in abandoned key elements.

Exceptions
cudf::logic_errorif gather_map contains null values.
Parameters
source_tableThe input columns whose rows will be gathered
gather_mapView into a non-nullable column of integral indices that maps the rows in the source columns to rows in the destination columns.
bounds_policyPolicy to apply to account for possible out-of-bounds indices DONT_CHECK skips all bounds checking for gather map values. NULLIFY coerces rows that corresponds to out-of-bounds indices in the gather map to be null elements. Callers should use DONT_CHECK when they are certain that the gather_map contains only valid indices for better performance. If policy is set to DONT_CHECK and there are out-of-bounds indices in the gather map, the behavior is undefined. Defaults to DONT_CHECK.
streamCUDA stream used for device memory operations and kernel launches
mrDevice memory resource used to allocate the returned table's device memory
Returns
Result of the gather