How to get only the last aggregated value for a window?

Viewed 142

I would like to aggregate a Kafka topic with a tumbling window and get only the last aggregated value for each window.

With the code, pasted below, the aggregated value is updated each time a new event arrives. So I get as many aggregated values as number of incoming events. I would like to have a topic with only last aggregated value for each window. Is it possible to achieve that (with ksqldb)?

CREATE TABLE all_pieces_tumbling AS
SELECT ResourceID, SUM(Value)
FROM all_pieces_stream
WINDOW TUMBLING (SIZE 1 MINUTE)
WHERE EventType = 23
GROUP BY ResourceID;
1 Answers
Related