QuestionQ211

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

Given a DataFrame, df, with 10 partitions, after executing:

result = df.coalesce(20)  

How many partitions will the resulting DataFrame contain?

Explanation

DataFrame.coalesce() does not increase the number of partitions. When a partition count larger than the current count is requested, Spark keeps the existing partition count; therefore, a DataFrame with 10 partitions remains at 10 partitions. For an increase, use repartition().

Learn more

Community Discussion

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