Window Type | Aggregation Group | Supported Partitioning Strategy |
---|---|---|
Reporting window | ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING | Hash partitioning |
Cumulative window |
|
Hash partitioning |
Moving window |
|
Hash partitioning and range partitioning |
Consider the following table definition:
CREATE TABLE t (id INTEGER, v INTEGER);
The following query specifies a reporting window of rows which the window aggregate UDF MYSUM operates on:
SELECT id, v, MYSUM(v) OVER (PARTITION BY id ORDER BY v) FROM t;
The following query specifies a cumulative window of rows which the window aggregate UDF MYSUM operates on:
SELECT id, v, MYSUM(v) OVER (PARTITION BY id ORDER BY v ROWS UNBOUNDED PRECEDING) FROM t;
The following query specifies a moving window of rows which the window aggregate UDF MYSUM operates on:
SELECT id, v, MYSUM(v) OVER (PARTITION BY id ORDER BY v ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) FROM t;