aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/window/current/session.sql
blob: 10ae2c44d35ec432e49c320a6ee791b38be81326 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* syntax version 1 */
/* postgres can not */

SELECT
    user,
    ts,
    payload,
    AGGREGATE_LIST(ts) over w as ts_session,
    COUNT(1) over w as session_len,
FROM plato.Input
WINDOW w AS (
    PARTITION BY user, SessionWindow(ts, 10)
    ORDER BY ts
)
ORDER BY user, payload;