QuestionQ52

VerifiedTroubleshooting and Tuning Apache Spark DataFrame API Applications.

The code block below has an error. It is intended to return a new 12-partition DataFrame from the 8-partition DataFrame storesDF by causing a shuffle. Identify the error.

Code block:

storesDF.coalesce(12)  
Explanation

Spark DataFrame coalesce does not perform a shuffle and cannot increase the partition count; when more partitions than the current count are requested, the DataFrame retains its existing partition count. repartition(12) performs a shuffle and can create 12 partitions.

Learn more

Community Discussion

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