Analytic UDFs: Support for the partitioning clause

Dear Exasol,

the documentation provides an example of an analytic user-defined aggregate function my_sum: UDF Scripts - Examples | Exasol DB Documentation

This function can be executed using the following syntax:

SELECT my_sum(x ORDER BY x) FROM t;

Here, the ORDER BY clause acts similarly to the common SQL window function pattern:

aggregate(x) OVER (ORDER BY some_column)

Would it be possible to extend this feature to also support the PARTITION BY clause in UDFs?
In other words, an equivalent to the syntax:

aggregate(x) OVER (PARTITION BY some_column)

Such an extension would be very useful for more granular, partition-aware UDFs, for example in the implementation of the ML clustering.

Looking forward to your feedback!

4 Likes

I have also occasionally wished we could define window functions using UDFs. Although it’s usually possible to emulate it via various subselects/CTEs it would be much easier and clearer (and probably more performant) if UDFs could be used as window functions directly.

2 Likes

Hi @slavik_taubkin , thanks for sharing your great idea with us. We really appreciate your input and will take a closer look to see how this could fit into our roadmap.