File tree 2 files changed +15
-13
lines changed 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -179,16 +179,19 @@ impl ExecutionPlan for DataSourceExec {
179
179
fn statistics_by_partition (
180
180
& self ,
181
181
) -> datafusion_common:: Result < PartitionedStatistics > {
182
- let mut statistics = vec ! [
183
- Arc :: new( Statistics :: new_unknown( & self . schema( ) ) ) ;
184
- self . properties( ) . partitioning. partition_count( )
185
- ] ;
182
+ let mut statistics = {
183
+ let mut v =
184
+ Vec :: with_capacity ( self . properties ( ) . partitioning . partition_count ( ) ) ;
185
+ ( 0 ..self . properties ( ) . partitioning . partition_count ( ) )
186
+ . for_each ( |_| v. push ( Arc :: new ( Statistics :: new_unknown ( & self . schema ( ) ) ) ) ) ;
187
+ v
188
+ } ;
186
189
if let Some ( file_config) =
187
190
self . data_source . as_any ( ) . downcast_ref :: < FileScanConfig > ( )
188
191
{
189
192
for ( idx, file_group) in file_config. file_groups . iter ( ) . enumerate ( ) {
190
193
if let Some ( stat) = file_group. statistics ( ) {
191
- statistics[ idx] = stat . clone ( ) ;
194
+ statistics[ idx] = Arc :: clone ( stat ) ;
192
195
}
193
196
}
194
197
}
Original file line number Diff line number Diff line change @@ -432,14 +432,13 @@ pub trait ExecutionPlan: Debug + DisplayAs + Send + Sync {
432
432
/// If statistics are not available, returns an array of
433
433
/// [`Statistics::new_unknown`] for each partition.
434
434
fn statistics_by_partition ( & self ) -> Result < PartitionedStatistics > {
435
- Ok ( PartitionedStatistics :: new ( vec ! [
436
- Arc :: new(
437
- Statistics :: new_unknown( & self . schema( ) )
438
- ) ;
439
- self . properties( )
440
- . partitioning
441
- . partition_count( )
442
- ] ) )
435
+ Ok ( PartitionedStatistics :: new ( {
436
+ let mut v =
437
+ Vec :: with_capacity ( self . properties ( ) . partitioning . partition_count ( ) ) ;
438
+ ( 0 ..self . properties ( ) . partitioning . partition_count ( ) )
439
+ . for_each ( |_| v. push ( Arc :: new ( Statistics :: new_unknown ( & self . schema ( ) ) ) ) ) ;
440
+ v
441
+ } ) )
443
442
}
444
443
445
444
/// Returns `true` if a limit can be safely pushed down through this
You can’t perform that action at this time.
0 commit comments