Why can window functions only have fixed window sizes?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Why can window functions only have fixed window sizes?

Daniel Stojanov
Hi,


My understanding of window functions is that they can only operate on
fixed window sizes. For example, I can create a window like the following:

   
Window.partitionBy("group_identifier").orderBy("sequencial_counter").rowsBetween(-4,
5)

or even:

   
Window.partitionBy("group_identifier").orderBy("sequencial_counter").rowsBetween(Window.unboundedPreceding,
Window.unboundedFollowing)

one of these boundaries can be a fixed value, thus giving a different
sized window for some rows. However, it is my understanding that the
following is not possible:

   
Window.partitionBy("group_identifier").orderBy("sequencial_counter").rowsBetween(F.col("back_counter"),
F.col("forward_counter"))


I guess that a proper answer requires a deeper understanding of window
functions than I have now.

Why is it that data in a current row cannot be used to set the window
used to calculate the new value for that row?


Regards,



signature.asc (849 bytes) Download Attachment