Core concept

df.coalesce(10)      // avoids shuffle, only reduces
df.repartition(200)  // full shuffle
Advertisement

How it works

coalesce quick but may skew. repartition costs shuffle.

Advertisement

Trade-offs + gotchas

Reduce output files: coalesce. Rebalance: repartition.