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

Certified Associate Developer for Apache Spark Exam - Question 81


The code block shown below contains an error. The code block is intended to print the schema of DataFrame storesDF. Identify the error.

Code block:

storesDF.printSchema.getAs[String]

Show Answer
Correct Answer: D

The printSchema member of DataFrame is an operation that prints the schema directly, so there is no need to call getAs. The correct way to print the schema of a DataFrame in this context is by using storesDF.printSchema().

Discussion

2 comments
Sign in to comment
cookiemonster42Option: D
Aug 1, 2023

question is formulated poorly, but most possibly it's D

azure_bimonsterOption: D
Feb 9, 2024

storesDF.printSchema() would be enough in this case