I'd like to create a custom Window function that processes a sorted stream of doubles and produces a single output double per partition. It is mandatory for values to be sorted. The Window function can process a single row at the time (no need for look behind/ahead) as long as it can maintain an internal state per partition.
The signature will look something like this:
SELECT my_windows_func() OVER (PARTITION BY my_key ORDER BY my_val ASC) AS my_stuff
Now, I figured out how to create AggreagtionFunctions, ScalarFunctions, but with WindowFunctions I don't know where to start and could not find any documentation online.
Which interface should I implement for my usecase? Can I enforce users to add the ORDER BY
clause when they call it? Any sample code that I could refer to?