44 of 55. A data engineer is working on a real-time analytics pipeline using Spark Structured Streaming. They want the system to process incoming data in micro-batches at a fixed interval of 5 seconds.
Which code snippet fulfills this requirement?
A.
query = df.writeStream \
.outputMode("append") \
.trigger(processingTime="5 seconds") \
.start()
B.
query = df.writeStream \
.outputMode("append") \
.trigger(continuous="5 seconds") \
.start()
C.
query = df.writeStream \
.outputMode("append") \
.trigger(once=True) \
.start()
D.
query = df.writeStream \
.outputMode("append") \
.start()
To process data in fixed micro-batch intervals, use the .trigger(processingTime='interval') option in Structured Streaming.
Correct usage:
query = df.writeStream
.outputMode('append')
.trigger(processingTime='5 seconds')
.start()
This instructs Spark to process available data every 5 seconds.
Why the other options are incorrect:
B: continuous triggers are for continuous processing mode (different execution model).
C: once=True runs the stream a single time (batch mode).
D: Default trigger runs as fast as possible, not fixed intervals.
PySpark Structured Streaming Guide --- Trigger types: processingTime, once, continuous.
Databricks Exam Guide (June 2025): Section ''Structured Streaming'' --- controlling streaming triggers and batch intervals.
===========
Jodi
3 months agoTabetha
3 months agoZita
3 months agoLaura
3 months agoMagdalene
3 months agoFletcher
3 months agoAn
4 months agoHolley
4 months agoCathrine
4 months agoPearly
5 months agoChan
5 months agoJulian
5 months agoTarra
5 months agoReuben
5 months agoPamella
5 months agoGlory
6 months agoJoanna
6 months agoLeota
6 months agoTamra
6 months agoAmie
6 months agoBrittani
6 months agoEugene
7 months agoGlenna
7 months agoWilbert
7 months agoTricia
8 months agoLavonda
8 months agoNan
2 months agoMaddie
2 months agoAretha
2 months agoDelsie
7 months agoKiley
7 months ago