Files | Classes | Functions

Files

file  join.hpp
 

Classes

class  cudf::hash_join
 Hash join that builds hash table in creation and probes results in subsequent *_join member functions. More...
 

Functions

std::unique_ptr< cudf::tablecudf::inner_join (cudf::table_view const &left, cudf::table_view const &right, std::vector< cudf::size_type > const &left_on, std::vector< cudf::size_type > const &right_on, std::vector< std::pair< cudf::size_type, cudf::size_type >> const &columns_in_common, null_equality compare_nulls=null_equality::EQUAL, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Performs an inner join on the specified columns of two tables (left, right) More...
 
std::unique_ptr< cudf::tablecudf::left_join (cudf::table_view const &left, cudf::table_view const &right, std::vector< cudf::size_type > const &left_on, std::vector< cudf::size_type > const &right_on, std::vector< std::pair< cudf::size_type, cudf::size_type >> const &columns_in_common, null_equality compare_nulls=null_equality::EQUAL, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Performs a left join (also known as left outer join) on the specified columns of two tables (left, right) More...
 
std::unique_ptr< cudf::tablecudf::full_join (cudf::table_view const &left, cudf::table_view const &right, std::vector< cudf::size_type > const &left_on, std::vector< cudf::size_type > const &right_on, std::vector< std::pair< cudf::size_type, cudf::size_type >> const &columns_in_common, null_equality compare_nulls=null_equality::EQUAL, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Performs a full join (also known as full outer join) on the specified columns of two tables (left, right) More...
 
std::unique_ptr< cudf::tablecudf::left_semi_join (cudf::table_view const &left, cudf::table_view const &right, std::vector< cudf::size_type > const &left_on, std::vector< cudf::size_type > const &right_on, std::vector< cudf::size_type > const &return_columns, null_equality compare_nulls=null_equality::EQUAL, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Performs a left semi join on the specified columns of two tables (left, right) More...
 
std::unique_ptr< cudf::tablecudf::left_anti_join (cudf::table_view const &left, cudf::table_view const &right, std::vector< cudf::size_type > const &left_on, std::vector< cudf::size_type > const &right_on, std::vector< cudf::size_type > const &return_columns, null_equality compare_nulls=null_equality::EQUAL, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Performs a left anti join on the specified columns of two tables (left, right) More...
 
std::unique_ptr< cudf::tablecudf::cross_join (cudf::table_view const &left, cudf::table_view const &right, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Performs a cross join on two tables (left, right) More...
 

Detailed Description

Function Documentation

◆ cross_join()

std::unique_ptr<cudf::table> cudf::cross_join ( cudf::table_view const &  left,
cudf::table_view const &  right,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Performs a cross join on two tables (left, right)

The cross join returns the cartesian product of rows from each table.

Note
Warning: This function can easily cause out-of-memory errors. The size of the output is equal to left.num_rows() * right.num_rows(). Use with caution.
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} }
Exceptions
cudf::logic_errorif the number of columns in either left or right table is 0
Parameters
leftThe left table
rightThe right table
mrDevice memory resource used to allocate the returned table's device memory
Returns
Result of cross joining left and right tables

◆ full_join()

std::unique_ptr<cudf::table> cudf::full_join ( cudf::table_view const &  left,
cudf::table_view const &  right,
std::vector< cudf::size_type > const &  left_on,
std::vector< cudf::size_type > const &  right_on,
std::vector< std::pair< cudf::size_type, cudf::size_type >> const &  columns_in_common,
null_equality  compare_nulls = null_equality::EQUAL,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Performs a full join (also known as full outer join) on the specified columns of two tables (left, right)

Full Join returns the rows that would be returned by a left join and those rows from the right table that do not have a match. For rows from the right table that do not have a match, the corresponding values in the left columns will be null.

Left a: {0, 1, 2}
Right b: {1, 2, 3}, c: {1, 2, 5}
left_on: {0}
right_on: {1}
columns_in_common: { {0, 1} }
Result: { a: {0, 1, 2, NULL}, b: {NULL, 1, 2, 3}, c: {NULL, 1, 2, 5} }
Left a: {0, 1, 2}
Right b: {1, 2, 3}, c: {1, 2, 5}
left_on: {0}
right_on: {0}
columns_in_common: { }
Result: { a: {0, 1, 2, NULL}, b: {NULL, 1, 2, 3}, c: {NULL, 1, 2, 5} }
Exceptions
cudf::logic_errorif columns_in_common contains a pair of indices (L, R) if L does not exist in left_on or R does not exist in right_on.
cudf::logic_errorif columns_in_common contains a pair of indices (L, R) such that the location of L within left_on is not equal to location of R within right_on
cudf::logic_errorif number of elements in left_on or right_on mismatch.
cudf::logic_errorif number of columns in either left or right table is 0 or exceeds MAX_JOIN_SIZE
std::out_of_rangeif element of left_on or right_on exceed the number of columns in the left or right table.
Parameters
[in]leftThe left table
[in]rightThe right table
[in]left_onThe column indices from left to join on. The column from left indicated by left_on[i] will be compared against the column from right indicated by right_on[i].
[in]right_onThe column indices from right to join on. The column from right indicated by right_on[i] will be compared against the column from left indicated by left_on[i].
[in]columns_in_commonis a vector of pairs of column indices into left and right, respectively, that are "in common". For "common" columns, only a single output column will be produced, which is gathered from left_on columns. Else, for every column in left_on and right_on, an output column will be produced. For each of these pairs (L, R), L should exist in left_on and R should exist in right_on.
[in]compare_nullscontrols whether null join-key values should match or not.
mrDevice memory resource used to allocate the returned table and columns' device memory
Returns
Result of joining left and right tables on the columns specified by left_on and right_on. The resulting table will be joined columns of left(including common columns)+right(excluding common columns).

◆ inner_join()

std::unique_ptr<cudf::table> cudf::inner_join ( cudf::table_view const &  left,
cudf::table_view const &  right,
std::vector< cudf::size_type > const &  left_on,
std::vector< cudf::size_type > const &  right_on,
std::vector< std::pair< cudf::size_type, cudf::size_type >> const &  columns_in_common,
null_equality  compare_nulls = null_equality::EQUAL,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Performs an inner join on the specified columns of two tables (left, right)

Inner Join returns rows from both tables as long as the values in the columns being joined on match.

Left a: {0, 1, 2}
Right b: {1, 2, 3}, a: {1, 2, 5}
left_on: {0}
right_on: {1}
columns_in_common: { {0, 1} }
Result: { a: {1, 2}, b: {1, 2} }
Left a: {0, 1, 2}
Right b: {1, 2, 3}, c: {1, 2, 5}
left_on: {0}
right_on: {0}
columns_in_common: { }
Result: { a: {1, 2}, b: {1, 2}, c: {1, 2} }
Exceptions
cudf::logic_errorif columns_in_common contains a pair of indices (L, R) if L does not exist in left_on or R does not exist in right_on.
cudf::logic_errorif columns_in_common contains a pair of indices (L, R) such that the location of L within left_on is not equal to location of R within right_on
cudf::logic_errorif number of elements in left_on or right_on mismatch.
cudf::logic_errorif number of columns in either left or right table is 0 or exceeds MAX_JOIN_SIZE
std::out_of_rangeif element of left_on or right_on exceed the number of columns in the left or right table.
Parameters
[in]leftThe left table
[in]rightThe right table
[in]left_onThe column indices from left to join on. The column from left indicated by left_on[i] will be compared against the column from right indicated by right_on[i].
[in]right_onThe column indices from right to join on. The column from right indicated by right_on[i] will be compared against the column from left indicated by left_on[i].
[in]columns_in_commonis a vector of pairs of column indices into left and right, respectively, that are "in common". For "common" columns, only a single output column will be produced, which is gathered from left_on columns. Else, for every column in left_on and right_on, an output column will be produced. For each of these pairs (L, R), L should exist in left_on and R should exist in right_on.
[in]compare_nullscontrols whether null join-key values should match or not.
mrDevice memory resource used to allocate the returned table and columns' device memory
Returns
Result of joining left and right tables on the columns specified by left_on and right_on. The resulting table will be joined columns of left(including common columns)+right(excluding common columns).

◆ left_anti_join()

std::unique_ptr<cudf::table> cudf::left_anti_join ( cudf::table_view const &  left,
cudf::table_view const &  right,
std::vector< cudf::size_type > const &  left_on,
std::vector< cudf::size_type > const &  right_on,
std::vector< cudf::size_type > const &  return_columns,
null_equality  compare_nulls = null_equality::EQUAL,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Performs a left anti join on the specified columns of two tables (left, right)

A left anti join only returns data from the left table, and only returns rows that do not exist in the right table.

TableA a: {0, 1, 2}
TableB b: {1, 2, 3}, a: {1, 2, 5}
left_on: {0}
right_on: {1}
return_columns: { 0 }
Result: { a: {0} }
TableA a: {0, 1, 2}, c: {1, 2, 5}
TableB b: {1, 2, 3}
left_on: {0}
right_on: {0}
return_columns: { 1 }
Result: { c: {1} }
Exceptions
cudf::logic_errorif the number of columns in either left or right table is 0
cudf::logic_errorif the number of returned columns is 0
cudf::logic_errorif the number of elements in left_on and right_on are not equal
Parameters
[in]leftThe left table
[in]rightThe right table
[in]left_onThe column indices from left to join on. The column from left indicated by left_on[i] will be compared against the column from right indicated by right_on[i].
[in]right_onThe column indices from right to join on. The column from right indicated by right_on[i] will be compared against the column from left indicated by left_on[i].
[in]return_columnsA vector of column indices from left to include in the returned table.
[in]compare_nullsControls whether null join-key values should match or not.
[in]mrDevice memory resource used to allocate the returned table's device memory
Returns
Result of joining left and right tables on the columns specified by left_on and right_on. The resulting table will contain return_columns from left that match in right.

◆ left_join()

std::unique_ptr<cudf::table> cudf::left_join ( cudf::table_view const &  left,
cudf::table_view const &  right,
std::vector< cudf::size_type > const &  left_on,
std::vector< cudf::size_type > const &  right_on,
std::vector< std::pair< cudf::size_type, cudf::size_type >> const &  columns_in_common,
null_equality  compare_nulls = null_equality::EQUAL,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Performs a left join (also known as left outer join) on the specified columns of two tables (left, right)

Left Join returns all the rows from the left table and those rows from the right table that match on the joined columns. For rows from the right table that do not have a match, the corresponding values in the left columns will be null.

Left a: {0, 1, 2}
Right b: {1, 2, 3}, a: {1 ,2 ,5}
left_on: {0}
right_on: {1}
columns_in_common: { {0, 1} }
Result: { a: {0, 1, 2}, b: {NULL, 1, 2} }
Left a: {0, 1, 2}
Right b: {1, 2, 3}, c: {1, 2, 5}
left_on: {0}
right_on: {0}
columns_in_common: { }
Result: { a: {0, 1, 2}, b: {NULL, 1, 2}, c: {NULL, 1, 2} }
Exceptions
cudf::logic_errorif columns_in_common contains a pair of indices (L, R) if L does not exist in left_on or R does not exist in right_on.
cudf::logic_errorif columns_in_common contains a pair of indices (L, R) such that the location of L within left_on is not equal to location of R within right_on
cudf::logic_errorif number of elements in left_on or right_on mismatch.
cudf::logic_errorif number of columns in either left or right table is 0 or exceeds MAX_JOIN_SIZE
std::out_of_rangeif element of left_on or right_on exceed the number of columns in the left or right table.
Parameters
[in]leftThe left table
[in]rightThe right table
[in]left_onThe column indices from left to join on. The column from left indicated by left_on[i] will be compared against the column from right indicated by right_on[i].
[in]right_onThe column indices from right to join on. The column from right indicated by right_on[i] will be compared against the column from left indicated by left_on[i].
[in]columns_in_commonis a vector of pairs of column indices into left and right, respectively, that are "in common". For "common" columns, only a single output column will be produced, which is gathered from left_on columns. Else, for every column in left_on and right_on, an output column will be produced. For each of these pairs (L, R), L should exist in left_on and R should exist in right_on.
[in]compare_nullscontrols whether null join-key values should match or not.
mrDevice memory resource used to allocate the returned table and columns' device memory
Returns
Result of joining left and right tables on the columns specified by left_on and right_on. The resulting table will be joined columns of left(including common columns)+right(excluding common columns).

◆ left_semi_join()

std::unique_ptr<cudf::table> cudf::left_semi_join ( cudf::table_view const &  left,
cudf::table_view const &  right,
std::vector< cudf::size_type > const &  left_on,
std::vector< cudf::size_type > const &  right_on,
std::vector< cudf::size_type > const &  return_columns,
null_equality  compare_nulls = null_equality::EQUAL,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Performs a left semi join on the specified columns of two tables (left, right)

A left semi join only returns data from the left table, and only returns rows that exist in the right table.

TableA a: {0, 1, 2}
TableB b: {1, 2, 3}, a: {1, 2, 5}
left_on: {0}
right_on: {1}
return_columns: { 0 }
Result: { a: {1, 2} }
TableA a: {0, 1, 2}, c: {1, 2, 5}
TableB b: {1, 2, 3}
left_on: {0}
right_on: {0}
return_columns: { 1 }
Result: { c: {1, 2} }
Exceptions
cudf::logic_errorif the number of columns in either left or right table is 0
cudf::logic_errorif the number of returned columns is 0
cudf::logic_errorif the number of elements in left_on and right_on are not equal
Parameters
[in]leftThe left table
[in]rightThe right table
[in]left_onThe column indices from left to join on. The column from left indicated by left_on[i] will be compared against the column from right indicated by right_on[i].
[in]right_onThe column indices from right to join on. The column from right indicated by right_on[i] will be compared against the column from left indicated by left_on[i].
[in]return_columnsA vector of column indices from left to include in the returned table.
[in]compare_nullsControls whether null join-key values should match or not.
[in]mrDevice memory resource used to allocate the returned table's device memory
Returns
Result of joining left and right tables on the columns specified by left_on and right_on. The resulting table will contain return_columns from left that match in right.