jay
04/11/2024, 5:13 PMIsmael Ghalimi
04/11/2024, 5:50 PMwindow
function. This looks more like a simple discretization (binning) function. For an example of window
function, I would look at DuckDB's:
https://duckdb.org/docs/sql/window_functions.html
What makes it a true window
function is the presence of sorting and grouping, alongside some row_number
or lag
, or group-level expressions that include some aggregations (e.g. amount / sum(amount)
.
Another way to think about it is that if you can execute what you are doing at the individual row level, it's not a window
. And your last example looks like a plain vanilla groupby
.
In other words, window
is inherently hard to implement...
Does that make sense?jay
04/11/2024, 8:55 PMIsmael Ghalimi
04/14/2024, 4:03 AMjay
04/15/2024, 9:08 PM