@@ -121,18 +121,10 @@ impl Operation {
121121 . map ( |x| x. name ( ) )
122122 . collect :: < SmallVec < [ _ ; 4 ] > > ( ) ;
123123
124- let bounding_partition_values = delete_files
125- . iter ( )
126- . chain ( data_files. iter ( ) )
127- . try_fold ( None , |acc, x| {
128- let node = partition_struct_to_vec ( x. partition ( ) , & partition_column_names) ?;
129- let Some ( mut acc) = acc else {
130- return Ok :: < _ , Error > ( Some ( Rectangle :: new ( node. clone ( ) , node) ) ) ;
131- } ;
132- acc. expand_with_node ( node) ;
133- Ok ( Some ( acc) )
134- } ) ?
135- . ok_or ( Error :: NotFound ( "Bounding partition values" . to_owned ( ) ) ) ?;
124+ let bounding_partition_values = bounding_partition_values (
125+ delete_files. iter ( ) . chain ( data_files. iter ( ) ) ,
126+ & partition_column_names,
127+ ) ?;
136128
137129 let new_datafile_iter =
138130 delete_files
@@ -457,18 +449,8 @@ impl Operation {
457449
458450 manifest_list_writer. append_ser ( manifest) ?;
459451 } else {
460- let bounding_partition_values = files
461- . iter ( )
462- . try_fold ( None , |acc, x| {
463- let node =
464- partition_struct_to_vec ( x. partition ( ) , & partition_column_names) ?;
465- let Some ( mut acc) = acc else {
466- return Ok :: < _ , Error > ( Some ( Rectangle :: new ( node. clone ( ) , node) ) ) ;
467- } ;
468- acc. expand_with_node ( node) ;
469- Ok ( Some ( acc) )
470- } ) ?
471- . ok_or ( Error :: NotFound ( "Bounding partition values" . to_owned ( ) ) ) ?;
452+ let bounding_partition_values =
453+ bounding_partition_values ( files. iter ( ) , & partition_column_names) ?;
472454
473455 // Split datafiles
474456 let splits = split_datafiles (
@@ -576,6 +558,21 @@ impl Operation {
576558 }
577559}
578560
561+ fn bounding_partition_values < ' a > (
562+ mut iter : impl Iterator < Item = & ' a DataFile > ,
563+ partition_column_names : & SmallVec < [ & str ; 4 ] > ,
564+ ) -> Result < Rectangle , Error > {
565+ iter. try_fold ( None , |acc, x| {
566+ let node = partition_struct_to_vec ( x. partition ( ) , partition_column_names) ?;
567+ let Some ( mut acc) = acc else {
568+ return Ok :: < _ , Error > ( Some ( Rectangle :: new ( node. clone ( ) , node) ) ) ;
569+ } ;
570+ acc. expand_with_node ( node) ;
571+ Ok ( Some ( acc) )
572+ } ) ?
573+ . ok_or ( Error :: NotFound ( "Bounding partition values" . to_owned ( ) ) )
574+ }
575+
579576fn prefetch_manifest (
580577 selected_manifest_opt : & Option < ManifestListEntry > ,
581578 object_store : & Arc < dyn ObjectStore > ,
0 commit comments