A data engineer runs the following code on a classic Azure Databricks cluster. Photon is disabled, and all Spark settings use their default values.
orders = spark.read.table("sales.orders").repartition(400)
customers = spark.read.table("sales.customers")
result = orders.join(customers, "customer_id")
The customers data is about 45 MB when the join runs. The join runs as a sort-merge join. In the Spark UI, the Summary Metrics of the join stage show a Max task duration more than three times the 75th percentile. Further investigation confirms that a few disproportionately large partitions account for the slow tasks and their spill. The stage metrics are shown in the exhibit.
| Stage | Duration | Shuffle Read | Shuffle Write | Shuffle Spill (Memory) | Shuffle Spill (Disk) |
|---|---|---|---|---|---|
| Join stage | 9.2 min | 38.6 GiB | 0 B | 21.4 GiB | 7.9 GiB |
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
| Statement | Yes | No |
|---|---|---|
| With the cluster's default configuration, AQE can automatically broadcast the customers DataFrame when converting this join at runtime. The source gives a default runtime broadcast threshold of 30 MB for spark.databricks.adaptive.autoBroadcastJoinThreshold. At about 45 MB, customers exceeds that threshold and is not eligible for automatic broadcast. | Correct | |
| The repartition(400) call on orders triggers a full shuffle of the orders data. Each call to repartition() triggers a full shuffle, so this call adds shuffle work; avoiding unnecessary repartitioning is one way to reduce shuffle. | Correct | |
| Because the stage shows both spill and skew, the engineer should address the skew before adding worker memory to reduce the spill. Spill often accompanies skew because one oversized partition spills to disk. The guidance is to address skew first, as the spill often resolves as a side effect. | Correct |
The 45 MB customers input exceeds AQE's default 30 MB runtime broadcast threshold, so AQE cannot automatically broadcast that input under the current settings. The repartition(400) operation introduces a full shuffle of orders. Non-zero spill metrics indicate memory pressure, and the investigation confirms that oversized partitions cause the slow tasks and spill. Addressing that skew first can reduce spill without adding worker memory.