One task runs for 38 minutes while 199 finish in seconds. Find the hot key and spread it out.
The nightly join of 1.4 TB of clickstream to accounts sits at 199/200 tasks of its join stage for over half an hour. The progress bar says 99%, the cluster is idle except for one core, and the job ends up taking 58 minutes.
Adding executors won't move it: the remaining work is all waiting in a single task. This is data skew: one partition got far more data than the others.
clicks = spark.read.parquet("s3://lake/clicks/") # 1.4 TB
accounts = spark.read.parquet("s3://lake/accounts/") # 60 GB
joined = clicks.join(accounts, "account_id")
joined.write.mode("overwrite").parquet("s3://lake/clicks_enriched/")Reach the last step for the run summary: the key takeaways from this lesson.