orders 16 GBcustomer_id = 42: 60 % of rowscustomers 200 MB · 2 M rowscustomers is over the 10 MB broadcast threshold → sort-merge join, both sides hash-partitioned by key
(a) salting
1 (off)
Off. Key 42 stays in one piece.
(b) AQE skew join
Skewed = over 5 × median (164 MB) and over 256 MB → cutoff 256 MB. Off.
(c) shuffle partitions
200
Key 42 → partition 162. A normal partition reads ~34 MB.
200tasks
0.54 smedian task
98.9 smax task
184×max ÷ median
104 sstage on 16 slots
goal: max < 2 × median
Shuffle partitions · bytes each join task reads200 partitions · max 9.6 GB
orders (other keys)orders with key 42customers
Join stage · task durations200 tasks · 0.2 s overhead + 1 s per 100 MB
median
2× median
taskstraggler (> 2× median)2× median
Summary metrics for 200 completed tasks
Metric
Min
25th
Median
75th
Max
Duration
0.52 s
0.53 s
0.54 s
0.55 s
98.9 s
Shuffle read
32 MB
33 MB
34 MB
35 MB
9.6 GB
One task does 60 % of the work. Every row with customer_id = 42 hashes to partition 162, so that task reads 9.6 GB while the others read ~34 MB. Try one of the fixes.
Baseline joinPySpark
from pyspark.sql import functions as F
spark.conf.set("spark.sql.shuffle.partitions", "200")
spark.conf.set("spark.sql.adaptive.enabled", "false") # on since 3.2
joined = orders.join(customers, "customer_id")
joined.write.mode("overwrite").parquet("s3://lake/orders_enriched/")
Model: task time = 0.2 s + bytes read ÷ 100 MB/s; salted keys are assumed to land in different partitions; AQE really splits at map-output block boundaries, so its chunks are a little uneven. Tip: salting only the hot key (F.when(F.col("customer_id") == 42, …)) avoids copying the whole customers table.