DE Mastery GitHub

Apache Spark · SPK-07

Partitioning, bucketing, and the small-file problem

From your world. Redshift DISTKEY / SORTKEY; Athena/Iceberg partitioning and file sizing

Practice quiz with instant feedback. For a scored run that counts toward your local progress, use uv run de quiz SPK-07.

1What is the key difference between repartition(n) and coalesce(n)?
2A selective filter leaves a small result spread over 200 partitions. You want ~4 output files, and you want to do it cheaply. Which is best?
3What determines the (approximate) number of output files that a single write produces?
4Why is partitionBy('customer_id') on a high-cardinality column usually a mistake?
5How does bucketing let two tables join without a shuffle at read time?
6Why is coalesce(1) on a very large DataFrame dangerous?
7repartition(n) vs partitionBy(col) — what is the correct distinction?