
Answer-first summary for fast verification
Answer: trigger(processingTime='5 seconds')
In Structured Streaming in Apache Spark, the `trigger` method is used to specify the timing of the stream processing. To set up a micro-batch processing interval, you use the `processingTime` parameter. Therefore, the correct code to process data every 5 seconds is `trigger(processingTime='5 seconds')`.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
In the context of a Structured Streaming job within Databricks, a data engineer has set up a process to read from an existing table, perform necessary data transformations, and write the results into a new table in a streaming fashion. To ensure that the streaming job processes data in micro-batches every 5 seconds, which line of code should the data engineer use to fill in the blank?
A
trigger('5 seconds')
B
trigger(continuous='5 seconds')
C
trigger(once='5 seconds')
D
trigger(processingTime='5 seconds')
No comments yet.