QuestionQ31

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

The code block below contains an error. It is intended to read a parquet file at the file path filePath into a DataFrame. Identify the error.

spark.read.load(filePath, source – "parquet")  
Explanation

In the Scala Spark API, DataFrameReader.load accepts a path or paths and has no source parameter. Parquet is Spark’s default data source, so spark.read.load(filePath) reads the Parquet data when the default format has not been changed.

Learn more

Community Discussion

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