Skip to content

Commit dda76ab

Browse files
committed
fix: build ffi crate with new arrow features
Signed-off-by: R. Tyler Croy <[email protected]>
1 parent cac3f55 commit dda76ab

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

ffi/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ tracing-core = { version = "0.1", optional = true }
2222
tracing-subscriber = { version = "0.3", optional = true, features = [ "json" ] }
2323
url = "2"
2424
delta_kernel = { path = "../kernel", default-features = false, features = [
25+
"arrow",
2526
"developer-visibility",
2627
] }
2728
delta_kernel_ffi_macros = { path = "../ffi-proc-macros", version = "0.7.0" }

ffi/src/engine_data.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
//! EngineData related ffi code
22
3+
use delta_kernel::arrow::array::{
4+
ffi::{FFI_ArrowArray, FFI_ArrowSchema},
5+
ArrayData, StructArray,
6+
};
37
use delta_kernel::{DeltaResult, EngineData};
48
use std::ffi::c_void;
59

@@ -45,8 +49,8 @@ unsafe fn get_raw_engine_data_impl(data: &mut Handle<ExclusiveEngineData>) -> &m
4549
#[cfg(feature = "default-engine")]
4650
#[repr(C)]
4751
pub struct ArrowFFIData {
48-
pub array: arrow_data::ffi::FFI_ArrowArray,
49-
pub schema: arrow_schema::ffi::FFI_ArrowSchema,
52+
pub array: FFI_ArrowArray,
53+
pub schema: FFI_ArrowSchema,
5054
}
5155

5256
// TODO: This should use a callback to avoid having to have the engine free the struct
@@ -71,16 +75,16 @@ pub unsafe extern "C" fn get_raw_arrow_data(
7175
// TODO: This method leaks the returned pointer memory. How will the engine free it?
7276
#[cfg(feature = "default-engine")]
7377
fn get_raw_arrow_data_impl(data: Box<dyn EngineData>) -> DeltaResult<*mut ArrowFFIData> {
74-
let record_batch: arrow_array::RecordBatch = data
78+
let record_batch: delta_kernel::arrow::array::RecordBatch = data
7579
.into_any()
7680
.downcast::<delta_kernel::engine::arrow_data::ArrowEngineData>()
7781
.map_err(|_| delta_kernel::Error::EngineDataType("ArrowEngineData".to_string()))?
7882
.into();
79-
let sa: arrow_array::StructArray = record_batch.into();
80-
let array_data: arrow_data::ArrayData = sa.into();
83+
let sa: StructArray = record_batch.into();
84+
let array_data: ArrayData = sa.into();
8185
// these call `clone`. is there a way to not copy anything and what exactly are they cloning?
82-
let array = arrow_data::ffi::FFI_ArrowArray::new(&array_data);
83-
let schema = arrow_schema::ffi::FFI_ArrowSchema::try_from(array_data.data_type())?;
86+
let array = FFI_ArrowArray::new(&array_data);
87+
let schema = FFI_ArrowSchema::try_from(array_data.data_type())?;
8488
let ret_data = Box::new(ArrowFFIData { array, schema });
8589
Ok(Box::leak(ret_data))
8690
}

kernel/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ tempfile = { version = "3", optional = true }
6262
# Arrow supported versions
6363
## 53
6464
# Used in default engine
65-
arrow_53 = { package = "arrow", version = "53", features = ["chrono-tz", "json", "prettyprint"], optional = true }
65+
arrow_53 = { package = "arrow", version = "53", features = ["chrono-tz", "ffi", "json", "prettyprint"], optional = true }
6666
# Used in default and sync engine
6767
parquet_53 = { package = "parquet", version = "53", features = ["async", "object_store"] , optional = true }
6868
######
6969
## 54
70-
arrow_54 = { package = "arrow", version = "54", features = ["chrono-tz", "json", "prettyprint"], optional = true }
70+
arrow_54 = { package = "arrow", version = "54", features = ["chrono-tz", "ffi", "json", "prettyprint"], optional = true }
7171
parquet_54 = { package = "parquet", version = "54", features = ["async", "object_store"] , optional = true }
7272
######
7373

0 commit comments

Comments
 (0)