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 57 discussion

Which of the following code blocks writes DataFrame storesDF to file path filePath as JSON?

  • A. storesDF.write.option("json").path(filePath)
  • B. storesDF.write.json(filePath)
  • C. storesDF.write.path(filePath)
  • D. storesDF.write(filePath)
  • E. storesDF.write().json(filePath)
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
juliom6
1 year ago
Selected Answer: B
B is correct according documentation: https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrameWriter.json.html
upvoted 1 times
...
4be8126
1 year, 6 months ago
Selected Answer: B
The correct answer is B. Explanation: The write method is used to write a DataFrame to a file system in various formats. The json method specifies that the output format should be JSON. The filePath argument specifies the location to write the output file. Option A is incorrect because option requires a key-value pair (e.g., option("key", "value")). Option C is incorrect because path is not a valid option for write. Option D is incorrect because write method requires a format argument to specify the output format. Option E is a valid option, but the parentheses after write are unnecessary.
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 ...