Databricks Certified Associate Developer for Apache Spark — Question 130
The code block shown below should return a new 12-partition DataFrame from DataFrame storesDF. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.
Code block:
__1__.__2__(__3__)
Answer options
- A. 1. storesDF 2. coalesce 3. 4
- B. 1. storesDF 2. coalesce 3. 4, "storeId"
- C. 1. storesDF 2. repartition 3. "storeId"
- D. 1. storesDF 2. repartition 3. 12
- E. 1. storesDF 2. repartition 3. Nothing
Correct answer: D
Explanation
The correct answer is D because the repartition method is used to increase the number of partitions, in this case to 12. Option A and B use coalesce, which is intended for reducing partitions, while C incorrectly suggests using a column name instead of a partition count.