QuestionQ183

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

In which order should the following lines of code run to read a Parquet file at the file path filePath into a DataFrame?

Lines of code:

  1. storesDF
  2. .load(filePath, source = "parquet")
  3. .read \
  4. spark \
  5. .read() \
  6. .parquet(filePath)
Explanation

PySpark accesses a DataFrameReader through the SparkSession.read property, and DataFrameReader.parquet(path) loads Parquet files and returns a DataFrame. Thus the expression is spark.read.parquet(filePath).

Learn more

Community Discussion

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