Skip to content

Commit

Permalink
remove redudant info
Browse files Browse the repository at this point in the history
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
  • Loading branch information
jayzhan211 committed Mar 1, 2024
1 parent d44fcdc commit 6bbfe00
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 37 deletions.
12 changes: 3 additions & 9 deletions datafusion/core/tests/user_defined/user_defined_aggregates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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);
Expand Down
18 changes: 0 additions & 18 deletions datafusion/expr/src/expr_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,6 @@ pub fn create_udaf_with_ordering(
volatility: Volatility,
accumulator: AccumulatorFactoryFunction,
state_type: Arc<Vec<DataType>>,
ordering_req: Vec<Expr>,
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());
Expand All @@ -1087,8 +1085,6 @@ pub fn create_udaf_with_ordering(
volatility,
accumulator,
state_type,
ordering_req,
schema,
))
}

Expand Down Expand Up @@ -1191,8 +1187,6 @@ pub struct SimpleOrderedAggregateUDF {
return_type: DataType,
accumulator: AccumulatorFactoryFunction,
state_type: Vec<DataType>,
ordering_req: Vec<Expr>,
schema: Option<Schema>,
}

impl Debug for SimpleOrderedAggregateUDF {
Expand All @@ -1216,8 +1210,6 @@ impl SimpleOrderedAggregateUDF {
volatility: Volatility,
accumulator: AccumulatorFactoryFunction,
state_type: Vec<DataType>,
ordering_req: Vec<Expr>,
schema: Option<&Schema>,
) -> Self {
let name = name.into();
let signature = Signature::exact(input_type, volatility);
Expand All @@ -1227,8 +1219,6 @@ impl SimpleOrderedAggregateUDF {
return_type,
accumulator,
state_type,
ordering_req,
schema: schema.cloned(),
}
}
}
Expand Down Expand Up @@ -1262,14 +1252,6 @@ impl AggregateUDFImpl for SimpleOrderedAggregateUDF {
fn state_type(&self, _return_type: &DataType) -> Result<Vec<DataType>> {
Ok(self.state_type.clone())
}

fn sort_exprs(&self) -> Vec<Expr> {
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.
Expand Down
10 changes: 0 additions & 10 deletions datafusion/expr/src/udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,16 +294,6 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
fn create_groups_accumulator(&self) -> Result<Box<dyn GroupsAccumulator>> {
not_impl_err!("GroupsAccumulator hasn't been implemented for {self:?} yet")
}

/// Return the ordering expressions for the accumulator
fn sort_exprs(&self) -> Vec<Expr> {
vec![]
}

/// Return the schema for the accumulator
fn schema(&self) -> Option<&Schema> {
None
}
}

/// Implementation of [`AggregateUDFImpl`] that wraps the function style pointers
Expand Down

0 comments on commit 6bbfe00

Please sign in to comment.