aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/aggregate/group_by_session_compact.sql
blob: 1cbffd58bd27deaefa91edb5292fda82e285b1c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
/* syntax version 1 */
/* postgres can not */

SELECT
    user,
    MIN(ts) ?? 100500 as session_start,
    ListSort(AGGREGATE_LIST(ts ?? 100500)) as session,
    COUNT(1) as session_len
FROM plato.Input
GROUP COMPACT BY user, SessionWindow(ts, 10)
ORDER BY user, session_start;