复制 Gather#
- group Gathering
函数
-
std::unique_ptr<table> 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::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#
聚集(Gather)指定的一组列的行(包括空值)。
根据
gather_map
聚集(Gather)源列的行,使得结果表中的第“i”行包含源列中的第“gather_map[i]”行。结果表中的行数将等于gather_map
中的元素数量。gather_map
中的负值i
被解释为i+n
,其中n
是source_table
中的行数。对于字典列,如果 Gather 操作导致废弃的键元素,则复制键列组件,但不会对其进行修剪。
- 抛出:
std::invalid_argument – 如果 gather_map 包含空值。
- 参数:
source_table – 要聚集(Gather)行的输入列
gather_map – 一个非空的可变长整数索引列的视图,它将源列中的行映射到目标列中的行。
bounds_policy – 用于处理可能越界索引的策略。
DONT_CHECK
会跳过对 gather map 中所有值的边界检查。NULLIFY
会强制将 gather map 中对应越界索引的行设为空元素。当确定 gather_map 只包含有效索引时,调用者应使用DONT_CHECK
以获得更好的性能。如果policy
设置为DONT_CHECK
且 gather map 中存在越界索引,则行为是未定义的。默认为DONT_CHECK
。stream – 用于设备内存操作和内核启动的 CUDA 流
mr – 用于分配返回表的设备内存的设备内存资源
- 返回:
Gather 操作的结果
-
std::unique_ptr<table> 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::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#