QuestionQ159

VerifiedStructured Streaming

A data engineer is building a streaming pipeline that uses watermarking to handle late-arriving records. The engineer has written this code:

inputStream  
.withWatermark ("event_time", "10 minutes")  
.groupBy (window ("event_time", "15 minutes"))  
.count ()  

What occurs to data that arrives after the watermark threshold?

Explanation

A 10-minute event-time watermark allows windowed aggregation state to retain and process late records whose event_time is within 10 minutes of the latest observed event time. The 15-minute duration defines the aggregation windows but does not extend the allowed lateness. Once the watermark has advanced past an older window, its state can be finalized and late records for it can be discarded. Spark computes the watermark from the maximum observed event time minus the configured delay; the actual watermark may lag further because it is coordinated across partitions.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!