A scenario for a data engineer · Junior and up
The hourly totals come up short
Penny · Finance
Tuesday, 09:10
A Structured Streaming job on Databricks counts orders per hour into a Delta table, with a ten minute watermark. Phones that were offline send their orders hours later, and those rows are dropped. Finance noticed that yesterday's total is short.
What do you do?
Tap the one you would do. The answer opens below.
Show the best callThe best call
Lengthen the watermark to the lateness you really see, so each hour stays open for late rows.
The late orders land in the right hour, and old hours still close. An hour is final only once the watermark has passed.
Why
A watermark tells a streaming query how late data may arrive. Windows stay open that long, then close and free their state, and a row that comes later is dropped. In Structured Streaming that is withWatermark on the event time column.
Read it in the Databricks docs (opens in a new tab)The other two
- Works, at a price. Add a nightly batch job that recomputes yesterday from scratch.
- The totals come out right, a day late, and you now run and pay for two pipelines.
- A poor call. Filter out any event older than ten minutes so the numbers stop moving.
- The numbers are stable and wrong. Those late orders are real sales.
The words in this scenario
- Watermark.
- In a stream, how long to wait for events that arrive late. Once the watermark has passed a time window, the window is final and later rows for it are dropped. In the docs (opens in a new tab)
Go deeper on brickster.ai
- Structured Streaming: what changed recentlyNews, releases, videos and questions on it, gathered daily.
More scenarios
- The stream stopped on a new column · data engineer
- A small change to a running stream · data engineer
- Customers keep getting their old address back · data engineer
- All 47 scenarios
Had one like this at work? Send it to us: the best tickets come from real incidents.
Checked against the Databricks documentation on . brickster.ai is independent and is not affiliated with Databricks.