QuestionQ271

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

The code block below contains an error. It is intended to create a single-column DataFrame from the Scala List years, which consists of integers. Identify the error.

spark.createDataset(years)  
Explanation

createDataset(years) creates a typed Dataset[Int] from the Scala collection (provided the required implicit encoder is in scope). A Spark DataFrame is the untyped Dataset[Row] view; toDF converts the typed dataset to that DataFrame representation. Apache Spark SparkSession API

Learn more

Community Discussion

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