diff --git a/datafusion/core/tests/user_defined/user_defined_aggregates.rs b/datafusion/core/tests/user_defined/user_defined_aggregates.rs index 85441838c19d..e9583fff35c3 100644 --- a/datafusion/core/tests/user_defined/user_defined_aggregates.rs +++ b/datafusion/core/tests/user_defined/user_defined_aggregates.rs @@ -42,10 +42,10 @@ use datafusion::{ prelude::SessionContext, scalar::ScalarValue, }; -use datafusion_common::{assert_contains, cast::as_primitive_array, exec_err, Column}; +use datafusion_common::{assert_contains, cast::as_primitive_array, exec_err}; use datafusion_expr::{ - create_udaf, create_udaf_with_ordering, expr::Sort, AggregateUDFImpl, Expr, - GroupsAccumulator, SimpleAggregateUDF, + create_udaf, create_udaf_with_ordering, AggregateUDFImpl, Expr, GroupsAccumulator, + SimpleAggregateUDF, }; use datafusion_physical_expr::expressions::{self, FirstValueAccumulator}; use datafusion_physical_expr::{expressions::AvgAccumulator, PhysicalSortExpr}; @@ -278,12 +278,6 @@ async fn simple_udaf_order() -> Result<()> { Volatility::Immutable, Arc::new(create_accumulator), Arc::new(vec![DataType::Int32, DataType::Int32, DataType::Boolean]), - vec![Expr::Sort(Sort { - expr: Box::new(Expr::Column(Column::new(Some("t"), "a"))), - asc: false, - nulls_first: false, - })], - Some(&schema), ); ctx.register_udaf(my_first); diff --git a/datafusion/expr/src/expr_fn.rs b/datafusion/expr/src/expr_fn.rs index 3ba4808b9694..1a84a49d0949 100644 --- a/datafusion/expr/src/expr_fn.rs +++ b/datafusion/expr/src/expr_fn.rs @@ -1027,8 +1027,6 @@ pub fn create_udaf_with_ordering( volatility: Volatility, accumulator: AccumulatorFactoryFunction, state_type: Arc>, - ordering_req: Vec, - schema: Option<&Schema>, ) -> AggregateUDF { let return_type = Arc::try_unwrap(return_type).unwrap_or_else(|t| t.as_ref().clone()); let state_type = Arc::try_unwrap(state_type).unwrap_or_else(|t| t.as_ref().clone()); @@ -1040,8 +1038,6 @@ pub fn create_udaf_with_ordering( volatility, accumulator, state_type, - ordering_req, - schema, )) } @@ -1144,8 +1140,6 @@ pub struct SimpleOrderedAggregateUDF { return_type: DataType, accumulator: AccumulatorFactoryFunction, state_type: Vec, - ordering_req: Vec, - schema: Option, } impl Debug for SimpleOrderedAggregateUDF { @@ -1169,8 +1163,6 @@ impl SimpleOrderedAggregateUDF { volatility: Volatility, accumulator: AccumulatorFactoryFunction, state_type: Vec, - ordering_req: Vec, - schema: Option<&Schema>, ) -> Self { let name = name.into(); let signature = Signature::exact(input_type, volatility); @@ -1180,8 +1172,6 @@ impl SimpleOrderedAggregateUDF { return_type, accumulator, state_type, - ordering_req, - schema: schema.cloned(), } } } @@ -1215,14 +1205,6 @@ impl AggregateUDFImpl for SimpleOrderedAggregateUDF { fn state_type(&self, _return_type: &DataType) -> Result> { Ok(self.state_type.clone()) } - - fn sort_exprs(&self) -> Vec { - self.ordering_req.clone() - } - - fn schema(&self) -> Option<&Schema> { - self.schema.as_ref() - } } /// Creates a new UDWF with a specific signature, state type and return type. diff --git a/datafusion/expr/src/udaf.rs b/datafusion/expr/src/udaf.rs index 121cd6834306..b5caf860163d 100644 --- a/datafusion/expr/src/udaf.rs +++ b/datafusion/expr/src/udaf.rs @@ -294,16 +294,6 @@ pub trait AggregateUDFImpl: Debug + Send + Sync { fn create_groups_accumulator(&self) -> Result> { not_impl_err!("GroupsAccumulator hasn't been implemented for {self:?} yet") } - - /// Return the ordering expressions for the accumulator - fn sort_exprs(&self) -> Vec { - vec![] - } - - /// Return the schema for the accumulator - fn schema(&self) -> Option<&Schema> { - None - } } /// Implementation of [`AggregateUDFImpl`] that wraps the function style pointers