@@ -20,14 +20,13 @@ use std::sync::Arc;
2020use crate :: memory_limit:: DummyStreamPartition ;
2121use crate :: physical_optimizer:: test_utils:: {
2222 RequirementsTestExec , aggregate_exec, bounded_window_exec,
23- bounded_window_exec_with_partition, check_integrity, coalesce_batches_exec,
24- coalesce_partitions_exec, create_test_schema, create_test_schema2,
25- create_test_schema3, filter_exec, global_limit_exec, hash_join_exec,
26- local_limit_exec, memory_exec, parquet_exec, parquet_exec_with_sort, projection_exec,
27- repartition_exec, sort_exec, sort_exec_with_fetch, sort_expr, sort_expr_options,
28- sort_merge_join_exec, sort_preserving_merge_exec,
29- sort_preserving_merge_exec_with_fetch, spr_repartition_exec, stream_exec_ordered,
30- union_exec,
23+ bounded_window_exec_with_partition, check_integrity, coalesce_partitions_exec,
24+ create_test_schema, create_test_schema2, create_test_schema3, filter_exec,
25+ global_limit_exec, hash_join_exec, local_limit_exec, memory_exec, parquet_exec,
26+ parquet_exec_with_sort, projection_exec, repartition_exec, sort_exec,
27+ sort_exec_with_fetch, sort_expr, sort_expr_options, sort_merge_join_exec,
28+ sort_preserving_merge_exec, sort_preserving_merge_exec_with_fetch,
29+ spr_repartition_exec, stream_exec_ordered, union_exec,
3130} ;
3231
3332use arrow:: compute:: SortOptions ;
@@ -1845,9 +1844,7 @@ async fn test_remove_unnecessary_sort_window_multilayer() -> Result<()> {
18451844 ) ]
18461845 . into ( ) ;
18471846 let sort = sort_exec ( ordering. clone ( ) , source) ;
1848- // Add dummy layer propagating Sort above, to test whether sort can be removed from multi layer before
1849- let coalesce_batches = coalesce_batches_exec ( sort, 128 ) ;
1850- let window_agg = bounded_window_exec ( "non_nullable_col" , ordering, coalesce_batches) ;
1847+ let window_agg = bounded_window_exec ( "non_nullable_col" , ordering, sort) ;
18511848 let ordering2: LexOrdering = [ sort_expr_options (
18521849 "non_nullable_col" ,
18531850 & window_agg. schema ( ) ,
@@ -1873,17 +1870,15 @@ async fn test_remove_unnecessary_sort_window_multilayer() -> Result<()> {
18731870 FilterExec: NOT non_nullable_col@1
18741871 SortExec: expr=[non_nullable_col@1 ASC NULLS LAST], preserve_partitioning=[false]
18751872 BoundedWindowAggExec: wdw=[count: Field { "count": Int64 }, frame: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW], mode=[Sorted]
1876- CoalesceBatchesExec: target_batch_size=128
1877- SortExec: expr=[non_nullable_col@1 DESC], preserve_partitioning=[false]
1878- DataSourceExec: partitions=1, partition_sizes=[0]
1873+ SortExec: expr=[non_nullable_col@1 DESC], preserve_partitioning=[false]
1874+ DataSourceExec: partitions=1, partition_sizes=[0]
18791875
18801876 Optimized Plan:
18811877 WindowAggExec: wdw=[count: Ok(Field { name: "count", data_type: Int64 }), frame: WindowFrame { units: Range, start_bound: CurrentRow, end_bound: Following(UInt64(NULL)), is_causal: false }]
18821878 FilterExec: NOT non_nullable_col@1
18831879 BoundedWindowAggExec: wdw=[count: Field { "count": Int64 }, frame: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW], mode=[Sorted]
1884- CoalesceBatchesExec: target_batch_size=128
1885- SortExec: expr=[non_nullable_col@1 DESC], preserve_partitioning=[false]
1886- DataSourceExec: partitions=1, partition_sizes=[0]
1880+ SortExec: expr=[non_nullable_col@1 DESC], preserve_partitioning=[false]
1881+ DataSourceExec: partitions=1, partition_sizes=[0]
18871882 "# ) ;
18881883
18891884 Ok ( ( ) )
0 commit comments