Databricks Machine Learning Professional Question 181
Select 2You are working on a real-time data ingestion pipeline using Apache Spark Structured Streaming in Databricks. The data is being streamed from IoT sensors, and you notice that some events are arriving out-of-order due to network delays. Which of the following mechanisms in Structured Streaming can help you handle this scenario effectively?
- A
Use watermarking to define a threshold for late data arrival.
- B
Increase the trigger interval to minimize out-of-order data.
- C
Apply the
dropDuplicatestransformation to ensure unique records. - D
Set the event-time column and specify a window duration for aggregations.
- E
Enable checkpointing to prevent data loss during late arrivals.
Show answer and explanation
Correct answers: A, D
Explanation
In Structured Streaming, out-of-order data can be effectively handled by using watermarking and defining event-time-based window aggregations. Watermarking sets a threshold for late data, allowing the system to process slightly delayed events while discarding excessively late ones. Event-time-based windows ensure that time-based calculations respect the actual event times rather than processing times, making them robust to out-of-order arrivals.
- A. Correct.
Watermarking allows you to define a time threshold for late-arriving data. Events later than this threshold are dropped, ensuring the system can handle out-of-order data efficiently.
- B. Incorrect.
Increasing the trigger interval impacts the frequency of processing batches but does not directly address out-of-order data.
- C. Incorrect.
The
dropDuplicatestransformation removes duplicate records but does not solve issues related to out-of-order event arrival. - D. Correct.
Setting the event-time column and specifying a window duration allows aggregations to account for event-time semantics, which is critical when handling out-of-order data.
- E. Incorrect.
Checkpointing ensures fault tolerance and prevents data loss during failures, but it does not address out-of-order event handling.