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

Function test_generic_binary

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

Source from the content-addressed store, hash-verified

917 }
918
919 fn test_generic_binary<Offset: OffsetSizeTrait>() -> Result<()> {
920 // create an array natively
921 let array: Vec<Option<&[u8]>> = vec![Some(b"a"), None, Some(b"aaa")];
922 let array = GenericBinaryArray::<Offset>::from(array);
923
924 // export it
925 let (array, schema) = to_ffi(&array.to_data())?;
926
927 // (simulate consumer) import it
928 let data = unsafe { from_ffi(array, &schema) }?;
929 let array = make_array(data);
930 let array = array
931 .as_any()
932 .downcast_ref::<GenericBinaryArray<Offset>>()
933 .unwrap();
934
935 // verify
936 let expected: Vec<Option<&[u8]>> = vec![Some(b"a"), None, Some(b"aaa")];
937 let expected = GenericBinaryArray::<Offset>::from(expected);
938 assert_eq!(array, &expected);
939
940 // (drop/release)
941 Ok(())
942 }
943
944 #[test]
945 fn test_binary() -> Result<()> {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected