Consider a stream processing application using session windows to analyze some data. The session window has a defined gap of 5. Watermarks are generated by the processing engine based on a heuristic. Watermarks are used to trigger completed windows, i.e., watermarks are the only event type that produces output values. The stream is unordered and watermarks are used to indicate the maximum allowed lateness for events.
The following stream consisting of events and watermarks is given as:
(1, 8); (3, 2); (5, 4); w8; (14, 8); (12, 9); (18, 9); w16; w19; (24, 11); w24; (26, 17); w33
The events are composed of a timestamp t and a value v, so we have tuples of (t, v). A watermark with a timestamp i is given as wi. The events are processed in the order given above.
State in the table below if a window is completed at watermark i. If so, calculate the sum of the values of the current window.