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 182 discussion

The code block shown below contains an error. The code block is intended to return a new DataFrame where column productCategories only has one word per row, resulting in a DataFrame with many more rows than DataFrame storesDF. Identify the error and how to fix it.

A sample of storesDF is displayed below:



storesDF.withColumn("productCategories", split(col("productCategories")))

  • A. The split() operation does not accomplish the requested task in the way that it is used. It should be used provided an alias.
  • B. The split() operation does not accomplish the requested task. The broadcast() operation should be used instead.
  • C. The split() operation does not accomplish the requested task in the way that it is used. It should be used as a column object method instead.
  • D. The split() operation does not accomplish the requested task. The explode() operation should be used instead.
  • E. The split() operation does not accomplish the requested task. The array_distinct() operation should be used instead.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
58470e1
1 week, 1 day ago
Selected Answer: D
https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.explode.html?highlight=explode#pyspark.sql.functions.explode
upvoted 2 times
...
Oks_An
2 months ago
Selected Answer: D
Based on the condition "column productCategories only has one word per row, resulting in a DataFrame with many more rows than DataFrame storesDF" there should be an explode() function
upvoted 3 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 ...