Skip to content

Commit ddd8792

Browse files
authored
[c] Support vector search materialized read in C FFI bindings (#537)
1 parent ae62146 commit ddd8792

13 files changed

Lines changed: 2030 additions & 95 deletions

bindings/c/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ futures = "0.3"
3535
arrow = { workspace = true }
3636
arrow-array = { workspace = true }
3737
arrow-schema = { workspace = true }
38+
39+
[dev-dependencies]
40+
# Test-only: the vector-search integration tests build a real primary-key vindex
41+
# IVF-flat ANN segment fixture in-process. Versions match crates/paimon.
42+
bytes = "1.7.1"
43+
paimon-vindex-core = "0.2.0"

bindings/c/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ mod table;
2727
#[cfg(test)]
2828
mod tests;
2929
mod types;
30+
mod vector_search;
3031
mod write;
3132

3233
use std::sync::OnceLock;

bindings/c/src/result.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ pub struct paimon_result_next_batch {
7878
pub error: *mut paimon_error,
7979
}
8080

81+
#[repr(C)]
82+
pub struct paimon_result_vector_search_builder {
83+
pub builder: *mut paimon_vector_search_builder,
84+
pub error: *mut paimon_error,
85+
}
86+
8187
// === Write/Commit result types ===
8288

8389
#[repr(C)]

bindings/c/src/table.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,8 @@ pub unsafe extern "C" fn paimon_record_batch_reader_next(
658658
/// Free a paimon_record_batch_reader.
659659
///
660660
/// # Safety
661-
/// Only call with a reader returned from `paimon_table_read_to_arrow`.
661+
/// Only call with a reader returned from `paimon_table_read_to_arrow` or
662+
/// `paimon_vector_search_builder_execute_read`.
662663
#[no_mangle]
663664
pub unsafe extern "C" fn paimon_record_batch_reader_free(reader: *mut paimon_record_batch_reader) {
664665
if !reader.is_null() {

0 commit comments

Comments
 (0)