QuestionQ149

VerifiedTroubleshooting and Tuning Apache Spark DataFrame API Applications.

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

Code block:

storesDF.printSchema.getAs[String]  
Explanation

In Spark’s Scala API, printSchema() prints the DataFrame schema in tree form and returns Unit. Because it does not return a row or other value supporting getAs[String], no getAs call should follow it.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!