@@ -29,10 +29,7 @@ use futures::{StreamExt, stream};
29
29
use crate :: Result ;
30
30
use crate :: arrow:: schema_to_arrow_schema;
31
31
use crate :: scan:: ArrowRecordBatchStream ;
32
- use crate :: spec:: {
33
- Datum , FieldSummary , ListType , NestedField , PartitionSpecRef , PrimitiveType , Schema ,
34
- StructType , Type ,
35
- } ;
32
+ use crate :: spec:: { Datum , FieldSummary , ListType , NestedField , PrimitiveType , StructType , Type } ;
36
33
use crate :: table:: Table ;
37
34
38
35
/// Manifests table.
@@ -184,14 +181,19 @@ impl<'a> ManifestsTable<'a> {
184
181
. append_value ( manifest. existing_files_count . unwrap_or ( 0 ) as i32 ) ;
185
182
deleted_delete_files_count
186
183
. append_value ( manifest. deleted_files_count . unwrap_or ( 0 ) as i32 ) ;
184
+
185
+ let spec = self
186
+ . table
187
+ . metadata ( )
188
+ . partition_spec_by_id ( manifest. partition_spec_id )
189
+ . unwrap ( ) ;
190
+ let spec_struct = spec
191
+ . partition_type ( self . table . metadata ( ) . current_schema ( ) )
192
+ . unwrap ( ) ;
187
193
self . append_partition_summaries (
188
194
& mut partition_summaries,
189
195
& manifest. partitions . clone ( ) . unwrap_or_else ( Vec :: new) ,
190
- & self . schema ( ) ,
191
- & self
192
- . table
193
- . metadata ( )
194
- . partition_spec_by_id ( manifest. partition_spec_id ) ,
196
+ spec_struct,
195
197
) ;
196
198
}
197
199
}
@@ -241,11 +243,10 @@ impl<'a> ManifestsTable<'a> {
241
243
& self ,
242
244
builder : & mut GenericListBuilder < i32 , StructBuilder > ,
243
245
partitions : & [ FieldSummary ] ,
244
- schema : & Schema ,
245
- spec : & Option < & PartitionSpecRef > ,
246
+ partition_struct : StructType ,
246
247
) {
247
248
let partition_summaries_builder = builder. values ( ) ;
248
- for ( summary, field) in partitions. iter ( ) . zip ( spec . unwrap ( ) . fields ( ) ) {
249
+ for ( summary, field) in partitions. iter ( ) . zip ( partition_struct . fields ( ) ) {
249
250
partition_summaries_builder
250
251
. field_builder :: < BooleanBuilder > ( 0 )
251
252
. unwrap ( )
@@ -255,25 +256,19 @@ impl<'a> ManifestsTable<'a> {
255
256
. unwrap ( )
256
257
. append_option ( summary. contains_nan ) ;
257
258
258
- let field_type = schema
259
- . field_by_id ( field. source_id )
260
- . unwrap ( )
261
- . field_type
262
- . as_primitive_type ( )
263
- . unwrap ( ) ;
264
259
partition_summaries_builder
265
260
. field_builder :: < StringBuilder > ( 2 )
266
261
. unwrap ( )
267
262
. append_option ( summary. lower_bound . as_ref ( ) . map ( |v| {
268
- Datum :: try_from_bytes ( v, field_type. clone ( ) )
263
+ Datum :: try_from_bytes ( v, field . field_type . as_primitive_type ( ) . unwrap ( ) . clone ( ) )
269
264
. unwrap ( )
270
265
. to_string ( )
271
266
} ) ) ;
272
267
partition_summaries_builder
273
268
. field_builder :: < StringBuilder > ( 3 )
274
269
. unwrap ( )
275
270
. append_option ( summary. upper_bound . as_ref ( ) . map ( |v| {
276
- Datum :: try_from_bytes ( v, field_type. clone ( ) )
271
+ Datum :: try_from_bytes ( v, field . field_type . as_primitive_type ( ) . unwrap ( ) . clone ( ) )
277
272
. unwrap ( )
278
273
. to_string ( )
279
274
} ) ) ;
0 commit comments