列表收集#
- group 收集
函数
-
std::unique_ptr<column> segmented_gather(lists_column_view const &source_column, lists_column_view const &gather_map_list, 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())#
对列表列中每一行列表元素内的元素进行分段收集。
仅支持任意深度的
source_column
和深度为1的gather_map_list
。source_column : [{"a", "b", "c", "d"}, {"1", "2", "3", "4"}, {"x", "y", "z"}] gather_map_list : [{0, 1, 3, 2}, {1, 3, 2}, {}] result : [{"a", "b", "d", "c"}, {"2", "4", "3"}, {}]
如果
gather_map_list
中的索引超出了范围[-n, n)
(其中n
是源列对应行中的元素数量),则行为如下如果
bounds_policy
设置为DONT_CHECK
,则行为是未定义的。如果
bounds_policy
设置为NULLIFY
,则输出列中列表行中的相应元素被设置为null。
source_column : [{"a", "b", "c", "d"}, {"1", "2", "3", "4"}, {"x", "y", "z"}] gather_map_list : [{0, -1, 4, -5}, {1, 3, 5}, {}] result_with_nullify : [{"a", "d", null, null}, {"2", "4", null}, {}]
- 抛出::
cudf::logic_error – 如果
gather_map_list
的大小与source_column
的大小不同。std::invalid_argument – 如果gather_map包含null值。
cudf::logic_error – 如果gather_map不是索引类型的列表列。
- 参数::
source_column – 用于从中收集的列表列视图
gather_map_list – 一个非可空列表列的视图,包含整数索引,用于将源列中每行列表中的元素映射到目标列中的列表行。
bounds_policy – 可以是
DONT_CHECK
或NULLIFY
。选择当收集索引超出范围[-n, n)
时是否将输出列表行的元素置为null,其中n
是与gather-map行对应的列表行中的元素数量。stream – 用于设备内存操作和内核启动的CUDA流。
mr – 用于分配任何返回对象的设备内存资源
- 返回::
根据
gather_map_list
收集的列表行中的元素组成的列
-
std::unique_ptr<column> segmented_gather(lists_column_view const &source_column, lists_column_view const &gather_map_list, 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())#