@@ -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 . 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 {
@@ -1169,7 +1168,8 @@ mod tests {
1169
1168
Arc :: new( Column :: new( "col0" , 0 ) ) ,
1170
1169
] ;
1171
1170
1172
- let result = stats_projection ( source, exprs. into_iter ( ) , Arc :: new ( schema) ) ;
1171
+ let result =
1172
+ stats_projection ( source, exprs. into_iter ( ) , Arc :: new ( schema) ) . unwrap ( ) ;
1173
1173
1174
1174
let expected = Statistics {
1175
1175
num_rows : Precision :: Exact ( 5 ) ,
@@ -1205,7 +1205,8 @@ mod tests {
1205
1205
Arc :: new( Column :: new( "col0" , 0 ) ) ,
1206
1206
] ;
1207
1207
1208
- let result = stats_projection ( source, exprs. into_iter ( ) , Arc :: new ( schema) ) ;
1208
+ let result =
1209
+ stats_projection ( source, exprs. into_iter ( ) , Arc :: new ( schema) ) . unwrap ( ) ;
1209
1210
1210
1211
let expected = Statistics {
1211
1212
num_rows : Precision :: Exact ( 5 ) ,
0 commit comments