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

Function test_generic_string

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

Source from the content-addressed store, hash-verified

754 }
755
756 fn test_generic_string<Offset: OffsetSizeTrait>() -> Result<()> {
757 // create an array natively
758 let array = GenericStringArray::<Offset>::from(vec![Some("a"), None, Some("aaa")]);
759
760 // export it
761 let (array, schema) = to_ffi(&array.to_data())?;
762
763 // (simulate consumer) import it
764 let data = unsafe { from_ffi(array, &schema) }?;
765 let array = make_array(data);
766
767 // perform some operation
768 let array = array
769 .as_any()
770 .downcast_ref::<GenericStringArray<Offset>>()
771 .unwrap();
772
773 // verify
774 let expected = GenericStringArray::<Offset>::from(vec![Some("a"), None, Some("aaa")]);
775 assert_eq!(array, &expected);
776
777 // (drop/release)
778 Ok(())
779 }
780
781 #[test]
782 fn test_string() -> 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