aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/aggregate/group_by_session_distinct.sql
blob: 9a6e3c848bfc92b280cbc645686e66306876b7fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
/* 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,
    COUNT(DISTINCT payload) as distinct_playloads
FROM plato.Input
GROUP BY SessionWindow(ts, 10), user
ORDER BY user, session_start;