MCPcopy Create free account
hub / github.com/apache/arrow-rs / from_ffi

Function from_ffi

arrow-array/src/ffi.rs:282–298  ·  view source on GitHub ↗

Import [ArrayData] from the C Data Interface # Safety This struct assumes that the incoming data agrees with the C data interface.

(array: FFI_ArrowArray, schema: &FFI_ArrowSchema)

Source from the content-addressed store, hash-verified

280///
281/// This struct assumes that the incoming data agrees with the C data interface.
282pub unsafe fn from_ffi(array: FFI_ArrowArray, schema: &FFI_ArrowSchema) -> Result<ArrayData> {
283 let dt = DataType::try_from(schema)?;
284 let array = Arc::new(array);
285 let tmp = ImportedArrowArray {
286 array: &array,
287 data_type: dt,
288 owner: &array,
289 };
290 let mut data = tmp.consume()?;
291 // arrow-rs has stricter alignment requirements than the C Data Interface spec;
292 // a no-op when buffers are already aligned. Unreachable under
293 // `cfg(feature = "force_validate")`; tracked in #10034.
294 // See https://github.com/apache/arrow/issues/43552 and
295 // https://github.com/apache/arrow-rs/issues/10028 for context.
296 data.align_buffers();
297 Ok(data)
298}
299
300/// Import [ArrayData] from the C Data Interface
301///

Callers 15

_test_round_trip_exportFunction · 0.85
test_round_tripFunction · 0.85
test_importFunction · 0.85
test_decimal_round_tripFunction · 0.85
test_generic_stringFunction · 0.85
test_generic_listFunction · 0.85
test_generic_list_viewFunction · 0.85
test_generic_binaryFunction · 0.85
test_boolFunction · 0.85
test_time32Function · 0.85

Calls 2

align_buffersMethod · 0.80
consumeMethod · 0.45

Tested by 15

test_round_tripFunction · 0.68
test_importFunction · 0.68
test_decimal_round_tripFunction · 0.68
test_generic_stringFunction · 0.68
test_generic_listFunction · 0.68
test_generic_list_viewFunction · 0.68
test_generic_binaryFunction · 0.68
test_boolFunction · 0.68
test_time32Function · 0.68
test_timestampFunction · 0.68