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

Function test_round_trip_with_offset

arrow-array/src/ffi.rs:642–660  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

640
641 #[test]
642 fn test_round_trip_with_offset() -> Result<()> {
643 // create an array natively
644 let array = Int32Array::from(vec![Some(1), Some(2), None, Some(3), None]);
645
646 let array = array.slice(1, 2);
647
648 // export it
649 let (array, schema) = to_ffi(&array.to_data())?;
650
651 // (simulate consumer) import it
652 let data = unsafe { from_ffi(array, &schema) }?;
653 let array = make_array(data);
654 let array = array.as_any().downcast_ref::<Int32Array>().unwrap();
655
656 assert_eq!(array, &Int32Array::from(vec![Some(2), None]));
657
658 // (drop/release)
659 Ok(())
660 }
661
662 #[test]
663 #[cfg(not(feature = "force_validate"))]

Callers

nothing calls this directly

Calls 6

to_ffiFunction · 0.85
from_ffiFunction · 0.85
make_arrayFunction · 0.50
sliceMethod · 0.45
to_dataMethod · 0.45
as_anyMethod · 0.45

Tested by

no test coverage detected