Reading notes from 2017; technical explanations revised November 17, 2026. Architecture and scale observations refer to the source period.

Event time and processing time differ

An event can describe something that happened at 10:00 and reach the processor at 10:05. Event-time aggregation uses the first timestamp; processing-time monitoring observes when work actually runs. Confusing the two makes late data look like an arbitrary infrastructure delay.

A watermark trails the maximum event time observed according to a configured delay. Its use depends on the operator, output mode, and release. It can govern state cleanup; it is not a promise that every record older than one global timestamp will be dropped in every query.

A timestamped example

Suppose the largest observed event timestamp is 10:20 and the delay is ten minutes. A nominal watermark is 10:10. An event at 10:15 is late relative to the maximum, but still within that allowance. An event at 10:05 may arrive after state for its window has been finalized or discarded. Spark can also update the effective watermark between micro-batches, so inspect actual progress information.

For a Spark 3.5.3 exercise, use a timestamp column, withWatermark, and a windowed count. Choose append or update mode deliberately, then send the same late events and observe both output and state metrics.

Recovery is a separate mechanism

Watermarks bound state under the query’s rules. Checkpoints retain processing progress and state for restart. Test restart behavior and out-of-order arrival separately; a watermark is not a substitute for durable checkpoints.

Watermarks and Late Data in Structured Streaming

Conceptual illustration; labels describe responsibilities, not a deployment specification.

Source streaming-metrics processing overview

Source streaming-metrics processing overview. Historical source figure; attribution and context are in References.

Source event-time watermark example; interpret it with the operator and output mode

Source event-time watermark example; interpret it with the operator and output mode. Historical source figure; attribution and context are in References.

References