diff --git a/datafusion/functions-aggregate-common/src/aggregate.rs b/datafusion/functions-aggregate-common/src/aggregate.rs index 016e54e68835..6c2d8264435d 100644 --- a/datafusion/functions-aggregate-common/src/aggregate.rs +++ b/datafusion/functions-aggregate-common/src/aggregate.rs @@ -135,32 +135,6 @@ pub trait AggregateExpr: Send + Sync + Debug + PartialEq { not_impl_err!("Retractable Accumulator hasn't been implemented for {self:?} yet") } - /// Returns all expressions used in the [`AggregateExpr`]. - /// These expressions are (1)function arguments, (2) order by expressions. - fn all_expressions(&self) -> AggregatePhysicalExpressions { - let args = self.expressions(); - let order_bys = self.order_bys().unwrap_or(&[]); - let order_by_exprs = order_bys - .iter() - .map(|sort_expr| Arc::clone(&sort_expr.expr)) - .collect::>(); - AggregatePhysicalExpressions { - args, - order_by_exprs, - } - } - - /// Rewrites [`AggregateExpr`], with new expressions given. The argument should be consistent - /// with the return value of the [`AggregateExpr::all_expressions`] method. - /// Returns `Some(Arc)` if re-write is supported, otherwise returns `None`. - fn with_new_expressions( - &self, - _args: Vec>, - _order_by_exprs: Vec>, - ) -> Option> { - None - } - /// If this function is max, return (output_field, true) /// if the function is min, return (output_field, false) /// otherwise return None (the default) @@ -172,11 +146,3 @@ pub trait AggregateExpr: Send + Sync + Debug + PartialEq { None } } - -/// Stores the physical expressions used inside the `AggregateExpr`. -pub struct AggregatePhysicalExpressions { - /// Aggregate function arguments - pub args: Vec>, - /// Order by expressions - pub order_by_exprs: Vec>, -} diff --git a/datafusion/physical-expr/src/lib.rs b/datafusion/physical-expr/src/lib.rs index c4255172d680..049f23d2d013 100644 --- a/datafusion/physical-expr/src/lib.rs +++ b/datafusion/physical-expr/src/lib.rs @@ -67,9 +67,7 @@ pub mod execution_props { pub use aggregate::groups_accumulator::{GroupsAccumulatorAdapter, NullState}; pub use analysis::{analyze, AnalysisContext, ExprBoundaries}; -pub use datafusion_functions_aggregate_common::aggregate::{ - AggregateExpr, AggregatePhysicalExpressions, -}; +pub use datafusion_functions_aggregate_common::aggregate::AggregateExpr; pub use equivalence::{calculate_union, ConstExpr, EquivalenceProperties}; pub use partitioning::{Distribution, Partitioning}; pub use physical_expr::{ diff --git a/datafusion/physical-expr/src/window/sliding_aggregate.rs b/datafusion/physical-expr/src/window/sliding_aggregate.rs index 50e9632b2196..1494129cf897 100644 --- a/datafusion/physical-expr/src/window/sliding_aggregate.rs +++ b/datafusion/physical-expr/src/window/sliding_aggregate.rs @@ -141,31 +141,6 @@ impl WindowExpr for SlidingAggregateWindowExpr { fn uses_bounded_memory(&self) -> bool { !self.window_frame.end_bound.is_unbounded() } - - fn with_new_expressions( - &self, - args: Vec>, - partition_bys: Vec>, - order_by_exprs: Vec>, - ) -> Option> { - debug_assert_eq!(self.order_by.len(), order_by_exprs.len()); - - let new_order_by = self - .order_by - .iter() - .zip(order_by_exprs) - .map(|(req, new_expr)| PhysicalSortExpr { - expr: new_expr, - options: req.options, - }) - .collect::>(); - Some(Arc::new(SlidingAggregateWindowExpr { - aggregate: self.aggregate.with_new_expressions(args, vec![])?, - partition_by: partition_bys, - order_by: new_order_by, - window_frame: Arc::clone(&self.window_frame), - })) - } } impl AggregateWindowExpr for SlidingAggregateWindowExpr { diff --git a/datafusion/physical-expr/src/window/window_expr.rs b/datafusion/physical-expr/src/window/window_expr.rs index 8f6f78df8cb8..dd51454b30c2 100644 --- a/datafusion/physical-expr/src/window/window_expr.rs +++ b/datafusion/physical-expr/src/window/window_expr.rs @@ -128,45 +128,6 @@ pub trait WindowExpr: Send + Sync + Debug { /// Get the reverse expression of this [WindowExpr]. fn get_reverse_expr(&self) -> Option>; - - /// Returns all expressions used in the [`WindowExpr`]. - /// These expressions are (1) function arguments, (2) partition by expressions, (3) order by expressions. - fn all_expressions(&self) -> WindowPhysicalExpressions { - let args = self.expressions(); - let partition_by_exprs = self.partition_by().to_vec(); - let order_by_exprs = self - .order_by() - .iter() - .map(|sort_expr| Arc::clone(&sort_expr.expr)) - .collect::>(); - WindowPhysicalExpressions { - args, - partition_by_exprs, - order_by_exprs, - } - } - - /// Rewrites [`WindowExpr`], with new expressions given. The argument should be consistent - /// with the return value of the [`WindowExpr::all_expressions`] method. - /// Returns `Some(Arc)` if re-write is supported, otherwise returns `None`. - fn with_new_expressions( - &self, - _args: Vec>, - _partition_bys: Vec>, - _order_by_exprs: Vec>, - ) -> Option> { - None - } -} - -/// Stores the physical expressions used inside the `WindowExpr`. -pub struct WindowPhysicalExpressions { - /// Window function arguments - pub args: Vec>, - /// PARTITION BY expressions - pub partition_by_exprs: Vec>, - /// ORDER BY expressions - pub order_by_exprs: Vec>, } /// Extension trait that adds common functionality to [`AggregateWindowExpr`]s