Windowing & State Stores

Time is the hardest column in any streaming SQL.

0/3 done

Windows, grace, state

Windows + state

Three canonical window types:

  • Tumbling — fixed, non-overlapping intervals (1m).
  • Hopping — fixed intervals, overlap (1m advance 10s).
  • Session — variable, driven by inactivity gap.

Each window aggregation has a state store (RocksDB by default), checkpointed to a compacted changelog topic so failover replays exactly.

Event-time vs processing-time matters: late records arriving after the window's grace period are dropped. Set the grace honestly.

1-minute tumbling window: orders per minute (Python)

Group the orders stream into 1-minute tumbling windows and emit a count per window.

Reflect

Pick one analytic in your stack currently computed nightly.

  • What's the natural window? Tumbling, hopping, or session?
  • How late can a record arrive before the metric becomes wrong?

Reading in progress · 0 of 3 activities done