Mostly HarmlessWindows & triggers

Tumbling window

A tumbling window chops the stream into fixed, non-overlapping buckets of time, and every event lands in exactly one.

Also called: fixed window

TUMBLEfixed, contiguousHOPfixed, overlappingSESSIONcloses on a gapTIME
The same eight events, bucketed three ways. TUMBLE and HOP place fixed windows on the clock; SESSION places them where the data is, splitting on a gap.

Tumbling window - a fixed, non-overlapping bucket of time: a tumbling window chops the stream into equal slices and every event lands in exactly one of them. Five-minute windows means 10:00 to 10:05, then 10:05 to 10:10, forever. An event at 10:04:59 belongs to the first, one at 10:05:00 to the second, and nothing is ever counted twice.

The bucket is assigned from the event's own timestamp, not its arrival time, so an out-of-order event still lands in the right window; the window closes and emits once the watermark passes its end. And because the buckets sit on fixed clock boundaries, every job computing per-minute counts agrees on where the minutes are, which matters the day you compare two of them.

Do you need it? Yes. This is the window nearly every windowed query actually wants: per-minute counts, hourly revenue, daily rollups. In ubik it is TUMBLE(event_time, INTERVAL '1 MINUTE') in the GROUP BY, one output row per group, closed by the watermark. Boring, correct, done.

Sources

Related