@@ -246,11 +246,11 @@ impl ExecutionPlan for ProjectionExec {
246
246
247
247
fn partition_statistics ( & self , partition : Option < usize > ) -> Result < Statistics > {
248
248
let input_stats = self . input . partition_statistics ( partition) ?;
249
- Ok ( stats_projection (
249
+ stats_projection (
250
250
input_stats,
251
251
self . expr . iter ( ) . map ( |( e, _) | Arc :: clone ( e) ) ,
252
252
Arc :: clone ( & self . input . schema ( ) ) ,
253
- ) )
253
+ )
254
254
}
255
255
256
256
fn supports_limit_pushdown ( & self ) -> bool {
@@ -279,7 +279,7 @@ fn stats_projection(
279
279
mut stats : Statistics ,
280
280
exprs : impl Iterator < Item = Arc < dyn PhysicalExpr > > ,
281
281
schema : SchemaRef ,
282
- ) -> Statistics {
282
+ ) -> Result < Statistics > {
283
283
let mut primitive_row_size = 0 ;
284
284
let mut primitive_row_size_possible = true ;
285
285
let mut column_statistics = vec ! [ ] ;
@@ -292,11 +292,10 @@ fn stats_projection(
292
292
ColumnStatistics :: new_unknown ( )
293
293
} ;
294
294
column_statistics. push ( col_stats) ;
295
- if let Ok ( data_type) = expr. data_type ( & schema) {
296
- if let Some ( value) = data_type. primitive_width ( ) {
297
- primitive_row_size += value;
298
- continue ;
299
- }
295
+ let data_type = expr. data_type ( & schema) ?;
296
+ if let Some ( value) = data_type. primitive_width ( ) {
297
+ primitive_row_size += value;
298
+ continue ;
300
299
}
301
300
primitive_row_size_possible = false ;
302
301
}
@@ -306,7 +305,7 @@ fn stats_projection(
306
305
Precision :: Exact ( primitive_row_size) . multiply ( & stats. num_rows ) ;
307
306
}
308
307
stats. column_statistics = column_statistics;
309
- stats
308
+ Ok ( stats)
310
309
}
311
310
312
311
impl ProjectionStream {
@@ -1171,7 +1170,8 @@ mod tests {
1171
1170
Arc :: new( Column :: new( "col0" , 0 ) ) ,
1172
1171
] ;
1173
1172
1174
- let result = stats_projection ( source, exprs. into_iter ( ) , Arc :: new ( schema) ) ;
1173
+ let result =
1174
+ stats_projection ( source, exprs. into_iter ( ) , Arc :: new ( schema) ) . unwrap ( ) ;
1175
1175
1176
1176
let expected = Statistics {
1177
1177
num_rows : Precision :: Exact ( 5 ) ,
@@ -1207,7 +1207,8 @@ mod tests {
1207
1207
Arc :: new( Column :: new( "col0" , 0 ) ) ,
1208
1208
] ;
1209
1209
1210
- let result = stats_projection ( source, exprs. into_iter ( ) , Arc :: new ( schema) ) ;
1210
+ let result =
1211
+ stats_projection ( source, exprs. into_iter ( ) , Arc :: new ( schema) ) . unwrap ( ) ;
1211
1212
1212
1213
let expected = Statistics {
1213
1214
num_rows : Precision :: Exact ( 5 ) ,
0 commit comments