
Ultimate access to all questions.
Which query is performing a streaming hop from raw data to a Bronze table?
A
(spark.table("sales")
.groupBy("store")
.agg(sum("sales"))
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("complete")
.table("newSales"))
(spark.table("sales")
.groupBy("store")
.agg(sum("sales"))
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("complete")
.table("newSales"))
B
(spark.read.load(rawSalesLocation)
.write
.mode("append")
.table("newSales"))
(spark.read.load(rawSalesLocation)
.write
.mode("append")
.table("newSales"))
C
(spark.table("sales")
.withColumn("avgPrice", col("sales") / col("units"))
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("append")
.table("newSales"))
(spark.table("sales")
.withColumn("avgPrice", col("sales") / col("units"))
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("append")
.table("newSales"))
D
(spark.readStream.load(rawSalesLocation)
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("append")
.table("newSales"))
(spark.readStream.load(rawSalesLocation)
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("append")
.table("newSales"))
Explanation:
Option D is the correct answer because:
spark.readStream.load(rawSalesLocation) which indicates reading from a streaming source (raw data)..writeStream to write to a table, making it a true streaming pipeline.Why other options are incorrect:
spark.table("sales") - this reads from an existing table, not raw data. It's processing an already ingested table.spark.read.load() (batch read) and .write (batch write) - no streaming involved at all.spark.table("sales") - processing existing table data, not raw streaming data.Key Concept: A "streaming hop from raw data to a Bronze table" specifically requires reading from a streaming source (like files arriving in cloud storage, Kafka, etc.) and writing to a table using streaming APIs. This is the foundation of incremental data processing in Databricks.