Certified Associate Developer for Apache Spark Exam QuestionsBrowse all questions from this exam

Certified Associate Developer for Apache Spark Exam - Question 124


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__)

Show Answer
Correct Answer: B

The correct way to write a DataFrame to a parquet file in PySpark and partition it by a column involves using the methods 'write', 'partitionBy', and 'parquet'. The method 'write' initiates the process, 'partitionBy' specifies the column to partition by, and 'parquet' specifies the file format and path for saving. The correct sequence is therefore: storesDF.write.partitionBy('division').parquet(filePath).

Discussion

1 comment
Sign in to comment
SaiPavan10Option: B
Apr 4, 2024

B is the right choice