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

The code block shown below should read a parquet at the file path filePath into a DataFrame. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.

Code block:

__1__.__2__.__3__(__4__)

    Correct Answer: A

    To read a parquet file into a DataFrame using PySpark, the correct syntax is `spark.read.parquet(filePath)`. Here, `spark` is the SparkSession object, `read` is a property that returns a DataFrameReader, and `parquet` is the method to read parquet files. `filePath` is the path to the parquet file.

Discussion
Sowwy1Option: E

E. 1. spark 2. read 3. load 4. filePath

azure_bimonsterOption: E

To me E is most likely correct Syntax: spark.read.load(filePath)

5effea7Option: E

It's E. read is a property of spark, not a method, so that makes the choice C or E. In C the parameter source is being assigned "parquet". Parquet is the format. So C is wrong. E is correct, because the default format is parquet.