@@ -60,12 +60,10 @@ impl PhysicalOptimizerRule for AggregateStatistics {
6060 if let Some ( ( non_null_rows, name) ) =
6161 take_optimizable_count_with_nulls ( & * * expr, & stats)
6262 {
63- println ! ( "Using count with nulls opt" ) ;
6463 projections. push ( ( expressions:: lit ( non_null_rows) , name. to_owned ( ) ) ) ;
6564 } else if let Some ( ( num_rows, name) ) =
6665 take_optimizable_count ( & * * expr, & stats)
6766 {
68- println ! ( "Using count opt" ) ;
6967 projections. push ( ( expressions:: lit ( num_rows) , name. to_owned ( ) ) ) ;
7068 } else if let Some ( ( min, name) ) = take_optimizable_min ( & * * expr, & stats) {
7169 projections. push ( ( expressions:: lit ( min) , name. to_owned ( ) ) ) ;
@@ -171,10 +169,6 @@ fn take_optimizable_count_with_nulls(
171169 & stats. column_statistics ,
172170 agg_expr. as_any ( ) . downcast_ref :: < expressions:: Count > ( ) ,
173171 ) {
174- println ! (
175- "Num rows: {}\n Col Stats: {:?}\n Expr: {:?}" ,
176- num_rows, col_stats, casted_expr
177- ) ;
178172 if casted_expr. expressions ( ) . len ( ) == 1 {
179173 // TODO optimize with exprs other than Column
180174 if let Some ( col_expr) = casted_expr. expressions ( ) [ 0 ]
@@ -279,32 +273,11 @@ mod tests {
279273 Field :: new( "b" , DataType :: Int32 , false ) ,
280274 ] ) ) ;
281275
282- let batch = RecordBatch :: try_new (
283- Arc :: clone ( & schema) ,
284- vec ! [
285- Arc :: new( Int32Array :: from( vec![ 1 , 2 , 3 ] ) ) ,
286- Arc :: new( Int32Array :: from( vec![ 4 , 5 , 6 ] ) ) ,
287- ] ,
288- ) ?;
289-
290- Ok ( Arc :: new ( MemoryExec :: try_new (
291- & [ vec ! [ batch] ] ,
292- Arc :: clone ( & schema) ,
293- None ,
294- ) ?) )
295- }
296-
297- fn mock_data_with_nulls ( ) -> Result < Arc < MemoryExec > > {
298- let schema = Arc :: new ( Schema :: new ( vec ! [
299- Field :: new( "a" , DataType :: Int32 , false ) ,
300- Field :: new( "b" , DataType :: Int32 , false ) ,
301- ] ) ) ;
302-
303276 let batch = RecordBatch :: try_new (
304277 Arc :: clone ( & schema) ,
305278 vec ! [
306279 Arc :: new( Int32Array :: from( vec![ Some ( 1 ) , Some ( 2 ) , None ] ) ) ,
307- Arc :: new( Int32Array :: from( vec![ Some ( 4 ) , None , Some ( 5 ) ] ) ) ,
280+ Arc :: new( Int32Array :: from( vec![ Some ( 4 ) , None , Some ( 6 ) ] ) ) ,
308281 ] ,
309282 ) ?;
310283
@@ -322,7 +295,6 @@ mod tests {
322295 ) -> Result < ( ) > {
323296 let conf = ExecutionConfig :: new ( ) ;
324297 let optimized = AggregateStatistics :: new ( ) . optimize ( Arc :: new ( plan) , & conf) ?;
325- println ! ( "{:?}" , optimized) ;
326298
327299 let ( col, count) = match nulls {
328300 false => ( Field :: new ( "COUNT(Uint8(1))" , DataType :: UInt64 , false ) , 3 ) ,
@@ -384,7 +356,7 @@ mod tests {
384356 #[ tokio:: test]
385357 async fn test_count_partial_with_nulls_direct_child ( ) -> Result < ( ) > {
386358 // basic test case with the aggregation applied on a source with exact statistics
387- let source = mock_data_with_nulls ( ) ?;
359+ let source = mock_data ( ) ?;
388360 let schema = source. schema ( ) ;
389361
390362 let partial_agg = HashAggregateExec :: try_new (
@@ -395,15 +367,13 @@ mod tests {
395367 Arc :: clone ( & schema) ,
396368 ) ?;
397369
398- // println!("{:?}", partial_agg);
399370 let final_agg = HashAggregateExec :: try_new (
400371 AggregateMode :: Final ,
401372 vec ! [ ] ,
402373 vec ! [ count_expr( Some ( & schema) , Some ( "a" ) ) ] ,
403374 Arc :: new ( partial_agg) ,
404375 Arc :: clone ( & schema) ,
405376 ) ?;
406- // println!("{:?}", final_agg);
407377
408378 assert_count_optim_success ( final_agg, true ) . await ?;
409379
@@ -441,7 +411,7 @@ mod tests {
441411
442412 #[ tokio:: test]
443413 async fn test_count_partial_with_nulls_indirect_child ( ) -> Result < ( ) > {
444- let source = mock_data_with_nulls ( ) ?;
414+ let source = mock_data ( ) ?;
445415 let schema = source. schema ( ) ;
446416
447417 let partial_agg = HashAggregateExec :: try_new (
@@ -512,7 +482,7 @@ mod tests {
512482
513483 #[ tokio:: test]
514484 async fn test_count_with_nulls_inexact_stat ( ) -> Result < ( ) > {
515- let source = mock_data_with_nulls ( ) ?;
485+ let source = mock_data ( ) ?;
516486 let schema = source. schema ( ) ;
517487
518488 // adding a filter makes the statistics inexact
0 commit comments