@@ -37,13 +37,13 @@ use datafusion_datasource::file_scan_config::FileScanConfig;
37
37
use datafusion_execution:: object_store:: ObjectStoreUrl ;
38
38
use datafusion_execution:: { SendableRecordBatchStream , TaskContext } ;
39
39
use datafusion_expr:: { WindowFrame , WindowFunctionDefinition } ;
40
- use datafusion_functions_aggregate:: average:: avg_udaf;
41
40
use datafusion_functions_aggregate:: count:: count_udaf;
42
41
use datafusion_physical_expr:: aggregate:: { AggregateExprBuilder , AggregateFunctionExpr } ;
43
42
use datafusion_physical_expr:: expressions:: col;
44
43
use datafusion_physical_expr:: { expressions, PhysicalExpr } ;
45
- use datafusion_physical_expr_common:: sort_expr:: LexRequirement ;
46
- use datafusion_physical_expr_common:: sort_expr:: { LexOrdering , PhysicalSortExpr } ;
44
+ use datafusion_physical_expr_common:: sort_expr:: {
45
+ LexOrdering , LexRequirement , PhysicalSortExpr ,
46
+ } ;
47
47
use datafusion_physical_optimizer:: limited_distinct_aggregation:: LimitedDistinctAggregation ;
48
48
use datafusion_physical_optimizer:: PhysicalOptimizerRule ;
49
49
use datafusion_physical_plan:: aggregates:: {
@@ -62,11 +62,10 @@ use datafusion_physical_plan::streaming::{PartitionStream, StreamingTableExec};
62
62
use datafusion_physical_plan:: tree_node:: PlanContext ;
63
63
use datafusion_physical_plan:: union:: UnionExec ;
64
64
use datafusion_physical_plan:: windows:: { create_window_expr, BoundedWindowAggExec } ;
65
- use datafusion_physical_plan:: ExecutionPlan ;
66
65
use datafusion_physical_plan:: {
67
- displayable, DisplayAs , DisplayFormatType , PlanProperties ,
66
+ displayable, DisplayAs , DisplayFormatType , ExecutionPlan , InputOrderMode ,
67
+ Partitioning , PlanProperties ,
68
68
} ;
69
- use datafusion_physical_plan:: { InputOrderMode , Partitioning } ;
70
69
71
70
/// Create a non sorted parquet exec
72
71
pub fn parquet_exec ( schema : & SchemaRef ) -> Arc < DataSourceExec > {
@@ -128,17 +127,6 @@ pub fn create_test_schema3() -> Result<SchemaRef> {
128
127
Ok ( schema)
129
128
}
130
129
131
- // Generate a schema which consists of 5 columns (a, b, c, d, e) of Uint64
132
- pub fn create_test_schema4 ( ) -> Result < SchemaRef > {
133
- let a = Field :: new ( "a" , DataType :: UInt64 , true ) ;
134
- let b = Field :: new ( "b" , DataType :: UInt64 , false ) ;
135
- let c = Field :: new ( "c" , DataType :: UInt64 , true ) ;
136
- let d = Field :: new ( "d" , DataType :: UInt64 , false ) ;
137
- let e = Field :: new ( "e" , DataType :: Int64 , false ) ;
138
- let schema = Arc :: new ( Schema :: new ( vec ! [ a, b, c, d, e] ) ) ;
139
- Ok ( schema)
140
- }
141
-
142
130
pub fn sort_merge_join_exec (
143
131
left : Arc < dyn ExecutionPlan > ,
144
132
right : Arc < dyn ExecutionPlan > ,
@@ -207,33 +195,20 @@ pub fn bounded_window_exec(
207
195
col_name : & str ,
208
196
sort_exprs : impl IntoIterator < Item = PhysicalSortExpr > ,
209
197
input : Arc < dyn ExecutionPlan > ,
210
- ) -> Arc < dyn ExecutionPlan > {
211
- bounded_window_exec_with_partition ( col_name, sort_exprs, & [ ] , input, false )
212
- }
213
-
214
- pub fn bounded_window_exec_with_partition (
215
- col_name : & str ,
216
- sort_exprs : impl IntoIterator < Item = PhysicalSortExpr > ,
217
- partition_by : & [ Arc < dyn PhysicalExpr > ] ,
218
- input : Arc < dyn ExecutionPlan > ,
219
- should_reverse : bool ,
220
198
) -> Arc < dyn ExecutionPlan > {
221
199
let sort_exprs: LexOrdering = sort_exprs. into_iter ( ) . collect ( ) ;
222
200
let schema = input. schema ( ) ;
223
- let mut window_expr = create_window_expr (
201
+ let window_expr = create_window_expr (
224
202
& WindowFunctionDefinition :: AggregateUDF ( count_udaf ( ) ) ,
225
203
"count" . to_owned ( ) ,
226
204
& [ col ( col_name, & schema) . unwrap ( ) ] ,
227
- partition_by ,
205
+ & [ ] ,
228
206
sort_exprs. as_ref ( ) ,
229
207
Arc :: new ( WindowFrame :: new ( Some ( false ) ) ) ,
230
208
schema. as_ref ( ) ,
231
209
false ,
232
210
)
233
211
. unwrap ( ) ;
234
- if should_reverse {
235
- window_expr = window_expr. get_reverse_expr ( ) . unwrap ( ) ;
236
- }
237
212
238
213
Arc :: new (
239
214
BoundedWindowAggExec :: try_new (
@@ -246,35 +221,6 @@ pub fn bounded_window_exec_with_partition(
246
221
)
247
222
}
248
223
249
- pub fn bounded_window_exec_non_set_monotonic (
250
- col_name : & str ,
251
- sort_exprs : impl IntoIterator < Item = PhysicalSortExpr > ,
252
- input : Arc < dyn ExecutionPlan > ,
253
- ) -> Arc < dyn ExecutionPlan > {
254
- let sort_exprs: LexOrdering = sort_exprs. into_iter ( ) . collect ( ) ;
255
- let schema = input. schema ( ) ;
256
-
257
- Arc :: new (
258
- BoundedWindowAggExec :: try_new (
259
- vec ! [ create_window_expr(
260
- & WindowFunctionDefinition :: AggregateUDF ( avg_udaf( ) ) ,
261
- "avg" . to_owned( ) ,
262
- & [ col( col_name, & schema) . unwrap( ) ] ,
263
- & [ ] ,
264
- sort_exprs. as_ref( ) ,
265
- Arc :: new( WindowFrame :: new( Some ( false ) ) ) ,
266
- schema. as_ref( ) ,
267
- false ,
268
- )
269
- . unwrap( ) ] ,
270
- Arc :: clone ( & input) ,
271
- InputOrderMode :: Sorted ,
272
- false ,
273
- )
274
- . unwrap ( ) ,
275
- )
276
- }
277
-
278
224
pub fn filter_exec (
279
225
predicate : Arc < dyn PhysicalExpr > ,
280
226
input : Arc < dyn ExecutionPlan > ,
0 commit comments