Closed
Description
Is your feature request related to a problem or challenge?
When implementing our InfuxQL frontend for DataFusion, we found certain functions we would like to express as window functions (like a specialized interpolation function for example)
We can write user defined aggregates:
select
x, my_aggregate(x, time)
from t;
But those do not produce the same number of rows that go in (they reduce cardinality)
We would like to use our own window functions like
select
x, my_interpolation_function(x, time) OVER (PARTITION BY y, ORDER BY time)
from t;
Describe the solution you'd like
I would like the ability to define, and register user defined window functions , like we have for user defined aggregate functions:
This would likely involve
- Some sort
WindowUDF
(likeAggregateUDF
) - Register on function registry: https://github.com/apache/arrow-datafusion/blob/8139ed40d06d77498217438ff52fe73a4ea16f61/datafusion/execution/src/registry.rs#L25
- Some sort of
WindowExprFunctionImplementation
like https://github.com/apache/arrow-datafusion/blob/8139ed40d06d77498217438ff52fe73a4ea16f61/datafusion/expr/src/function.rs#L48 - Expose the
WindowExpr
trait: https://github.com/apache/arrow-datafusion/blob/8139ed40d06d77498217438ff52fe73a4ea16f61/datafusion/physical-expr/src/window/window_expr.rs#L38-L143
It isn't clear to me if we would want to expose AggregateWindowExpr
, for example
Describe alternatives you've considered
No response
Additional context
No response