1818use crate :: { make_array, new_null_array, Array , ArrayRef , RecordBatch } ;
1919use arrow_buffer:: { BooleanBuffer , Buffer , NullBuffer } ;
2020use arrow_data:: { ArrayData , ArrayDataBuilder } ;
21- use arrow_schema:: { ArrowError , DataType , Field , FieldRef , Fields , SchemaBuilder } ;
21+ use arrow_schema:: { ArrowError , DataType , Field , FieldRef , Fields } ;
2222use std:: sync:: Arc ;
2323use std:: { any:: Any , ops:: Index } ;
2424
@@ -326,7 +326,7 @@ impl TryFrom<Vec<(&str, ArrayRef)>> for StructArray {
326326
327327 /// builds a StructArray from a vector of names and arrays.
328328 fn try_from ( values : Vec < ( & str , ArrayRef ) > ) -> Result < Self , ArrowError > {
329- let ( schema , arrays) : ( SchemaBuilder , _ ) = values
329+ let ( fields , arrays) : ( Vec < _ > , _ ) = values
330330 . into_iter ( )
331331 . map ( |( name, array) | {
332332 (
@@ -336,7 +336,7 @@ impl TryFrom<Vec<(&str, ArrayRef)>> for StructArray {
336336 } )
337337 . unzip ( ) ;
338338
339- StructArray :: try_new ( schema . finish ( ) . fields , arrays, None )
339+ StructArray :: try_new ( fields . into ( ) , arrays, None )
340340 }
341341}
342342
@@ -397,8 +397,8 @@ impl Array for StructArray {
397397
398398impl From < Vec < ( FieldRef , ArrayRef ) > > for StructArray {
399399 fn from ( v : Vec < ( FieldRef , ArrayRef ) > ) -> Self {
400- let ( schema , arrays) : ( SchemaBuilder , _ ) = v. into_iter ( ) . unzip ( ) ;
401- StructArray :: new ( schema . finish ( ) . fields , arrays, None )
400+ let ( fields , arrays) : ( Vec < _ > , _ ) = v. into_iter ( ) . unzip ( ) ;
401+ StructArray :: new ( fields . into ( ) , arrays, None )
402402 }
403403}
404404
@@ -424,9 +424,9 @@ impl std::fmt::Debug for StructArray {
424424impl From < ( Vec < ( FieldRef , ArrayRef ) > , Buffer ) > for StructArray {
425425 fn from ( pair : ( Vec < ( FieldRef , ArrayRef ) > , Buffer ) ) -> Self {
426426 let len = pair. 0 . first ( ) . map ( |x| x. 1 . len ( ) ) . unwrap_or_default ( ) ;
427- let ( fields, arrays) : ( SchemaBuilder , Vec < _ > ) = pair. 0 . into_iter ( ) . unzip ( ) ;
427+ let ( fields, arrays) : ( Vec < _ > , Vec < _ > ) = pair. 0 . into_iter ( ) . unzip ( ) ;
428428 let nulls = NullBuffer :: new ( BooleanBuffer :: new ( pair. 1 , 0 , len) ) ;
429- Self :: new ( fields. finish ( ) . fields , arrays, Some ( nulls) )
429+ Self :: new ( fields. into ( ) , arrays, Some ( nulls) )
430430 }
431431}
432432
0 commit comments