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

Function test_dictionary_hydration_known_schema

arrow-flight/src/encode.rs:897–918  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

895
896 #[tokio::test]
897 async fn test_dictionary_hydration_known_schema() {
898 let arr1: DictionaryArray<UInt16Type> = vec!["a", "a", "b"].into_iter().collect();
899 let arr2: DictionaryArray<UInt16Type> = vec!["c", "c", "d"].into_iter().collect();
900
901 let schema = Arc::new(Schema::new(vec![Field::new_dictionary(
902 "dict",
903 DataType::UInt16,
904 DataType::Utf8,
905 false,
906 )]));
907 let batch1 = RecordBatch::try_new(schema.clone(), vec![Arc::new(arr1)]).unwrap();
908 let batch2 = RecordBatch::try_new(schema.clone(), vec![Arc::new(arr2)]).unwrap();
909
910 let stream = futures::stream::iter(vec![Ok(batch1), Ok(batch2)]);
911
912 let encoder = FlightDataEncoderBuilder::default()
913 .with_schema(schema)
914 .build(stream);
915 let expected_schema =
916 Arc::new(Schema::new(vec![Field::new("dict", DataType::Utf8, false)]));
917 assert_eq!(Some(expected_schema), encoder.known_schema())
918 }
919
920 #[tokio::test]
921 async fn test_dictionary_resend_known_schema() {

Callers

nothing calls this directly

Calls 7

try_newFunction · 0.85
defaultFunction · 0.85
collectMethod · 0.80
into_iterMethod · 0.45
cloneMethod · 0.45
buildMethod · 0.45
with_schemaMethod · 0.45

Tested by

no test coverage detected