⚙️Watermark (Stream Processing)
Also known as Watermark, Event-Time Watermark
A line that says no older events are expected now.
Think of it like
It is like a teacher saying the test is closed. Papers that come in after that are marked late.
Example
With a 5-minute watermark, the 10:00 to 10:05 window closes once an event stamped 10:10 has been seen.
Why it matters
Without it, a stream would never know when to give a final count. It sets the trade between being right and being fast.
Definition
Example code
sql
CREATE TABLE clicks (
page STRING,
ts TIMESTAMP(3),
WATERMARK FOR ts AS ts - INTERVAL '5' SECOND
) WITH ('connector' = 'kafka', ...);Common mistake
Key takeaways
- 1How far event time got. A best guess.
- 2Closes windows. Then results are sent.
- 3Delay is a trade. More right or more fast.