Ultimate access to all questions.
Upgrade Now 🚀
Sign in to unlock AI tutor
Identify the error in the following code block intended to read JSON data from filePath into a DataFrame using the specified schema schema:
filePath
schema
spark.read.schema("schema").format("json").load(filePath)
A
The schema operation from read takes a schema object rather than a string — the argument should be schema.
B
There is no load() operation for DataFrameReader — it should be replaced with the json() operation.
C
The spark.read operation should be followed by parentheses in order to return a DataFrameReader object.
D
There is no read property of spark — spark should be replaced with DataFrame.
E
The schema operation from read takes a column rather than a string — the argument should be col("schema").