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

Certified Associate Developer for Apache Spark Exam - Question 113


Which of the following code blocks reads a CSV at the file path filePath into a Data Frame with the specified schema schema?

Show Answer
Correct Answer: C

To read a CSV file into a DataFrame with a specified schema using Spark, you would use the spark.read.schema method and provide the schema as an argument. The correct syntax for doing this is spark.read.schema(schema).csv(filePath), where schema is the variable containing the schema definition and filePath is the path to the CSV file.

Discussion

2 comments
Sign in to comment
Sowwy1Option: C
Apr 2, 2024

It's C

SaiPavan10Option: C
Apr 4, 2024

C is the right choice