Exam Certified Associate Developer for Apache Spark All QuestionsBrowse all questions from this 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__)

    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
SaiPavan10Option: B

B is the right choice