1. A data engineer profiles a Spark job that joins two large DataFrames and observes extreme task skew: most tasks complete in under 5 seconds, but a handful take over 8 minutes. Adaptive Query Execution (AQE) is enabled. Which AQE feature is most directly responsible for addressing this skew, and how does it work?
- A. Dynamic partition coalescing: AQE merges small shuffle partitions after the shuffle to reduce the number of tasks and eliminate the straggler tasks.
- B. Skew join optimization: AQE detects skewed partitions at runtime based on partition size statistics, splits the skewed partitions into smaller sub-partitions, and replicates the corresponding partition from the non-skewed side to process them in parallel.✓ Correct
- C. Broadcast join conversion: AQE converts the skewed side of the join into a broadcast variable, eliminating the shuffle entirely.
- D. Dynamic predicate pushdown: AQE rewrites the query plan to push filter predicates down to the scan stage, reducing the amount of data shuffled to the join.
Explanation
AQE's skew join optimization specifically targets data skew in shuffle-based joins. It detects which partitions are significantly larger than average, splits those large partitions into smaller chunks, and duplicates the matching partition from the other side so that work can be parallelized — directly solving the straggler task problem. Option A describes dynamic partition coalescing, which merges many small partitions into fewer larger ones — the opposite problem (too many small tasks, not a few huge ones). Option C is incorrect because AQE can convert joins to broadcast joins based on runtime size statistics, but this applies to cases where one side is small enough to broadcast; it does not help when one side has skewed but large partitions. Option D describes predicate pushdown, which is a Catalyst optimizer feature, not an AQE runtime skew optimization.