SpinTheMic
Pro

Explain it in 60 seconds

partitionBy on write and the small-files problem

Data Engineering · Spark · Intermediate

How does partitionBy work when writing data, and how can it cause a small-files problem?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • partitionBy creates one folder per partition value, like dt=2026-11-12.
  • Each task writes a file into every partition it has data for.
  • Many tasks times many partition values creates thousands of tiny files.
  • Fix by repartitioning by the partition column before writing.
  • Avoid partitioning on high-cardinality columns.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics