Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Associate Developer for Apache Spark All Questions

View all questions & answers for the Certified Associate Developer for Apache Spark exam

Exam Certified Associate Developer for Apache Spark topic 1 question 60 discussion

In what order should the below lines of code be run in order to read a JSON file at the file path filePath into a DataFrame with 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)

  • A. 3, 5, 6
  • B. 2, 4, 1
  • C. 3, 5, 1
  • D. 2, 5, 1
  • E. 3, 4, 1
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
azure_bimonster
9 months, 3 weeks ago
Selected Answer: C
we use the following structure: spark.read.json(filePath, schema=schemaName)
upvoted 1 times
...
juliom6
1 year ago
Selected Answer: C
C is correct: https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrameReader.json.html json function does not have a "format" parameter.
upvoted 2 times
...
ZSun
1 year, 5 months ago
storesDF = spark.read.json(filePath, schema = schema) C
upvoted 3 times
...
Jtic
1 year, 5 months ago
Selected Answer: B
2. .storesDF: This line is unrelated to reading the JSON file and can be disregarded. .read(): This line invokes the DataFrameReader's read() method to create a DataFrameReader object. .json(filePath, schema=schema): This line uses the DataFrameReader object to read the JSON file at the specified filePath into a DataFrame with the provided schema.
upvoted 1 times
pnev
10 months, 4 weeks ago
This is so wrong.. in order to read a table you need to use spark.read.json / parquet / Table.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...