File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,6 @@ impl fmt::Display for DataType {
166166 }
167167}
168168
169-
170169#[ cfg( test) ]
171170mod tests {
172171
@@ -266,4 +265,22 @@ mod tests {
266265 "FixedSizeList(4 x nullable Int32, metadata: {\" key2\" : \" value2\" })" ;
267266 assert_eq ! ( fixed_size_metadata_string, expected_metadata_string) ;
268267 }
268+
269+ #[ test]
270+ fn test_display_union ( ) {
271+ let fields = vec ! [
272+ Field :: new( "a" , DataType :: Int32 , false ) ,
273+ Field :: new( "b" , DataType :: Utf8 , true ) ,
274+ ] ;
275+ let type_ids = vec ! [ 0 , 1 ] ;
276+ let union_fields = type_ids
277+ . into_iter ( )
278+ . zip ( fields. into_iter ( ) . map ( Arc :: new) )
279+ . collect ( ) ;
280+
281+ let union_data_type = DataType :: Union ( union_fields, crate :: UnionMode :: Sparse ) ;
282+ let union_data_type_string = union_data_type. to_string ( ) ;
283+ let expected_string = "Union(Sparse, 0: Int32, 1: nullable Utf8)" ;
284+ assert_eq ! ( union_data_type_string, expected_string) ;
285+ }
269286}
You can’t perform that action at this time.
0 commit comments