@@ -78,7 +78,7 @@ pub(crate) fn coerce_timestamp_columns(
7878/// the target's timezone in the coerced schema.
7979struct TimestampTzCoercionVisitor < ' a > {
8080 target_schema : & ' a ArrowSchemaRef ,
81- field_stack : Vec < Field > ,
81+ field_stack : Vec < FieldRef > ,
8282 target_field_stack : Vec < DataType > ,
8383 changed : bool ,
8484}
@@ -103,7 +103,7 @@ impl ArrowSchemaVisitor for TimestampTzCoercionVisitor<'_> {
103103 type U = ArrowSchema ;
104104
105105 fn before_field ( & mut self , field : & FieldRef ) -> Result < ( ) > {
106- self . field_stack . push ( field. as_ref ( ) . clone ( ) ) ;
106+ self . field_stack . push ( field. clone ( ) ) ;
107107
108108 let target_type = if self . target_field_stack . is_empty ( ) {
109109 self . target_schema
@@ -130,7 +130,7 @@ impl ArrowSchemaVisitor for TimestampTzCoercionVisitor<'_> {
130130 }
131131
132132 fn before_list_element ( & mut self , field : & FieldRef ) -> Result < ( ) > {
133- self . field_stack . push ( field. as_ref ( ) . clone ( ) ) ;
133+ self . field_stack . push ( field. clone ( ) ) ;
134134 let target_type = match self . target_field_stack . last ( ) {
135135 Some ( DataType :: List ( f) | DataType :: LargeList ( f) | DataType :: FixedSizeList ( f, _) ) => {
136136 f. data_type ( ) . clone ( )
@@ -148,7 +148,7 @@ impl ArrowSchemaVisitor for TimestampTzCoercionVisitor<'_> {
148148 }
149149
150150 fn before_map_key ( & mut self , field : & FieldRef ) -> Result < ( ) > {
151- self . field_stack . push ( field. as_ref ( ) . clone ( ) ) ;
151+ self . field_stack . push ( field. clone ( ) ) ;
152152 let target_type = match self . target_field_stack . last ( ) {
153153 Some ( DataType :: Map ( entries, _) ) => match entries. data_type ( ) {
154154 DataType :: Struct ( fields) if fields. len ( ) == 2 => fields[ 0 ] . data_type ( ) . clone ( ) ,
@@ -167,7 +167,7 @@ impl ArrowSchemaVisitor for TimestampTzCoercionVisitor<'_> {
167167 }
168168
169169 fn before_map_value ( & mut self , field : & FieldRef ) -> Result < ( ) > {
170- self . field_stack . push ( field. as_ref ( ) . clone ( ) ) ;
170+ self . field_stack . push ( field. clone ( ) ) ;
171171 let target_type = match self . target_field_stack . last ( ) {
172172 Some ( DataType :: Map ( entries, _) ) => match entries. data_type ( ) {
173173 DataType :: Struct ( fields) if fields. len ( ) == 2 => fields[ 1 ] . data_type ( ) . clone ( ) ,
0 commit comments