列连接#

group column_join

枚举

enum class has_nested : bool#

枚举用于指示不同的连接表是否具有嵌套列。

值:

enumerator YES#
enumerator NO#
enum class nullable_join : bool#

枚举类用于指定任何输入连接表(build 表和之后的任何 probe 表)是否包含空值。

这是在hash_join对象构造时使用的,用于指定所有可能的输入表中是否存在空值。如果这种空值的存在未知,则应使用YES作为默认选项。

值:

enumerator YES#
enumerator NO#

函数

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> inner_join(cudf::table_view const &left_keys, cudf::table_view const &right_keys, null_equality compare_nulls = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一对行索引向量,对应于指定表之间的内连接。

第一个返回的向量包含左表中与右表匹配的行索引(顺序未指定)。第二个返回的向量中的对应值是右表中匹配的行索引。

Left: {{0, 1, 2}}
Right: {{1, 2, 3}}
Result: {{1, 2}, {0, 1}}

Left: {{0, 1, 2}, {3, 4, 5}}
Right: {{1, 2, 3}, {4, 6, 7}}
Result: {{1}, {0}}
Throws:

cudf::logic_error – 如果 left_keysright_keys 中的元素数量不匹配。

Parameters:
  • left_keys[in] 左表

  • right_keys[in] 右表

  • compare_nulls[in] 控制空连接键值是否应该匹配。

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建使用 left_keysright_keys 作为连接键在两个表之间执行内连接的结果。

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> left_join(cudf::table_view const &left_keys, cudf::table_view const &right_keys, null_equality compare_nulls = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一对行索引向量,对应于指定表之间的左连接。

第一个返回的向量包含左表中的所有行索引(顺序未指定)。第二个返回向量中的对应值要么是(1)右表中匹配行的行索引(如果有匹配),要么是(2)一个未指定的越界值。

Left: {{0, 1, 2}}
Right: {{1, 2, 3}}
Result: {{0, 1, 2}, {None, 0, 1}}

Left: {{0, 1, 2}, {3, 4, 5}}
Right: {{1, 2, 3}, {4, 6, 7}}
Result: {{0, 1, 2}, {None, 0, None}}
Throws:

cudf::logic_error – 如果 left_keysright_keys 中的元素数量不匹配。

Parameters:
  • left_keys[in] 左表

  • right_keys[in] 右表

  • compare_nulls[in] 控制空连接键值是否应该匹配。

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建使用 left_keysright_keys 作为连接键在两个表之间执行左连接的结果。

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> full_join(cudf::table_view const &left_keys, cudf::table_view const &right_keys, null_equality compare_nulls = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一对行索引向量,对应于指定表之间的完全连接。

成对来看,返回向量中的值是以下之一:(1) 对应于左右表中匹配行的行索引,(2) 一个行索引和一个未指定的越界值,表示一个表中的行在另一个表中没有匹配项。

Left: {{0, 1, 2}}
Right: {{1, 2, 3}}
Result: {{0, 1, 2, None}, {None, 0, 1, 2}}

Left: {{0, 1, 2}, {3, 4, 5}}
Right: {{1, 2, 3}, {4, 6, 7}}
Result: {{0, 1, 2, None, None}, {None, 0, None, 1, 2}}
Throws:

cudf::logic_error – 如果 left_keysright_keys 中的元素数量不匹配。

Parameters:
  • left_keys[in] 左表

  • right_keys[in] 右表

  • compare_nulls[in] 控制空连接键值是否应该匹配。

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建使用 left_keysright_keys 作为连接键在两个表之间执行全连接的结果。

std::unique_ptr<rmm::device_uvector<size_type>> left_semi_join(cudf::table_view const &left_keys, cudf::table_view const &right_keys, null_equality compare_nulls = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回与指定表之间的左半连接相对应的行索引向量。

返回的向量包含左表中与右表中有匹配行的行索引。

TableA: {{0, 1, 2}}
TableB: {{1, 2, 3}}
Result: {1, 2}
Parameters:
  • left_keys – 左表

  • right_keys – 右表

  • compare_nulls – 控制空连接键值是否应该匹配

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一个向量 left_indices,可用于构造使用 left_keysright_keys 作为连接键在两个表之间执行左半连接的结果。

std::unique_ptr<rmm::device_uvector<size_type>> left_anti_join(cudf::table_view const &left_keys, cudf::table_view const &right_keys, null_equality compare_nulls = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一个行索引向量,对应于指定表之间的左反连接。

返回的向量包含左表中没有在右表中找到匹配行的行索引。

TableA: {{0, 1, 2}}
TableB: {{1, 2, 3}}
Result: {0}
Throws:

cudf::logic_error – 如果 left_keysright_keys 中的列数为 0

Parameters:
  • left_keys[in] 左表

  • right_keys[in] 右表

  • compare_nulls[in] 控制空连接键值是否应该匹配。

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一个列 left_indices,可用于构建使用 left_keysright_keys 作为连接键在两个表之间执行左反连接的结果。

std::unique_ptr<cudf::table> cross_join(cudf::table_view const &left, cudf::table_view const &right, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

对两个表(left, right)执行交叉连接

交叉连接返回每个表中行的笛卡尔积。

Left a: {0, 1, 2}
Right b: {3, 4, 5}
Result: { a: {0, 0, 0, 1, 1, 1, 2, 2, 2}, b: {3, 4, 5, 3, 4, 5, 3, 4, 5} }

注意

警告:此函数容易导致内存不足错误。输出的大小等于 left.num_rows() * right.num_rows()。请谨慎使用。

Throws:

cudf::logic_error – 如果 leftright 表中的列数为 0

Parameters:
  • left – 左表

  • right – 右表

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表的设备内存的设备内存资源

Returns:

leftright 表交叉连接的结果

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> conditional_inner_join(table_view const &left, table_view const &right, ast::expression const &binary_predicate, std::optional<std::size_t> output_size = {}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一对行索引向量,对应于指定表之间所有满足谓词评估为真的行对。

第一个返回的向量包含左表中与右表匹配的行索引(顺序未指定)。第二个返回的向量中的对应值是右表中匹配的行索引。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。

Left: {{0, 1, 2}}
Right: {{1, 2, 3}}
Expression: Left.Column_0 == Right.Column_0
Result: {{1, 2}, {0, 1}}

Left: {{0, 1, 2}, {3, 4, 5}}
Right: {{1, 2, 3}, {4, 6, 7}}
Expression: (Left.Column_0 == Right.Column_0) AND (Left.Column_1 == Right.Column_1)
Result: {{1}, {0}}
Throws:

cudf::data_type_error – 如果二元谓词输出非布尔结果。

Parameters:
  • left – 左表

  • right – 右表

  • binary_predicate – 连接的条件

  • output_size – 可选值,允许用户指定确切的输出大小

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建在两个表 leftright 之间执行条件内连接的结果。

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> conditional_left_join(table_view const &left, table_view const &right, ast::expression const &binary_predicate, std::optional<std::size_t> output_size = {}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一对行索引向量,对应于指定表之间所有满足谓词评估为真的行对,或者对于左表中没有匹配项的行的空匹配。

第一个返回的向量包含左表中的所有行索引(顺序未指定)。第二个返回向量中的对应值要么是(1)右表中匹配行的行索引(如果有匹配),要么是(2)一个未指定的越界值。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。

Left: {{0, 1, 2}}
Right: {{1, 2, 3}}
Expression: Left.Column_0 == Right.Column_0
Result: {{0, 1, 2}, {None, 0, 1}}

Left: {{0, 1, 2}, {3, 4, 5}}
Right: {{1, 2, 3}, {4, 6, 7}}
Expression: (Left.Column_0 == Right.Column_0) AND (Left.Column_1 == Right.Column_1)
Result: {{0, 1, 2}, {None, 0, None}}
Throws:

cudf::data_type_error – 如果二元谓词输出非布尔结果。

Parameters:
  • left – 左表

  • right – 右表

  • binary_predicate – 连接的条件

  • output_size – 可选值,允许用户指定确切的输出大小

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建在两个表 leftright 之间执行条件左连接的结果。

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> conditional_full_join(table_view const &left, table_view const &right, ast::expression const &binary_predicate, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一对行索引向量,对应于指定表之间所有满足谓词评估为真的行对,或者对于在另一个表中没有匹配的任一表中的行返回空匹配。

成对来看,返回向量中的值是以下之一:(1) 对应于左右表中匹配行的行索引,(2) 一个行索引和一个未指定的越界值,表示一个表中的行在另一个表中没有匹配项。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。

Left: {{0, 1, 2}}
Right: {{1, 2, 3}}
Expression: Left.Column_0 == Right.Column_0
Result: {{0, 1, 2, None}, {None, 0, 1, 2}}

Left: {{0, 1, 2}, {3, 4, 5}}
Right: {{1, 2, 3}, {4, 6, 7}}
Expression: (Left.Column_0 == Right.Column_0) AND (Left.Column_1 == Right.Column_1)
Result: {{0, 1, 2, None, None}, {None, 0, None, 1, 2}}
Throws:

cudf::data_type_error – 如果二元谓词输出非布尔结果。

Parameters:
  • left – 左表

  • right – 右表

  • binary_predicate – 连接的条件

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建在两个表 leftright 之间执行条件完全连接的结果。

std::unique_ptr<rmm::device_uvector<size_type>> conditional_left_semi_join(table_view const &left, table_view const &right, ast::expression const &binary_predicate, std::optional<std::size_t> output_size = {}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一个索引向量,对应于左表中所有存在右表中某些行的行,其中谓词评估为真。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。

Left: {{0, 1, 2}}
Right: {{1, 2, 3}}
Expression: Left.Column_0 == Right.Column_0
Result: {1, 2}

Left: {{0, 1, 2}, {3, 4, 5}}
Right: {{1, 2, 3}, {4, 6, 7}}
Expression: (Left.Column_0 == Right.Column_0) AND (Left.Column_1 == Right.Column_1)
Result: {1}
Throws:

cudf::data_type_error – 如果二元谓词输出非布尔结果。

Parameters:
  • left – 左表

  • right – 右表

  • binary_predicate – 连接的条件

  • output_size – 可选值,允许用户指定确切的输出大小

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一个向量 left_indices,可用于构造在两个表 leftright 之间执行条件左半连接的结果。

std::unique_ptr<rmm::device_uvector<size_type>> conditional_left_anti_join(table_view const &left, table_view const &right, ast::expression const &binary_predicate, std::optional<std::size_t> output_size = {}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一个索引向量,对应于左表中所有在右表中不存在任何行使得谓词评估为真的行。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。

Left: {{0, 1, 2}}
Right: {{1, 2, 3}}
Expression: Left.Column_0 == Right.Column_0
Result: {0}

Left: {{0, 1, 2}, {3, 4, 5}}
Right: {{1, 2, 3}, {4, 6, 7}}
Expression: (Left.Column_0 == Right.Column_0) AND (Left.Column_1 == Right.Column_1)
Result: {0, 2}
Throws:

cudf::data_type_error – 如果二元谓词输出非布尔结果。

Parameters:
  • left – 左表

  • right – 右表

  • binary_predicate – 连接的条件

  • output_size – 可选值,允许用户指定确切的输出大小

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一个向量 left_indices,可用于构造在两个表 leftright 之间执行条件左反连接的结果。

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> mixed_inner_join(table_view const &left_equality, table_view const &right_equality, table_view const &left_conditional, table_view const &right_conditional, ast::expression const &binary_predicate, null_equality compare_nulls = null_equality::EQUAL, std::optional<std::pair<std::size_t, device_span<size_type const>>> output_size_data = {}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一对行索引向量,对应于指定表之间的所有行对,其中等式表的列相等,并且谓词在条件表上评估为真。

第一个返回的向量包含左表中与右表匹配的行索引(顺序未指定)。第二个返回的向量中的对应值是右表中匹配的行索引。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。用户有责任选择合适的compare_nulls值并在表达式中使用适当的空安全操作符。

如果提供的输出大小或每行计数不正确,行为是未定义的。

left_equality: {{0, 1, 2}}
right_equality: {{1, 2, 3}}
left_conditional: {{4, 4, 4}}
right_conditional: {{3, 4, 5}}
Expression: Left.Column_0 > Right.Column_0
Result: {{1}, {0}}
Throws:
  • cudf::data_type_error – 如果二元谓词输出非布尔结果。

  • cudf::logic_error – 如果 left_equality 和 left_conditional 的行数不匹配。

  • cudf::logic_error – 如果 right_equality 和 right_conditional 中的行数不匹配。

Parameters:
  • left_equality – 用于等值连接的左表

  • right_equality – 用于等值连接的右表

  • left_conditional – 用于条件连接的左表

  • right_conditional – 用于条件连接的正确表

  • binary_predicate – 连接的条件

  • compare_nulls – 是否将空值相互连接

  • output_size_data – 一个可选的数值对,表示两个输入表中较大表(左表或右表)中每行的确切输出大小和匹配次数(可以使用相应的mixed_inner_join_size API预先计算)。

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建在四个输入表之间执行混合内连接的结果。

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> mixed_left_join(table_view const &left_equality, table_view const &right_equality, table_view const &left_conditional, table_view const &right_conditional, ast::expression const &binary_predicate, null_equality compare_nulls = null_equality::EQUAL, std::optional<std::pair<std::size_t, device_span<size_type const>>> output_size_data = {}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一对行索引向量,对应于指定表之间的所有行对,其中等式表的列相等,并且谓词在条件表上评估为真,或者对于在右侧没有匹配的左侧行返回空匹配。

第一个返回的向量包含左表中在右表中有匹配的行索引(顺序未指定)。第二个返回的向量中的对应值要么是(1)右表中匹配行的行索引,要么是(2)未指定的越界值。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。用户有责任选择合适的compare_nulls值并在表达式中使用适当的空安全操作符。

如果提供的输出大小或每行计数不正确,行为是未定义的。

left_equality: {{0, 1, 2}}
right_equality: {{1, 2, 3}}
left_conditional: {{4, 4, 4}}
right_conditional: {{3, 4, 5}}
Expression: Left.Column_0 > Right.Column_0
Result: {{0, 1, 2}, {None, 0, None}}
Throws:
  • cudf::data_type_error – 如果二元谓词输出非布尔结果。

  • cudf::logic_error – 如果 left_equality 和 left_conditional 的行数不匹配。

  • cudf::logic_error – 如果 right_equality 和 right_conditional 中的行数不匹配。

Parameters:
  • left_equality – 用于等值连接的左表

  • right_equality – 用于等值连接的右表

  • left_conditional – 用于条件连接的左表

  • right_conditional – 用于条件连接的正确表

  • binary_predicate – 连接的条件

  • compare_nulls – 是否将空值相互连接

  • output_size_data – 一个可选的值对,表示两个输入表中较大表(左表或右表)中每行的确切输出大小和匹配数量(可以使用相应的mixed_left_join_size API预先计算)。

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建在四个输入表之间执行混合左连接的结果。

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> mixed_full_join(table_view const &left_equality, table_view const &right_equality, table_view const &left_conditional, table_view const &right_conditional, ast::expression const &binary_predicate, null_equality compare_nulls = null_equality::EQUAL, std::optional<std::pair<std::size_t, device_span<size_type const>>> output_size_data = {}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一对行索引向量,对应于指定表之间的所有行对,其中等式表的列相等,并且谓词在条件表上评估为真,或者对于在另一对表中没有匹配的行对中的行返回空匹配。

成对来看,返回向量中的值是以下之一:(1) 对应于左右表中匹配行的行索引,(2) 一个行索引和一个未指定的越界值,表示一个表中的行在另一个表中没有匹配项。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。用户有责任选择合适的compare_nulls值并在表达式中使用适当的空安全操作符。

如果提供的输出大小或每行计数不正确,行为是未定义的。

left_equality: {{0, 1, 2}}
right_equality: {{1, 2, 3}}
left_conditional: {{4, 4, 4}}
right_conditional: {{3, 4, 5}}
Expression: Left.Column_0 > Right.Column_0
Result: {{0, 1, 2, None, None}, {None, 0, None, 1, 2}}
Throws:
  • cudf::data_type_error – 如果二元谓词输出非布尔结果。

  • cudf::logic_error – 如果 left_equality 和 left_conditional 的行数不匹配。

  • cudf::logic_error – 如果 right_equality 和 right_conditional 中的行数不匹配。

Parameters:
  • left_equality – 用于等值连接的左表

  • right_equality – 用于等值连接的右表

  • left_conditional – 用于条件连接的左表

  • right_conditional – 用于条件连接的正确表

  • binary_predicate – 连接的条件

  • compare_nulls – 是否将空值相互连接

  • output_size_data – 一个可选的数值对,表示两个输入表中较大表(左表或右表)中每行的确切输出大小和匹配数量(可以使用相应的mixed_full_join_size API预先计算)。

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建在四个输入表之间执行混合全连接的结果。

std::unique_ptr<rmm::device_uvector<size_type>> mixed_left_semi_join(table_view const &left_equality, table_view const &right_equality, table_view const &left_conditional, table_view const &right_conditional, ast::expression const &binary_predicate, null_equality compare_nulls = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一个索引向量,对应于左表中所有行,其中等式表的列相等且谓词在条件表上评估为真。

如果提供的谓词对一对行(左,右)返回NULL,则左行不包括在输出中。用户有责任选择适当的compare_nulls值并在表达式中使用适当的空安全操作符。

如果提供的输出大小或每行计数不正确,行为是未定义的。

left_equality: {{0, 1, 2}}
right_equality: {{1, 2, 3}}
left_conditional: {{4, 4, 4}}
right_conditional: {{3, 4, 5}}
Expression: Left.Column_0 > Right.Column_0
Result: {1}
Throws:
  • cudf::data_type_error – 如果二元谓词输出非布尔结果。

  • cudf::logic_error – 如果 left_equality 和 left_conditional 的行数不匹配。

  • cudf::logic_error – 如果 right_equality 和 right_conditional 中的行数不匹配。

Parameters:
  • left_equality – 用于等值连接的左表

  • right_equality – 用于等值连接的右表

  • left_conditional – 用于条件连接的左表

  • right_conditional – 用于条件连接的正确表

  • binary_predicate – 连接的条件

  • compare_nulls – 是否将空值相互连接

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建在四个输入表之间执行混合全连接的结果。

std::unique_ptr<rmm::device_uvector<size_type>> mixed_left_anti_join(table_view const &left_equality, table_view const &right_equality, table_view const &left_conditional, table_view const &right_conditional, ast::expression const &binary_predicate, null_equality compare_nulls = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回一个索引向量,对应于左表中的所有行,这些行在右表中没有对应的行,其中等式表的列相等,并且在条件表上谓词评估为真。

如果提供的谓词对一对行(左,右)返回NULL,则左行不包括在输出中。用户有责任选择合适的compare_nulls值并在表达式中使用适当的空安全操作符。

如果提供的输出大小或每行计数不正确,行为是未定义的。

left_equality: {{0, 1, 2}}
right_equality: {{1, 2, 3}}
left_conditional: {{4, 4, 4}}
right_conditional: {{3, 4, 5}}
Expression: Left.Column_0 > Right.Column_0
Result: {0, 2}
Throws:
  • cudf::data_type_error – 如果二元谓词输出非布尔结果。

  • cudf::logic_error – 如果 left_equality 和 left_conditional 的行数不匹配。

  • cudf::logic_error – 如果 right_equality 和 right_conditional 中的行数不匹配。

Parameters:
  • left_equality – 用于等值连接的左表

  • right_equality – 用于等值连接的右表

  • left_conditional – 用于条件连接的左表

  • right_conditional – 用于条件连接的正确表

  • binary_predicate – 连接的条件

  • compare_nulls – 是否将空值相互连接

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对向量 [left_indices, right_indices],可用于构建在四个输入表之间执行混合全连接的结果。

std::pair<std::size_t, std::unique_ptr<rmm::device_uvector<size_type>>> mixed_inner_join_size(table_view const &left_equality, table_view const &right_equality, table_view const &left_conditional, table_view const &right_conditional, ast::expression const &binary_predicate, null_equality compare_nulls = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回在指定表之间执行混合内连接时,当等式表的列相等且谓词在条件表上评估为真时的确切匹配数(行数)。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。用户有责任选择合适的compare_nulls值并在表达式中使用适当的空安全操作符。

Throws:
  • cudf::data_type_error – 如果二元谓词输出非布尔结果。

  • cudf::logic_error – 如果 left_equality 和 left_conditional 的行数不匹配。

  • cudf::logic_error – 如果 right_equality 和 right_conditional 中的行数不匹配。

Parameters:
  • left_equality – 用于等值连接的左表

  • right_equality – 用于等值连接的右表

  • left_conditional – 用于条件连接的左表

  • right_conditional – 用于条件连接的正确表

  • binary_predicate – 连接的条件

  • compare_nulls – 是否将空值相互连接

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对包含执行请求的连接后得到的大小以及两个表中一个表的每行的匹配数。两个表中的哪一个是实现细节,不应依赖,只需原样传递给相应的mixed_inner_join API。

std::pair<std::size_t, std::unique_ptr<rmm::device_uvector<size_type>>> mixed_left_join_size(table_view const &left_equality, table_view const &right_equality, table_view const &left_conditional, table_view const &right_conditional, ast::expression const &binary_predicate, null_equality compare_nulls = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回在指定表之间执行混合左连接时,当等式表的列相等且谓词在条件表上评估为真时的确切匹配数(行数)。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。用户有责任选择合适的compare_nulls值并在表达式中使用适当的空安全操作符。

Throws:
  • cudf::data_type_error – 如果二元谓词输出非布尔结果。

  • cudf::logic_error – 如果 left_equality 和 left_conditional 的行数不匹配。

  • cudf::logic_error – 如果 right_equality 和 right_conditional 中的行数不匹配。

Parameters:
  • left_equality – 用于等值连接的左表

  • right_equality – 用于等值连接的右表

  • left_conditional – 用于条件连接的左表

  • right_conditional – 用于条件连接的正确表

  • binary_predicate – 连接的条件

  • compare_nulls – 是否将空值相互连接

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

一对包含执行请求的连接后得到的大小以及两个表中一个表的每行的匹配数。这两个表中的哪一个是实现细节,不应依赖,只需原样传递给相应的 mixed_left_join API。

std::size_t conditional_inner_join_size(table_view const &left, table_view const &right, ast::expression const &binary_predicate, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回在指定表之间执行条件内连接时谓词评估为真时的确切匹配数(行数)。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。

Throws:

cudf::data_type_error – 如果二元谓词输出非布尔结果。

Parameters:
  • left – 左表

  • right – 右表

  • binary_predicate – 连接的条件

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

执行请求的连接后得到的大小

std::size_t conditional_left_join_size(table_view const &left, table_view const &right, ast::expression const &binary_predicate, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回在指定表之间执行条件左连接时,谓词评估为真时的确切匹配数(行数)。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。

Throws:

cudf::data_type_error – 如果二元谓词输出非布尔结果。

Parameters:
  • left – 左表

  • right – 右表

  • binary_predicate – 连接的条件

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

执行请求的连接后得到的大小

std::size_t conditional_left_semi_join_size(table_view const &left, table_view const &right, ast::expression const &binary_predicate, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回在指定表之间执行条件左半连接时,谓词评估为真的匹配项(行)的确切数量。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。

Throws:

cudf::data_type_error – 如果二元谓词输出非布尔结果。

Parameters:
  • left – 左表

  • right – 右表

  • binary_predicate – 连接的条件

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

执行请求的连接后得到的大小

std::size_t conditional_left_anti_join_size(table_view const &left, table_view const &right, ast::expression const &binary_predicate, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

返回在指定表之间执行条件左反连接时,谓词评估为真时的确切匹配数(行数)。

如果提供的谓词对一对行(左,右)返回NULL,则该对行不会包含在输出中。

Throws:

cudf::data_type_error – 如果二元谓词输出非布尔结果。

Parameters:
  • left – 左表

  • right – 右表

  • binary_predicate – 连接的条件

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源

Returns:

执行请求的连接后得到的大小

class hash_join#
#include <join.hpp>

在创建时构建哈希表并在后续的*_join成员函数中探测结果的哈希连接。

该类启用哈希连接方案,该方案构建一次哈希表,并根据需要(可能并行)进行多次探测。

公共类型

using impl_type = typename cudf::detail::hash_join<cudf::hashing::detail::MurmurHash3_x86_32<cudf::hash_value_type>>#

实现类型。

公共函数

hash_join(cudf::table_view const &build, null_equality compare_nulls, rmm::cuda_stream_view stream = cudf::get_default_stream())#

为后续的探测调用构建一个哈希连接对象。

注意

hash_join 对象不得比 build 查看的表存活更久,否则行为是未定义的。

Parameters:
  • build – 构建表,从中构建哈希表

  • compare_nulls – 控制空连接键值是否应该匹配

  • stream – 用于设备内存操作和内核启动的CUDA流

hash_join(cudf::table_view const &build, nullable_join has_nulls, null_equality compare_nulls, rmm::cuda_stream_view stream = cudf::get_default_stream())#

为后续的探测调用构建一个哈希连接对象。

注意

hash_join 对象不得比 build 查看的表更长寿,否则行为是未定义的。

Parameters:
  • build – 构建表,从中构建哈希表

  • compare_nulls – 控制空连接键值是否应该匹配

  • stream – 用于设备内存操作和内核启动的CUDA流

  • has_nulls – 标志,用于指示在build表或任何稍后将用于连接的probe表中是否存在任何空值

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> inner_join(cudf::table_view const &probe, std::optional<std::size_t> output_size = {}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()) const#

返回可用于构建两个表之间执行内连接结果的行的索引。

另请参阅

cudf::inner_join(). 如果提供的 output_size 小于实际输出大小,则行为未定义。

Parameters:
  • probe – 探测表,从中探测元组

  • output_size – 可选值,允许用户指定确切的输出大小

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源。

Throws:

cudf::logic_error – 如果输入探测表包含空值,而此 hash_join 对象在构造时未进行空值检查。

Returns:

一对列 [left_indices, right_indices],可用于构建使用 buildprobe 作为连接键在两个表之间执行内连接的结果。

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> left_join(cudf::table_view const &probe, std::optional<std::size_t> output_size = {}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()) const#

返回可用于构建两个表之间执行左连接结果的行的索引。

另请参阅

cudf::left_join()。如果提供的output_size小于实际输出大小,则行为未定义。

Parameters:
  • probe – 探测表,从中探测元组

  • output_size – 可选值,允许用户指定确切的输出大小

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源。

Throws:

cudf::logic_error – 如果输入探测表包含空值,而此 hash_join 对象在构造时未进行空值检查。

Returns:

一对列 [left_indices, right_indices],可用于构建使用 buildprobe 作为连接键在两个表之间执行左连接的结果。

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> full_join(cudf::table_view const &probe, std::optional<std::size_t> output_size = {}, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()) const#

返回可用于构建两个表之间执行完全连接结果的行的索引。

另请参阅

cudf::full_join(). 如果提供的 output_size 小于实际输出大小,则行为未定义。

Parameters:
  • probe – 探测表,从中探测元组

  • output_size – 可选值,允许用户指定确切的输出大小

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源。

Throws:

cudf::logic_error – 如果输入探测表包含空值,而此 hash_join 对象在构造时未进行空值检查。

Returns:

一对列 [left_indices, right_indices],可用于构建使用 buildprobe 作为连接键在两个表之间执行全连接的结果。

std::size_t inner_join_size(cudf::table_view const &probe, rmm::cuda_stream_view stream = cudf::get_default_stream()) const#

返回与指定探测表执行内连接时的确切匹配数(行数)。

Parameters:
  • probe – 探测表,从中探测元组

  • stream – 用于设备内存操作和内核启动的CUDA流

Throws:

cudf::logic_error – 如果输入探测表包含空值,而此 hash_join 对象在构造时未进行空值检查。

Returns:

在两个表之间使用buildprobe作为连接键执行内连接时的确切输出数量。

std::size_t left_join_size(cudf::table_view const &probe, rmm::cuda_stream_view stream = cudf::get_default_stream()) const#

返回与指定探测表执行左连接时的确切匹配数(行数)。

Parameters:
  • probe – 探测表,从中探测元组

  • stream – 用于设备内存操作和内核启动的CUDA流

Throws:

cudf::logic_error – 如果输入探测表包含空值,而此 hash_join 对象在构造时未进行空值检查。

Returns:

当使用buildprobe作为连接键在两个表之间执行左连接时,输出的确切数量。

std::size_t full_join_size(cudf::table_view const &probe, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()) const#

返回与指定探测表执行完全连接时的确切匹配数(行数)。

Parameters:
  • probe – 探测表,从中探测元组

  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配中间表和列的设备内存的设备内存资源。

Throws:

cudf::logic_error – 如果输入探测表包含空值,而此 hash_join 对象在构造时未进行空值检查。

Returns:

在两个表之间使用buildprobe作为连接键进行完全连接时的确切输出数量。

template<cudf::has_nested HasNested>
class distinct_hash_join#
#include <join.hpp>

在创建时构建哈希表并在后续的*_join成员函数中探测结果的独特哈希连接。

注意

如果构建表包含重复项,则行为未定义。

注意

所有的NaN都被认为是相等的

Template Parameters:

HasNested – 标志,指示构建/探测表中是否存在嵌套列

公共函数

distinct_hash_join(cudf::table_view const &build, cudf::table_view const &probe, nullable_join has_nulls = nullable_join::YES, null_equality compare_nulls = null_equality::EQUAL, rmm::cuda_stream_view stream = cudf::get_default_stream())#

为后续的探测调用构建一个独特的哈希连接对象。

Parameters:
  • build – 包含不同元素的构建表

  • probe – 探测表,从中探测键值

  • has_nulls – 标志,用于指示在build表或任何稍后将用于连接的probe表中是否存在任何空值

  • compare_nulls – 控制空连接键值是否应该匹配

  • stream – 用于设备内存操作和内核启动的CUDA流

std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<rmm::device_uvector<size_type>>> inner_join(rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()) const#

返回可用于构建两个表之间执行内连接结果的行的索引。

另请参阅

cudf::inner_join().

Parameters:
  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回索引的设备内存的设备内存资源。

Returns:

一对列 [build_indices, probe_indices],可用于构建两个表之间使用 buildprobe 作为连接键执行内连接的结果。

std::unique_ptr<rmm::device_uvector<size_type>> left_join(rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref()) const#

返回可用于构建两个表之间执行左连接结果的构建表索引。

注意

对于探针表的给定行索引 i,如果存在匹配,则结果 build_indices[i] 包含来自构建表的匹配行的行索引。否则,包含 JoinNoneValue

Parameters:
  • stream – 用于设备内存操作和内核启动的CUDA流

  • mr – 用于分配返回表和列的设备内存的设备内存资源。

Returns:

一个build_indices列,可用于构建使用buildprobe作为连接键在两个表之间执行左连接的结果。