文件 | 函数
搜索

文件

文件  search.hpp
 用于lower_bound、upper_bound和contains的列API。
 

函数

std::unique_ptr< columncudf::lower_bound (table_view const &haystack, table_view const &needles, std::vector< order > const &column_order, std::vector< null_order > const &null_precedence, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 在排序表中查找应插入值以保持排序的最小索引。 更多...
 
std::unique_ptr< columncudf::upper_bound (table_view const &haystack, table_view const &needles, std::vector< order > const &column_order, std::vector< null_order > const &null_precedence, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 在排序表中查找应插入值以保持排序的最大索引。 更多...
 
bool cudf::contains (column_view const &haystack, scalar const &needle, rmm::cuda_stream_view stream=cudf::get_default_stream())
 检查给定的needle值是否存在于haystack列中。 更多...
 
std::unique_ptr< columncudf::contains (column_view const &haystack, column_view const &needles, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 检查给定的needles值是否存在于haystack列中。 更多...
 

详细描述

函数文档

◆ contains() [1/2]

std::unique_ptr<column> cudf::contains ( column_view const &  haystack,
column_view const &  needles,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

检查给定的needles值是否存在于haystack列中。

新列的类型将是 BOOL,并且与输入的needles列具有相同的大小和空值掩码。也就是说,needles列中的任何空行都将导致输出列中出现空行。

异常
cudf::logic_error如果haystack.type() != needles.type()
haystack = { 10, 20, 30, 40, 50 }
needles = { 20, 40, 60, 80 }
result = { true, true, false, false }
参数
haystack包含搜索空间的列
needles要在搜索空间中检查是否存在的值列
stream用于设备内存操作和内核启动的CUDA流
mr用于分配返回列的设备内存的设备内存资源
返回值
一个 BOOL 列,指示needles中的每个元素是否存在于搜索空间中

◆ contains() [2/2]

bool cudf::contains ( column_view const &  haystack,
scalar const &  needle,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

检查给定的needle值是否存在于haystack列中。

异常
cudf::logic_error如果haystack.type() != needle.type()
单列
idx 0 1 2 3 4
haystack = { 10, 20, 20, 30, 50 }
needle = { 20 }
result = true
参数
haystack包含搜索空间的列
needle一个标量值,用于检查其是否存在于搜索空间中
stream用于设备内存操作和内核启动的CUDA流
返回值
如果给定的needle值存在于haystack列中,则为 true

◆ lower_bound()

std::unique_ptr<column> cudf::lower_bound ( table_view const &  haystack,
table_view const &  needles,
std::vector< order > const &  column_order,
std::vector< null_order > const &  null_precedence,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

在排序表中查找应插入值以保持排序的最小索引。

对于needles中的每一行,查找在haystack中插入该行后仍能保持其排序顺序的第一个索引。

示例
单列
idx 0 1 2 3 4
haystack = { 10, 20, 20, 30, 50 }
needles = { 20 }
result = { 1 }
多列
idx 0 1 2 3 4
haystack = {{ 10, 20, 20, 20, 20 },
{ 5.0, .5, .5, .7, .7 },
{ 90, 77, 78, 61, 61 }}
needles = {{ 20 },
{ .7 },
{ 61 }}
result = { 3 }
参数
haystack包含搜索空间的表
needles要在搜索空间中查找插入位置的值
column_order列排序顺序的向量
null_precedencenull_precedence 枚举的向量
stream用于设备内存操作和内核启动的CUDA流
mr用于分配返回列的设备内存的设备内存资源
返回值
一个不可为空的元素列,包含插入点

◆ upper_bound()

std::unique_ptr<column> cudf::upper_bound ( table_view const &  haystack,
table_view const &  needles,
std::vector< order > const &  column_order,
std::vector< null_order > const &  null_precedence,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

在排序表中查找应插入值以保持排序的最大索引。

对于needles中的每一行,查找在haystack中插入该行后仍能保持其排序顺序的最后一个索引。

示例
单列
idx 0 1 2 3 4
haystack = { 10, 20, 20, 30, 50 }
needles = { 20 }
result = { 3 }
多列
idx 0 1 2 3 4
haystack = {{ 10, 20, 20, 20, 20 },
{ 5.0, .5, .5, .7, .7 },
{ 90, 77, 78, 61, 61 }}
needles = {{ 20 },
{ .7 },
{ 61 }}
result = { 5 }
参数
haystack包含搜索空间的表
needles要在搜索空间中查找插入位置的值
column_order列排序顺序的向量
null_precedencenull_precedence 枚举的向量
stream用于设备内存操作和内核启动的CUDA流
mr用于分配返回列的设备内存的设备内存资源
返回值
一个不可为空的元素列,包含插入点