Skip to content

Commit

Permalink
Removed legacy aggregate min/max
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondop committed Jul 20, 2024
1 parent 7e2ca86 commit 3090e10
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 1,333 deletions.
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/file_format/parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use datafusion_common::{
use datafusion_common_runtime::SpawnedTask;
use datafusion_execution::memory_pool::{MemoryConsumer, MemoryPool, MemoryReservation};
use datafusion_execution::TaskContext;
use datafusion_physical_expr::expressions::{MaxAccumulator, MinAccumulator};
use datafusion_functions_aggregate::min_max::{MaxAccumulator, MinAccumulator};
use datafusion_physical_expr::{PhysicalExpr, PhysicalSortRequirement};
use datafusion_physical_plan::metrics::MetricsSet;

Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use super::listing::PartitionedFile;
use crate::arrow::datatypes::{Schema, SchemaRef};
use crate::error::Result;
use crate::physical_plan::expressions::{MaxAccumulator, MinAccumulator};
use crate::functions_aggregate::min_max::{MaxAccumulator, MinAccumulator};
use crate::physical_plan::{Accumulator, ColumnStatistics, Statistics};
use arrow_schema::DataType;

Expand Down
15 changes: 2 additions & 13 deletions datafusion/core/src/physical_optimizer/aggregate_statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,39 +271,28 @@ fn is_non_distinct_count(agg_expr: &dyn AggregateExpr) -> bool {
return true;
}
}

false
}

// TODO: Move this check into AggregateUDFImpl
// https://github.com/apache/datafusion/issues/11153
fn is_min(agg_expr: &dyn AggregateExpr) -> bool {
if agg_expr.as_any().is::<expressions::Min>() {
return true;
}

if let Some(agg_expr) = agg_expr.as_any().downcast_ref::<AggregateFunctionExpr>() {
if agg_expr.fun().name() == "min" {
if agg_expr.fun().name().to_lowercase() == "min" {
return true;
}
}

false
}

// TODO: Move this check into AggregateUDFImpl
// https://github.com/apache/datafusion/issues/11153
fn is_max(agg_expr: &dyn AggregateExpr) -> bool {
if agg_expr.as_any().is::<expressions::Max>() {
return true;
}

if let Some(agg_expr) = agg_expr.as_any().downcast_ref::<AggregateFunctionExpr>() {
if agg_expr.fun().name() == "max" {
if agg_expr.fun().name().to_lowercase() == "max" {
return true;
}
}

false
}

Expand Down
15 changes: 0 additions & 15 deletions datafusion/expr/src/udaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,21 +537,6 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {
self.signature().hash(hasher);
hasher.finish()
}

/// Returns a flag beneficial for the aggregate statistics and optimizer
fn is_non_distinct_count(&self) -> bool {
false
}

/// Returns a flag beneficial for the aggregate statistics and optimizer
fn is_min(&self) -> bool {
false
}

/// Returns a flag beneficial for the aggregate statistics and optimizer
fn is_max(&self) -> bool {
false
}
}

pub enum ReversedUDAF {
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions-aggregate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ mod tests {
#[test]
fn test_no_duplicate_name() -> Result<()> {
let mut names = HashSet::new();
let migrated_functions = vec!["array_agg", "count", "max", "min"];
let migrated_functions = ["array_agg", "count", "max", "min"];
for func in all_default_aggregate_functions() {
// TODO: remove this
// These functions are in intermediate migration state, skip them
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@ pub(crate) mod accumulate {

pub use datafusion_physical_expr_common::aggregate::groups_accumulator::accumulate::NullState;

pub(crate) mod prim_op {
pub use datafusion_physical_expr_common::aggregate::groups_accumulator::prim_op::PrimitiveGroupsAccumulator;
}
pub(crate) mod prim_op {}
Loading

0 comments on commit 3090e10

Please sign in to comment.