|
17 | 17 |
|
18 | 18 | #[cfg(test)] |
19 | 19 | mod test { |
| 20 | + use insta::assert_snapshot; |
20 | 21 | use std::sync::Arc; |
21 | 22 |
|
22 | 23 | use arrow::array::{Int32Array, RecordBatch}; |
@@ -606,21 +607,21 @@ mod test { |
606 | 607 | .build() |
607 | 608 | .map(Arc::new)?]; |
608 | 609 |
|
609 | | - let aggregate_exec_partial = Arc::new(AggregateExec::try_new( |
610 | | - AggregateMode::Partial, |
611 | | - group_by.clone(), |
612 | | - aggr_expr.clone(), |
613 | | - vec![None], |
614 | | - Arc::clone(&scan), |
615 | | - scan_schema.clone(), |
616 | | - )?) as _; |
617 | | - |
618 | | - let mut plan_string = get_plan_string(&aggregate_exec_partial); |
619 | | - let _ = plan_string.swap_remove(1); |
620 | | - let expected_plan = vec![ |
621 | | - "AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]", |
622 | | - ]; |
623 | | - assert_eq!(plan_string, expected_plan); |
| 610 | + let aggregate_exec_partial: Arc<dyn ExecutionPlan> = |
| 611 | + Arc::new(AggregateExec::try_new( |
| 612 | + AggregateMode::Partial, |
| 613 | + group_by.clone(), |
| 614 | + aggr_expr.clone(), |
| 615 | + vec![None], |
| 616 | + Arc::clone(&scan), |
| 617 | + scan_schema.clone(), |
| 618 | + )?) as _; |
| 619 | + |
| 620 | + let plan_string = get_plan_string(&aggregate_exec_partial).swap_remove(0); |
| 621 | + assert_snapshot!( |
| 622 | + plan_string, |
| 623 | + @"AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]" |
| 624 | + ); |
624 | 625 |
|
625 | 626 | let p0_statistics = aggregate_exec_partial.partition_statistics(Some(0))?; |
626 | 627 |
|
@@ -710,7 +711,10 @@ mod test { |
710 | 711 | )?) as _; |
711 | 712 |
|
712 | 713 | let agg_plan = get_plan_string(&agg_partial).remove(0); |
713 | | - assert_eq!("AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]",agg_plan); |
| 714 | + assert_snapshot!( |
| 715 | + agg_plan, |
| 716 | + @"AggregateExec: mode=Partial, gby=[id@0 as id, 1 + id@0 as expr], aggr=[COUNT(c)]" |
| 717 | + ); |
714 | 718 |
|
715 | 719 | let empty_stat = Statistics { |
716 | 720 | num_rows: Precision::Exact(0), |
|
0 commit comments