@@ -47,10 +47,9 @@ use datafusion::datasource::physical_plan::{
4747} ;
4848use datafusion:: execution:: FunctionRegistry ;
4949use datafusion:: functions_aggregate:: sum:: sum_udaf;
50- use datafusion:: functions_window:: nth_value:: first_value_udwf;
5150use datafusion:: logical_expr:: { create_udf, JoinType , Operator , Volatility } ;
5251use datafusion:: physical_expr:: expressions:: Literal ;
53- use datafusion:: physical_expr:: window:: { BuiltInWindowExpr , SlidingAggregateWindowExpr } ;
52+ use datafusion:: physical_expr:: window:: SlidingAggregateWindowExpr ;
5453use datafusion:: physical_expr:: {
5554 LexOrdering , LexRequirement , PhysicalSortRequirement , ScalarFunctionExpr ,
5655} ;
@@ -74,9 +73,7 @@ use datafusion::physical_plan::repartition::RepartitionExec;
7473use datafusion:: physical_plan:: sorts:: sort:: SortExec ;
7574use datafusion:: physical_plan:: union:: { InterleaveExec , UnionExec } ;
7675use datafusion:: physical_plan:: unnest:: { ListUnnest , UnnestExec } ;
77- use datafusion:: physical_plan:: windows:: {
78- create_udwf_window_expr, PlainAggregateWindowExpr , WindowAggExec ,
79- } ;
76+ use datafusion:: physical_plan:: windows:: { PlainAggregateWindowExpr , WindowAggExec } ;
8077use datafusion:: physical_plan:: { ExecutionPlan , Partitioning , PhysicalExpr , Statistics } ;
8178use datafusion:: prelude:: SessionContext ;
8279use datafusion:: scalar:: ScalarValue ;
@@ -88,11 +85,9 @@ use datafusion_common::stats::Precision;
8885use datafusion_common:: {
8986 internal_err, not_impl_err, DataFusionError , Result , UnnestOptions ,
9087} ;
91- use datafusion_expr:: WindowFunctionDefinition :: WindowUDF ;
9288use datafusion_expr:: {
9389 Accumulator , AccumulatorFactoryFunction , AggregateUDF , ColumnarValue , ScalarUDF ,
9490 Signature , SimpleAggregateUDF , WindowFrame , WindowFrameBound ,
95- WindowFunctionDefinition ,
9691} ;
9792use datafusion_functions_aggregate:: average:: avg_udaf;
9893use datafusion_functions_aggregate:: nth_value:: nth_value_udaf;
@@ -101,7 +96,6 @@ use datafusion_proto::physical_plan::{
10196 AsExecutionPlan , DefaultPhysicalExtensionCodec , PhysicalExtensionCodec ,
10297} ;
10398use datafusion_proto:: protobuf;
104- use datafusion_proto:: protobuf:: logical_expr_node:: ExprType :: WindowExpr ;
10599
106100/// Perform a serde roundtrip and assert that the string representation of the before and after plans
107101/// are identical. Note that this often isn't sufficient to guarantee that no information is
@@ -275,35 +269,6 @@ fn roundtrip_window() -> Result<()> {
275269 let field_b = Field :: new ( "b" , DataType :: Int64 , false ) ;
276270 let schema = Arc :: new ( Schema :: new ( vec ! [ field_a, field_b] ) ) ;
277271
278- let window_frame = WindowFrame :: new_bounds (
279- datafusion_expr:: WindowFrameUnits :: Range ,
280- WindowFrameBound :: Preceding ( ScalarValue :: Int64 ( None ) ) ,
281- WindowFrameBound :: CurrentRow ,
282- ) ;
283-
284- let first_value_window = create_udwf_window_expr (
285- & first_value_udwf ( ) ,
286- & [ col ( "a" , & schema) ?] ,
287- schema. as_ref ( ) ,
288- "FIRST_VALUE(a) PARTITION BY [b] ORDER BY [a ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW" . to_string ( ) ,
289- false ,
290- ) ?;
291- // "FIRST_VALUE(a) PARTITION BY [b] ORDER BY [a ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW",
292- let builtin_window_expr = Arc :: new ( BuiltInWindowExpr :: new (
293- first_value_window,
294- & [ col ( "b" , & schema) ?] ,
295- & LexOrdering {
296- inner : vec ! [ PhysicalSortExpr {
297- expr: col( "a" , & schema) ?,
298- options: SortOptions {
299- descending: false ,
300- nulls_first: false ,
301- } ,
302- } ] ,
303- } ,
304- Arc :: new ( window_frame) ,
305- ) ) ;
306-
307272 let plain_aggr_window_expr = Arc :: new ( PlainAggregateWindowExpr :: new (
308273 AggregateExprBuilder :: new (
309274 avg_udaf ( ) ,
@@ -341,11 +306,7 @@ fn roundtrip_window() -> Result<()> {
341306 let input = Arc :: new ( EmptyExec :: new ( schema. clone ( ) ) ) ;
342307
343308 roundtrip_test ( Arc :: new ( WindowAggExec :: try_new (
344- vec ! [
345- plain_aggr_window_expr,
346- sliding_aggr_window_expr,
347- builtin_window_expr,
348- ] ,
309+ vec ! [ plain_aggr_window_expr, sliding_aggr_window_expr] ,
349310 input,
350311 vec ! [ col( "b" , & schema) ?] ,
351312 ) ?) )
0 commit comments