QuestionQ95

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

In which order should the following lines of code be executed to read a JSON file at the file path filePath into a DataFrame using the specified schema schema?

Lines of code:

  1. .json(filePath, schema = schema)
  2. .storesDF
  3. .spark \
  4. .read() \
  5. .read \
  6. .json(filePath, format = schema)
Explanation

Spark reads JSON into a DataFrame through the spark.read DataFrameReader, followed by json(filePath, schema = schema). This forms spark.read.json(filePath, schema = schema).

Community Discussion

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