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

Function test_dictionary_struct_resend

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

Source from the content-addressed store, hash-verified

1134
1135 #[tokio::test]
1136 async fn test_dictionary_struct_resend() {
1137 let struct_fields = vec![Field::new_list(
1138 "dict_list",
1139 Field::new_dictionary("item", DataType::UInt16, DataType::Utf8, true),
1140 true,
1141 )];
1142
1143 let mut struct_builder = StructBuilder::new(
1144 struct_fields.clone(),
1145 vec![Box::new(builder::ListBuilder::new(
1146 StringDictionaryBuilder::<UInt16Type>::new(),
1147 ))],
1148 );
1149
1150 struct_builder.field_builder::<ListBuilder<GenericByteDictionaryBuilder<UInt16Type,GenericStringType<i32>>>>(0)
1151 .unwrap()
1152 .append_value(vec![Some("a"), None, Some("b")]);
1153 struct_builder.append(true);
1154
1155 let arr1 = struct_builder.finish();
1156
1157 struct_builder.field_builder::<ListBuilder<GenericByteDictionaryBuilder<UInt16Type,GenericStringType<i32>>>>(0)
1158 .unwrap()
1159 .append_value(vec![Some("c"), None, Some("d")]);
1160 struct_builder.append(true);
1161
1162 let arr2 = struct_builder.finish();
1163
1164 let schema = Arc::new(Schema::new(vec![Field::new_struct(
1165 "struct",
1166 struct_fields,
1167 true,
1168 )]));
1169
1170 let batch1 = RecordBatch::try_new(schema.clone(), vec![Arc::new(arr1)]).unwrap();
1171 let batch2 = RecordBatch::try_new(schema, vec![Arc::new(arr2)]).unwrap();
1172
1173 verify_flight_round_trip(vec![batch1, batch2]).await;
1174 }
1175
1176 #[tokio::test]
1177 async fn test_dictionary_union_hydration() {

Callers

nothing calls this directly

Calls 6

try_newFunction · 0.85
verify_flight_round_tripFunction · 0.85
cloneMethod · 0.45
append_valueMethod · 0.45
appendMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected