1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! Bridge definitions for libcudf join operations.
//!
//! Join functions return gather maps (index columns) that can be used
//! to construct the joined table via `gather()`.
#[cxx::bridge(namespace = "cudf_shims")]
pub mod ffi {
unsafe extern "C++" {
include!("join_shim.h");
include!("table_shim.h");
type OwnedTable = crate::table::ffi::OwnedTable;
/// Inner join: returns a 2-column table [left_indices, right_indices].
fn inner_join(
left_keys: &OwnedTable,
right_keys: &OwnedTable,
) -> Result<UniquePtr<OwnedTable>>;
/// Left join: returns a 2-column table [left_indices, right_indices].
fn left_join(
left_keys: &OwnedTable,
right_keys: &OwnedTable,
) -> Result<UniquePtr<OwnedTable>>;
/// Full outer join: returns a 2-column table [left_indices, right_indices].
fn full_join(
left_keys: &OwnedTable,
right_keys: &OwnedTable,
) -> Result<UniquePtr<OwnedTable>>;
/// Cross join: cartesian product of two tables.
fn cross_join(left: &OwnedTable, right: &OwnedTable) -> Result<UniquePtr<OwnedTable>>;
/// Left semi join: returns a 1-column table [left_indices].
/// Only left rows with a match in right are included.
fn left_semi_join(
left_keys: &OwnedTable,
right_keys: &OwnedTable,
) -> Result<UniquePtr<OwnedTable>>;
/// Left anti join: returns a 1-column table [left_indices].
/// Only left rows with NO match in right are included.
fn left_anti_join(
left_keys: &OwnedTable,
right_keys: &OwnedTable,
) -> Result<UniquePtr<OwnedTable>>;
/// Mark semi join: returns a 1-column table [left_indices].
/// The underlying libcudf mark_join builds from the left table.
fn mark_semi_join(
left_keys: &OwnedTable,
right_keys: &OwnedTable,
) -> Result<UniquePtr<OwnedTable>>;
/// Mark anti join: returns a 1-column table [left_indices].
/// The underlying libcudf mark_join builds from the left table.
fn mark_anti_join(
left_keys: &OwnedTable,
right_keys: &OwnedTable,
) -> Result<UniquePtr<OwnedTable>>;
// ── Hash Join ─────────────────────────────────────────────
/// Opaque hash join object (pre-hashed build table).
type OwnedHashJoin;
/// Create a hash join from the build (right) table keys.
fn hash_join_create(build: &OwnedTable) -> Result<UniquePtr<OwnedHashJoin>>;
/// Inner join via hash join, returning gather maps.
fn hash_join_inner(hj: &OwnedHashJoin, probe: &OwnedTable)
-> Result<UniquePtr<OwnedTable>>;
/// Left join via hash join, returning gather maps.
fn hash_join_left(hj: &OwnedHashJoin, probe: &OwnedTable) -> Result<UniquePtr<OwnedTable>>;
/// Full outer join via hash join, returning gather maps.
fn hash_join_full(hj: &OwnedHashJoin, probe: &OwnedTable) -> Result<UniquePtr<OwnedTable>>;
/// Estimated output size for inner join.
fn hash_join_inner_size(hj: &OwnedHashJoin, probe: &OwnedTable) -> Result<i64>;
/// Estimated output size for left join.
fn hash_join_left_size(hj: &OwnedHashJoin, probe: &OwnedTable) -> Result<i64>;
/// Estimated output size for full join.
fn hash_join_full_size(hj: &OwnedHashJoin, probe: &OwnedTable) -> Result<i64>;
}
}