QuestionQ275

VerifiedTroubleshooting and Tuning Apache Spark DataFrame API Applications.

To improve performance, a developer chooses to reduce a DataFrame’s number of partitions to 100. The developer must decide whether to use coalesce() or repartition() for this operation.

What is the behavior of these two functions?

Explanation

When decreasing a DataFrame’s partition count, coalesce() merges existing partitions through a narrow dependency and minimizes data shuffling. repartition() redistributes the data across the requested partitions by adding a shuffle step.

Learn more

Community Discussion

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