DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #97
The code block shown below should write DataFrame storesDF to file path filePath as parquet and partition by values in column division. Choose the response that correctly fills in the numbered…
The correct answer is B. 1. write. To write a DataFrame as partitioned Parquet, the correct method chain is: storesDF.write.partitionBy("division").parquet(filePath). Breaking this down for the blanks: (1) write - a property (no parentheses) that returns a DataFrameWriter; (2) partitionBy - the method that…
Question
The code block shown below should write DataFrame storesDF to file path filePath as parquet and partition by values in column division. Choose the response that correctly fills in the numbered blanks within the code block to complete this task. Code block:
storesDF.1.2(3).4(5)
Options
- A
- write
- B
- write
- C
- write
- D
- write()
- E
- write
How the community answered
(45 responses)- B87% (39)
- C4% (2)
- D2% (1)
- E7% (3)
Explanation
To write a DataFrame as partitioned Parquet, the correct method chain is: storesDF.write.partitionBy("division").parquet(filePath). Breaking this down for the blanks: (1) write - a property (no parentheses) that returns a DataFrameWriter; (2) partitionBy - the method that specifies the partition column; (3) "division" - the column name as a string; (4) parquet - the method that sets the format and triggers the write; (5) filePath - the destination path. Option B correctly has write without parentheses (it's a property, not a method call). Options with write() (parentheses) would cause an error.
Topics
Community Discussion
No community discussion yet for this question.