Skip to content

Commit

Permalink
Rebasing on main once more
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondop committed Jul 27, 2024
1 parent 4ed65a5 commit b60fc73
Show file tree
Hide file tree
Showing 6 changed files with 884 additions and 848 deletions.
6 changes: 6 additions & 0 deletions datafusion/expr/src/test/function_stub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ impl AggregateUDFImpl for Min {
fn reverse_expr(&self) -> ReversedUDAF {
ReversedUDAF::Identical
}
fn get_minmax_desc(&self) -> Option<bool> {
Some(false)
}
}

create_func!(Max, max_udaf);
Expand Down Expand Up @@ -457,6 +460,9 @@ impl AggregateUDFImpl for Max {
fn reverse_expr(&self) -> ReversedUDAF {
ReversedUDAF::Identical
}
fn get_minmax_desc(&self) -> Option<bool> {
Some(true)
}
}

/// Testing stub implementation of avg aggregate
Expand Down
14 changes: 14 additions & 0 deletions datafusion/expr/src/udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ impl AggregateUDF {
pub fn simplify(&self) -> Option<AggregateFunctionSimplification> {
self.inner.simplify()
}

pub fn get_minmax_desc(&self) -> Option<bool> {
self.inner.get_minmax_desc()
}
}

impl<F> From<F> for AggregateUDF
Expand Down Expand Up @@ -536,6 +540,16 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
self.signature().hash(hasher);
hasher.finish()
}

/// If this function is max, return true
/// if the function is min, return false
/// otherwise return None (the default)
///
///
/// Note: this is used to use special aggregate implementations in certain conditions
fn get_minmax_desc(&self) -> Option<bool> {
None
}
}

pub enum ReversedUDAF {
Expand Down
Loading

0 comments on commit b60fc73

Please sign in to comment.