nerdexam
Databricks

DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #132

The code block shown below contains an error. The code block intended to create a single- column DataFrame from Scala List years which is made up of integers. Identify the error. Code block: spark.cre

Sign in or unlock DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK to reveal the answer and full explanation for question #132. The question stem and answer options stay visible for context.

Spark DataFrame and Dataset Operations - API Usage

Question

The code block shown below contains an error. The code block intended to create a single- column DataFrame from Scala List years which is made up of integers. Identify the error. Code block:

spark.createDataset(years)

Options

  • AThe years list should be wrapped in another list like List(years) to make clear that it is a column
  • BThe data type is not specified - the second argument to createDataset should be IntegerType.
  • CThere is no operation createDataset - the createDataFrame operation should be used instead.
  • DThe result of the above is a Dataset rather than a DataFrame - the toDF operation must be called
  • EThe column name must be specified as the second argument to createDataset.

Unlock DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK to see the answer

You've previewed enough free DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK questions. Unlock DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#Spark Datasets#API methods#Type specification#DataFrame creation
Full DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Practice