Skip to content

User defined window functions #5781

Closed
@alamb

Description

@alamb

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:

https://github.com/apache/arrow-datafusion/blob/8139ed40d06d77498217438ff52fe73a4ea16f61/datafusion-examples/examples/simple_udaf.rs#L18-L19

This would likely involve

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions