
Ultimate access to all questions.
Which of the following Structured Streaming queries is performing a hop from a Silver table to a Gold table?
A
(spark.readStream.load(rawSalesLocation)
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("append")
.table("newSales"))
(spark.readStream.load(rawSalesLocation)
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("append")
.table("newSales"))
B
(spark.read.load(rawSalesLocation)
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("append")
.table("newSales"))
(spark.read.load(rawSalesLocation)
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("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.table("sales")
.filter(col("units") > 0)
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("append")
.table("newSales"))
(spark.table("sales")
.filter(col("units") > 0)
.writeStream
.option("checkpointLocation", checkpointPath)
.outputMode("append")
.table("newSales"))
E
(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"))
Explanation:
In Databricks Lakehouse architecture, data typically flows through different quality tiers:
A hop from Silver to Gold means transforming Silver-level data (already cleaned and validated) into aggregated, business-ready Gold tables.
Let's analyze each option:
Option A: Reads from rawSalesLocation (likely Bronze/raw data) and writes to newSales. This is a Bronze-to-Silver hop, not Silver-to-Gold.
Option B: Uses spark.read.load() (batch read) with writeStream (streaming write) - this is incorrect syntax and doesn't represent a proper hop.
Option C: Reads from sales table (could be Silver) and performs a simple transformation (avgPrice calculation), then writes to newSales. This is a simple transformation but not necessarily a Silver-to-Gold hop as it doesn't involve aggregation.
Option D: Reads from sales table (could be Silver) and performs filtering, then writes to newSales. This is filtering, not aggregation for Gold tables.
Option E: Reads from sales table (Silver), performs aggregation (groupBy and sum), and writes to newSales with complete output mode. This represents a Silver-to-Gold hop because:
sales) which is likely a Silver tablegroupBy and agg) which is typical for Gold table transformationscomplete output mode which is appropriate for aggregated resultsThe key indicators of a Silver-to-Gold hop are: