AQE skew-join handling
How Spark detects oversized partitions in sort-merge joins and splits them automatically.
Step 2 · Spark internals · Gold · Skew, lesson 2 of 2
On this page
Read first: Adaptive Query Execution · Data skew and salting (skip if you know them)
In plain words first
A teacher notices mid-exam that one marker has five times as many papers as the others, and splits that pile between three markers on the spot. Nobody had to plan it in advance.
That is AQEAQE: Adaptive Query Execution: Spark re-plans a running query using the real data sizes it has measured. Learn more →'s skewskew: When one key has far more rows than the others, so one task does most of the work while the rest wait. Learn more → join handling: it measures partitionpartition: A chunk of a DataFrame's rows. Spark processes each partition as one task, so partitions decide how much work runs in parallel. Learn more → sizes after the shuffleshuffle: Moving rows between machines so that all rows with the same key end up together. Needed by joins, groupBy and sorting, and usually the most expensive step of a job. Learn more → and splits the oversized ones.
Unlock the full lesson
You have read the free part. The rest of this advanced lesson:
- When a partition counts as skewed
- How the split works
- Supported joins
- Tuning and verifying
- Try it yourself
- Common mistakes
- Key takeaways
- Interview prep with 3 follow-up questions
- Check yourself: 3 questions
Unlock it with the Complete pass (every advanced problem and lesson) or on its own.
Practise this
Problems that use this, graded on hidden tests
Keep going
Up next · new module: Under the hood · 6 min readCatalyst and physical plans
Read explain() output: parsed, analyzed and optimized plans, and the physical plan Spark runs.
Related lessons
Adaptive Query ExecutionSpark internals · 8 min read
Data skew and saltingSpark internals · 6 min read
Broadcast joins
Previous: Data skew and salting
Primary sources: AQE: optimizing skew join