@@ -21,7 +21,7 @@ use insta::assert_snapshot;
2121use std:: sync:: Arc ;
2222
2323use crate :: physical_optimizer:: test_utils:: {
24- build_group_by, mock_data , parquet_exec_with_sort , plan_matches_expected , schema,
24+ build_group_by, get_optimized_plan , mock_data , parquet_exec_with_sort , schema,
2525 TestAggregate ,
2626} ;
2727
@@ -40,7 +40,7 @@ use datafusion_physical_plan::{
4040 ExecutionPlan ,
4141} ;
4242
43- async fn assert_results_match_expected ( plan : Arc < dyn ExecutionPlan > ) -> Result < String > {
43+ async fn run_plan_and_format ( plan : Arc < dyn ExecutionPlan > ) -> Result < String > {
4444 let cfg = SessionConfig :: new ( ) . with_target_partitions ( 1 ) ;
4545 let ctx = SessionContext :: new_with_config ( cfg) ;
4646 let batches = collect ( plan, ctx. task_ctx ( ) ) . await ?;
@@ -75,7 +75,7 @@ async fn test_partial_final() -> Result<()> {
7575 4 , // fetch
7676 ) ;
7777 let plan: Arc < dyn ExecutionPlan > = Arc :: new ( limit_exec) ;
78- let formatted = plan_matches_expected ( & plan) ?;
78+ let formatted = get_optimized_plan ( & plan) ?;
7979 let actual = formatted. trim ( ) ;
8080 assert_snapshot ! (
8181 actual,
@@ -86,7 +86,7 @@ async fn test_partial_final() -> Result<()> {
8686 DataSourceExec: partitions=1, partition_sizes=[1]
8787 "
8888 ) ;
89- let expected = assert_results_match_expected ( plan) . await ?;
89+ let expected = run_plan_and_format ( plan) . await ?;
9090 let actual = expected. trim ( ) ;
9191 assert_snapshot ! (
9292 actual,
@@ -125,7 +125,7 @@ async fn test_single_local() -> Result<()> {
125125 ) ;
126126 // expected to push the limit to the AggregateExec
127127 let plan: Arc < dyn ExecutionPlan > = Arc :: new ( limit_exec) ;
128- let formatted = plan_matches_expected ( & plan) ?;
128+ let formatted = get_optimized_plan ( & plan) ?;
129129 let actual = formatted. trim ( ) ;
130130 assert_snapshot ! (
131131 actual,
@@ -135,7 +135,7 @@ async fn test_single_local() -> Result<()> {
135135 DataSourceExec: partitions=1, partition_sizes=[1]
136136 "
137137 ) ;
138- let expected = assert_results_match_expected ( plan) . await ?;
138+ let expected = run_plan_and_format ( plan) . await ?;
139139 let actual = expected. trim ( ) ;
140140 assert_snapshot ! (
141141 actual,
@@ -174,7 +174,7 @@ async fn test_single_global() -> Result<()> {
174174 ) ;
175175 // expected to push the skip+fetch limit to the AggregateExec
176176 let plan: Arc < dyn ExecutionPlan > = Arc :: new ( limit_exec) ;
177- let formatted = plan_matches_expected ( & plan) ?;
177+ let formatted = get_optimized_plan ( & plan) ?;
178178 let actual = formatted. trim ( ) ;
179179 assert_snapshot ! (
180180 actual,
@@ -184,7 +184,7 @@ async fn test_single_global() -> Result<()> {
184184 DataSourceExec: partitions=1, partition_sizes=[1]
185185 "
186186 ) ;
187- let expected = assert_results_match_expected ( plan) . await ?;
187+ let expected = run_plan_and_format ( plan) . await ?;
188188 let actual = expected. trim ( ) ;
189189 assert_snapshot ! (
190190 actual,
@@ -229,7 +229,7 @@ async fn test_distinct_cols_different_than_group_by_cols() -> Result<()> {
229229 ) ;
230230 // expected to push the limit to the outer AggregateExec only
231231 let plan: Arc < dyn ExecutionPlan > = Arc :: new ( limit_exec) ;
232- let formatted = plan_matches_expected ( & plan) ?;
232+ let formatted = get_optimized_plan ( & plan) ?;
233233 let actual = formatted. trim ( ) ;
234234 assert_snapshot ! (
235235 actual,
@@ -240,7 +240,7 @@ async fn test_distinct_cols_different_than_group_by_cols() -> Result<()> {
240240 DataSourceExec: partitions=1, partition_sizes=[1]
241241 "
242242 ) ;
243- let expected = assert_results_match_expected ( plan) . await ?;
243+ let expected = run_plan_and_format ( plan) . await ?;
244244 let actual = expected. trim ( ) ;
245245 assert_snapshot ! (
246246 actual,
@@ -284,7 +284,7 @@ fn test_has_order_by() -> Result<()> {
284284 ) ;
285285 // expected not to push the limit to the AggregateExec
286286 let plan: Arc < dyn ExecutionPlan > = Arc :: new ( limit_exec) ;
287- let formatted = plan_matches_expected ( & plan) ?;
287+ let formatted = get_optimized_plan ( & plan) ?;
288288 let actual = formatted. trim ( ) ;
289289 assert_snapshot ! (
290290 actual,
@@ -317,7 +317,7 @@ fn test_no_group_by() -> Result<()> {
317317 ) ;
318318 // expected not to push the limit to the AggregateExec
319319 let plan: Arc < dyn ExecutionPlan > = Arc :: new ( limit_exec) ;
320- let formatted = plan_matches_expected ( & plan) ?;
320+ let formatted = get_optimized_plan ( & plan) ?;
321321 let actual = formatted. trim ( ) ;
322322 assert_snapshot ! (
323323 actual,
@@ -351,7 +351,7 @@ fn test_has_aggregate_expression() -> Result<()> {
351351 ) ;
352352 // expected not to push the limit to the AggregateExec
353353 let plan: Arc < dyn ExecutionPlan > = Arc :: new ( limit_exec) ;
354- let formatted = plan_matches_expected ( & plan) ?;
354+ let formatted = get_optimized_plan ( & plan) ?;
355355 let actual = formatted. trim ( ) ;
356356 assert_snapshot ! (
357357 actual,
@@ -393,7 +393,7 @@ fn test_has_filter() -> Result<()> {
393393 // expected not to push the limit to the AggregateExec
394394 // TODO(msirek): open an issue for `filter_expr` of `AggregateExec` not printing out
395395 let plan: Arc < dyn ExecutionPlan > = Arc :: new ( limit_exec) ;
396- let formatted = plan_matches_expected ( & plan) ?;
396+ let formatted = get_optimized_plan ( & plan) ?;
397397 let actual = formatted. trim ( ) ;
398398 assert_snapshot ! (
399399 actual,
0 commit comments