Databricks Certified Associate Developer for Apache Spark — Question 104
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__)
Answer options
- A. 1.spark 2. read() 3. parquet 4. filePath
- B. 1. spark 2. read() 3. load 4. filePath
- C. 1. spark 2. read 3. load 4. filePath, source = "parquet"
- D. 1. storesDF 2. read() 3. load 4. filePath
- E. 1. spark 2. read 3. load 4. filePath
Correct answer: E
Explanation
The correct answer is E because 'spark.read.load(filePath)' is the appropriate method to read a parquet file into a DataFrame. Option A incorrectly uses 'parquet' instead of 'load', while B uses 'read()' which is not the correct method format. Option C adds an unnecessary 'source' parameter, and D incorrectly names the DataFrame variable.