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
1 month agoTabetha
1 month agoZita
1 month agoLaura
2 months agoMagdalene
2 months agoFletcher
2 months agoAn
2 months agoHolley
2 months agoCathrine
2 months agoPearly
3 months agoChan
3 months agoJulian
3 months agoTarra
4 months agoReuben
4 months agoPamella
4 months agoGlory
4 months agoJoanna
4 months agoLeota
4 months agoTamra
5 months agoAmie
5 months agoBrittani
5 months agoEugene
5 months agoGlenna
5 months agoWilbert
5 months agoTricia
6 months agoLavonda
6 months agoNan
15 days agoMaddie
20 days agoAretha
26 days agoDelsie
6 months agoKiley
6 months ago