| 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() { |