QuestionQ1

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

A data engineer creates a large Spark DataFrame, df, with 1,000 partitions and needs to decrease it to 100 partitions.

Which method offers the ability to reduce the number of partitions without reshuffling data between them?

Explanation

DataFrame.coalesce(100) reduces the DataFrame to 100 partitions without a shuffle by combining existing partitions through a narrow dependency. Apache Spark specifically documents the 1,000-to-100 partition example as avoiding a shuffle.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!