Click to copy
Queries • Reviewed for ksqlDB 0.29
How to Use Window Without Group By in ksqlDB
In ksqlDB, WINDOW
clauses require a GROUP BY
clause. A trick to overcome this limitation is to use a literal value like true
as a grouping key.
For example, this query collects the name of all the products within the window interval.
SELECT
true,
FROM_UNIXTIME(WINDOWSTART),
COLLECT_LIST(name)
FROM product_updates
WINDOW TUMBLING (SIZE 1 DAY)
GROUP BY true
EMIT CHANGES;
Was this article helpful?