-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is your feature request related to a problem or challenge?
Part of #10943
While trying to port min and max to UDFs in #11013, @edmondop found several places where Min and Max (the existing built in aggregate functions) are special cased
Here is Max:
datafusion/datafusion/physical-expr/src/aggregate/min_max.rs
Lines 77 to 82 in c2ea6b3
| pub struct Max { | |
| name: String, | |
| data_type: DataType, | |
| nullable: bool, | |
| expr: Arc<dyn PhysicalExpr>, | |
| } |
The problem with relying on Min and Max directly is that it is hard/impossible to switch Min/Max to be a user defined aggregates as seen in #11013
Also, relying on Min/Max directly means that there is certain behavior that is not available to UDAFs compared to build in aggregate functions, which isn't ideal
Describe the solution you'd like
Remove all explicit references to Min / Max
Specifically, code that looks like this should be removed
expr.as_any().downcast_ref::<Max>()and
expr.as_any().downcast_ref::<Min>()Describe alternatives you've considered
Ideally, the alternative is to use a function on AggregateExpr which we can then add/implement for UDAFs when we port min/max to be a UDAF
Task List
- Remove
Min/Maxreferences fromAggregateExec::get_minmax_descr#11152 - Remove
Min/Maxreferences fromAggregateStatistics#11153
Additional context
No response