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

Certified Associate Developer for Apache Spark Exam - Question 146


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

Code block:

__1__.__2__.__3__(__4__).format("csv").__5__(__6__)

Show Answer
Correct Answer: B,E

To read a CSV file into a DataFrame with a specified schema using PySpark, the correct sequence of methods and arguments is as follows: First, 'spark' is the entry point for Spark. The 'read' method should be used next, as it is a property of 'spark' without parentheses. The 'schema' method should be applied to specify the schema before specifying the format of the file, here 'csv', followed by the 'load' method to finally read the file at the path specified in 'filePath'.

Discussion

5 comments
Sign in to comment
gowthamsaraOption: E
Jan 11, 2024

E is correct

AnweeeOption: E
Feb 4, 2024

It is E, 100 %

azure_bimonsterOption: E
Feb 9, 2024

E is right

SaiPavan10Option: E
Apr 4, 2024

E definetly

5effea7Option: E
Jul 12, 2024

E is correct. read is a property of spark. so spark.read(). is wrong. B is wrong.