
Answer-first summary for fast verification
Answer: storesDF.write.mode(“overwrite”).parquet(filePath)
The correct code block must use the DataFrameWriter's methods correctly. Option C uses `write.mode("overwrite").parquet(filePath)`, which is the proper syntax for writing a DataFrame as Parquet, overwriting existing files. Other options have issues: A uses incorrect syntax for `write`, B incorrectly calls `write()`, D misuses `option` and `path`, and E uses `path` instead of `parquet` or `save`.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
Which of the following code blocks writes the DataFrame storesDF to the file path filePath as Parquet format, overwriting any existing files at that location?
A
storesDF.write(filePath, mode = “overwrite”)
B
storesDF.write().mode(“overwrite”).parquet(filePath)
C
storesDF.write.mode(“overwrite”).parquet(filePath)
D
storesDF.write.option(“parquet”, “overwrite”).path(filePath)
E
storesDF.write.mode(“overwrite”).path(filePath)
No comments yet.