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:
|
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
Additional context
No response
Is your feature request related to a problem or challenge?
Part of #10943
While trying to port
minandmaxto UDFs in #11013, @edmondop found several places whereMinandMax(the existing built in aggregate functions) are special casedHere is
Max:datafusion/datafusion/physical-expr/src/aggregate/min_max.rs
Lines 77 to 82 in c2ea6b3
The problem with relying on
MinandMaxdirectly is that it is hard/impossible to switch Min/Max to be a user defined aggregates as seen in #11013Also, 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/MaxSpecifically, code that looks like this should be removed
and
Describe alternatives you've considered
Ideally, the alternative is to use a function on
AggregateExprwhich we can then add/implement for UDAFs when we port min/max to be a UDAFTask List
Min/Maxreferences fromAggregateExec::get_minmax_descr#11152Min/Maxreferences fromAggregateStatistics#11153Additional context
No response