Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Associate Developer for Apache Spark All Questions

View all questions & answers for the Certified Associate Developer for Apache Spark exam

Exam Certified Associate Developer for Apache Spark topic 1 question 166 discussion

The code block shown below contains an error. The code block is intended to read JSON at the file path filePath into a DataFrame with the specified schema schema. Identify the error.

Code block:

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").
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Sowwy1
7 months, 2 weeks ago
A. The schema operation from read takes a schema object rather than a string — the argument should be schema.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...