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
//! Bridge definitions for libcudf partitioning operations.
//!
//! Provides GPU-accelerated hash and round-robin partitioning of tables.
#[cxx::bridge(namespace = "cudf_shims")]
pub mod ffi {
unsafe extern "C++" {
include!("partitioning_shim.h");
include!("table_shim.h");
include!("column_shim.h");
type OwnedTable = crate::table::ffi::OwnedTable;
type OwnedColumn = crate::column::ffi::OwnedColumn;
/// Partition a table by hashing the specified columns.
/// Returns a PartitionResult with the reordered table and offsets.
fn hash_partition(
table: &OwnedTable,
columns_to_hash: &[i32],
num_partitions: i32,
) -> Result<UniquePtr<PartitionResult>>;
/// Partition a table using round-robin assignment.
/// Returns a PartitionResult with the reordered table and offsets.
fn round_robin_partition(
table: &OwnedTable,
num_partitions: i32,
) -> Result<UniquePtr<PartitionResult>>;
// ── Partition by map ──────────────────────────────────────
/// Opaque result type for partition (table + offsets).
type PartitionResult;
fn num_offsets(self: &PartitionResult) -> i32;
fn get_offset(self: &PartitionResult, index: i32) -> i32;
/// Partition a table using a partition map column.
fn partition(
table: &OwnedTable,
partition_map: &OwnedColumn,
num_partitions: i32,
) -> Result<UniquePtr<PartitionResult>>;
/// Extract the table from a PartitionResult.
fn partition_result_table(
result: UniquePtr<PartitionResult>,
) -> Result<UniquePtr<OwnedTable>>;
/// Get the offsets from a PartitionResult.
fn partition_result_offsets(result: &PartitionResult) -> Vec<i32>;
}
}