aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/aggregate/group_by_session.sql
blob: 5faa7d4e14593490d71ab68a39a5fceaaa8723bd (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 BY SessionWindow(ts, 10), user
ORDER BY user, session_start;