列连接#

group 连接

枚举

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}}
抛出:

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

参数:
  • left_keys[in] 左表

  • right_keys[in] 右表

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

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

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

返回:

向量对 [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}}
抛出:

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

参数:
  • left_keys[in] 左表

  • right_keys[in] 右表

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

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

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

返回:

向量对 [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}}
抛出:

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

参数:
  • left_keys[in] 左表

  • right_keys[in] 右表

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

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

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

返回:

向量对 [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}
参数:
  • left_keys – 左表

  • right_keys – 右表

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

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

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

返回:

向量 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}
抛出:

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

参数:
  • left_keys[in] 左表

  • right_keys[in] 右表

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

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

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

返回:

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()。请谨慎使用。

抛出:

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

参数:
  • left – 左表

  • right – 右表

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

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

返回:

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())#

返回与指定表之间所有谓词计算结果为真的行对对应的行索引向量对。

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

如果提供的谓词对一行对(left, right)返回 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}}
抛出:

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

参数:
  • left – 左表

  • right – 右表

  • binary_predicate – 用于连接的条件

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

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

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

返回:

向量对 [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) 一个未指定的越界值。

如果提供的谓词对一行对(left, right)返回 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}}
抛出:

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

参数:
  • left – 左表

  • right – 右表

  • binary_predicate – 用于连接的条件

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

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

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

返回:

向量对 [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) 一个行索引和一个未指定的越界值,表示在一个表中没有匹配项的行。

如果提供的谓词对一行对(left, right)返回 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}}
抛出:

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

参数:
  • left – 左表

  • right – 右表

  • binary_predicate – 用于连接的条件

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

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

返回:

向量对 [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())#

返回一个索引向量,对应于左表中存在右表中满足谓词评估为 true 的行。

如果提供的谓词对一行对(left, right)返回 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}
抛出:

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

参数:
  • left – 左表

  • right – 右表

  • binary_predicate – 用于连接的条件

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

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

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

返回:

一个向量 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())#

返回一个索引向量,对应于左表中不存在右表中满足谓词评估为 true 的行。

如果提供的谓词对一行对(left, right)返回 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}
抛出:

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

参数:
  • left – 左表

  • right – 右表

  • binary_predicate – 用于连接的条件

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

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

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

返回:

一个向量 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())#

返回一对行索引向量,对应于指定表之间所有满足以下条件的行对:equality 表的列相等,并且 predicate 对 conditional 表评估为 true。

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

如果提供的 predicate 对于一对行(left, right)返回 NULL,则该对不包含在输出中。用户有责任选择合适的 compare_nulls 值并在表达式中使用适当的 null 安全运算符。

如果提供的 output size 或 per-row counts 不正确,则行为未定义。

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}}
抛出:
  • cudf::data_type_error – 如果 binary predicate 输出非布尔结果。

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

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

参数:
  • left_equality – 用于相等连接的左表

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

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

  • right_conditional – 用于条件连接的右表

  • binary_predicate – 用于连接的条件

  • compare_nulls – 空值是否互相连接

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

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

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

返回:

一对向量 [left_indices, right_indices] ,可用于构建对四个输入表执行 mixed inner join 的结果。

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())#

返回一对行索引向量,对应于指定表之间所有满足以下条件的行对:equality 表的列相等,并且 predicate 对 conditional 表评估为 true,或者对于 left 表中在 right 表中没有匹配的行,返回 null 匹配。

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

如果提供的 predicate 对于一对行(left, right)返回 NULL,则该对不包含在输出中。用户有责任选择合适的 compare_nulls 值并在表达式中使用适当的 null 安全运算符。

如果提供的 output size 或 per-row counts 不正确,则行为未定义。

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}}
抛出:
  • cudf::data_type_error – 如果 binary predicate 输出非布尔结果。

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

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

参数:
  • left_equality – 用于相等连接的左表

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

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

  • right_conditional – 用于条件连接的右表

  • binary_predicate – 用于连接的条件

  • compare_nulls – 空值是否互相连接

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

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

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

返回:

一对向量 [left_indices, right_indices] ,可用于构建对四个输入表执行 mixed left join 的结果。

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())#

返回一对行索引向量,对应于指定表之间所有满足以下条件的行对:equality 表的列相等,并且 predicate 对 conditional 表评估为 true,或者对于任一对表中在另一对表中没有匹配的行,返回 null 匹配。

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

如果提供的 predicate 对于一对行(left, right)返回 NULL,则该对不包含在输出中。用户有责任选择合适的 compare_nulls 值并在表达式中使用适当的 null 安全运算符。

如果提供的 output size 或 per-row counts 不正确,则行为未定义。

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}}
抛出:
  • cudf::data_type_error – 如果 binary predicate 输出非布尔结果。

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

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

参数:
  • left_equality – 用于相等连接的左表

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

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

  • right_conditional – 用于条件连接的右表

  • binary_predicate – 用于连接的条件

  • compare_nulls – 空值是否互相连接

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

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

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

返回:

一对向量 [left_indices, right_indices] ,可用于构建对四个输入表执行 mixed full join 的结果。

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())#

返回一个索引向量,对应于 left 表中所有满足以下条件的行:equality 表的列相等,并且 predicate 对 conditional 表评估为 true。

如果提供的 predicate 对于一对行(left, right)返回 NULL,则左行不包含在输出中。用户有责任选择合适的 compare_nulls 值并在表达式中使用适当的 null 安全运算符。

如果提供的 output size 或 per-row counts 不正确,则行为未定义。

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}
抛出:
  • cudf::data_type_error – 如果 binary predicate 输出非布尔结果。

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

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

参数:
  • left_equality – 用于相等连接的左表

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

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

  • right_conditional – 用于条件连接的右表

  • binary_predicate – 用于连接的条件

  • compare_nulls – 空值是否互相连接

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

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

返回:

一对向量 [left_indices, right_indices] ,可用于构建对四个输入表执行 mixed full join 的结果。

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())#

返回一个索引向量,对应于 left 表中所有满足以下条件的行:right 表中不存在满足 equality 表的列相等且 predicate 对 conditional 表评估为 true 的行。

如果提供的 predicate 对于一对行(left, right)返回 NULL,则左行不包含在输出中。用户有责任选择合适的 compare_nulls 值并在表达式中使用适当的 null 安全运算符。

如果提供的 output size 或 per-row counts 不正确,则行为未定义。

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}
抛出:
  • cudf::data_type_error – 如果 binary predicate 输出非布尔结果。

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

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

参数:
  • left_equality – 用于相等连接的左表

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

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

  • right_conditional – 用于条件连接的右表

  • binary_predicate – 用于连接的条件

  • compare_nulls – 空值是否互相连接

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

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

返回:

一对向量 [left_indices, right_indices] ,可用于构建对四个输入表执行 mixed full join 的结果。

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())#

返回执行 mixed inner join 时匹配(行)的确切数量,其中 equality 表的列相等,并且 predicate 对 conditional 表评估为 true。

如果提供的 predicate 对于一对行(left, right)返回 NULL,则该对不包含在输出中。用户有责任选择合适的 compare_nulls 值并在表达式中使用适当的 null 安全运算符。

抛出:
  • cudf::data_type_error – 如果 binary predicate 输出非布尔结果。

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

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

参数:
  • left_equality – 用于相等连接的左表

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

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

  • right_conditional – 用于条件连接的右表

  • binary_predicate – 用于连接的条件

  • compare_nulls – 空值是否互相连接

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

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

返回:

一个对,包含执行请求的 join 将产生的大小以及两个表中其中一个表中每行的匹配数。哪个表是实现细节,不应依赖,只需按原样传递给相应的 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())#

返回执行 mixed left join 时匹配(行)的确切数量,其中 equality 表的列相等,并且 predicate 对 conditional 表评估为 true。

如果提供的 predicate 对于一对行(left, right)返回 NULL,则该对不包含在输出中。用户有责任选择合适的 compare_nulls 值并在表达式中使用适当的 null 安全运算符。

抛出:
  • cudf::data_type_error – 如果 binary predicate 输出非布尔结果。

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

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

参数:
  • left_equality – 用于相等连接的左表

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

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

  • right_conditional – 用于条件连接的右表

  • binary_predicate – 用于连接的条件

  • compare_nulls – 空值是否互相连接

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

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

返回:

一个对,包含执行请求的 join 将产生的大小以及两个表中其中一个表中每行的匹配数。哪个表是实现细节,不应依赖,只需按原样传递给相应的 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())#

返回执行条件 inner join 时匹配(行)的确切数量,其中 predicate 评估为 true。

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

抛出:

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

参数:
  • left – 左表

  • right – 右表

  • binary_predicate – 用于连接的条件

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

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

返回:

执行请求的 join 将产生的大小

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())#

返回执行条件 left join 时匹配(行)的确切数量,其中 predicate 评估为 true。

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

抛出:

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

参数:
  • left – 左表

  • right – 右表

  • binary_predicate – 用于连接的条件

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

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

返回:

执行请求的 join 将产生的大小

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())#

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

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

抛出:

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

参数:
  • left – 左表

  • right – 右表

  • binary_predicate – 用于连接的条件

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

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

返回:

执行请求的 join 将产生的大小

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())#

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

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

抛出:

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

参数:
  • left – 左表

  • right – 右表

  • binary_predicate – 用于连接的条件

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

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

返回:

执行请求的 join 将产生的大小

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 所视图的表的生命周期,否则行为未定义。

参数:
  • 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 所视图的表的生命周期,否则行为未定义。

参数:
  • build – 构建表,用于构建哈希表

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

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

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

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 小于实际输出大小,则行为未定义。

参数:
  • probe – 探测表,用于探测元组

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

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

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

抛出:

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

返回:

一对列 [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 小于实际输出大小,则行为未定义。

参数:
  • probe – 探测表,用于探测元组

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

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

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

抛出:

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

返回:

一对列 [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 小于实际输出大小,则行为未定义。

参数:
  • probe – 探测表,用于探测元组

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

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

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

抛出:

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

返回:

一对列 [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#

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

参数:
  • probe – 探测表,用于探测元组

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

抛出:

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

返回:

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

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

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

参数:
  • probe – 探测表,用于探测元组

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

抛出:

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

返回:

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#

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

参数:
  • probe – 探测表,用于探测元组

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

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

抛出:

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

返回:

buildprobe 作为连接键的两个表之间执行全连接时的精确输出数量。

class distinct_hash_join#
#include <join.hpp>

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

该类实现了去重哈希连接方案,该方案一次构建哈希表,并根据需要(可能并行)多次探测。

注意

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

注意

所有 NaNs 都视为相等

公共函数

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

构造一个去重哈希连接对象,用于后续的探测调用。

参数:
  • build – 包含去重元素的构建表

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

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

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, 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().

参数:
  • probe – 探测表,用于探测键

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

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

返回:

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

std::unique_ptr<rmm::device_uvector<size_type>> left_join(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#

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

注意

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

参数:
  • probe – 探测表,用于探测键

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

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

返回:

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