DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK-3-0 practice question 23 of 25
Which of the following code blocks reduces a DataFrame from 12 to 6 partitions and performs a full shuffle?
Full set: 180 questionsDataFrame.repartition(6) Correct. repartition() always triggers a full shuffle (different from coalesce()). DataFrame.repartition(12) No, this would just leave the DataFrame with 12 partitions and not 6. DataFrame.coalesce(6) coalesce does not perform a full shuffle of the data. Whenever you see "full shuffle", you know that you are not dealing with coalesce(). While coalesce() can perform a partial shuffle when required, it will try to minimize shuffle operations, so the amount of data that is sent between executors. Here, 12 partitions can easily be repartitioned to be 6 partitions simply by stitching every two partitions into one. DataFrame.coalesce(6, shuffle=True) and DataFrame.coalesce(6).shuffle() These statements are not valid Spark API syntax. More info: Spark Repartition & Coalesce - Explained and Repartition vs Coalesce in Apache Spark - Rock the JVM Blog
Keep practicing
Take the free DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK-3-0 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK-3-0 practice questions
- Question 1The code block displayed below contains an error. The code block is intended to perform a…
- Question 2Which of the following code blocks shows the structure of a DataFrame in a tree-like way,…
- Question 3Which of the following code blocks reads the parquet file stored at filePath into DataFra…
- Question 4Which of the following code blocks returns a 2-column DataFrame that shows the distinct v…
- Question 5The code block shown below should return an exact copy of DataFrame transactionsDf that d…
- Question 6The code block displayed below contains an error. The code block should configure Spark t…
