session_aliases_compact.sql 412 B

12345678910111213141516171819
  1. /* syntax version 1 */
  2. /* postgres can not */
  3. SELECT
  4. user,
  5. ts,
  6. SessionStart() over w1 as ss1,
  7. SessionStart() over w as ss,
  8. ListSort(AGGREGATE_LIST(ts) over w) as ts_session,
  9. COUNT(1) over w as session_len,
  10. FROM plato.Input
  11. WINDOW w AS (
  12. PARTITION COMPACT BY user, SessionWindow(ts, 10) as ss0
  13. ),
  14. w1 AS (
  15. PARTITION COMPACT BY SessionWindow(ts, 10), user
  16. )
  17. ORDER BY user, ts;