Click to copy
Queries • Reviewed for ksqlDB 0.29
How to Get Distinct Values Within Window in ksqlDB
T
o select distinct values within a window
, use COLLECT_SET
:
SELECT
true,
collect_set(category)
FROM posts
WINDOW TUMBLING (SIZE 1 HOUR)
GROUP BY true
EMIT CHANGES;
It returns an array, so you can use an array function to further aggregate the result.
Was this article helpful?