Certified Associate Developer for Apache Spark Exam QuestionsBrowse all questions from this exam

Certified Associate Developer for Apache Spark Exam - Question 171


Which of the following code blocks attempts to cache the partitions of DataFrame storesDF only in Spark’s memory?

Show Answer
Correct Answer: D

The correct way to cache the partitions of DataFrame storesDF only in Spark's memory is by using the persist method with the StorageLevel.MEMORY_ONLY storage level. Therefore, the correct code block is storesDF.persist(StorageLevel.MEMORY_ONLY).count(). This ensures that the DataFrame is persistently stored in memory distinctively without spilling to disk.

Discussion

1 comment
Sign in to comment
Sowwy1Option: D
Apr 10, 2024

D. storesDF.persist(StorageLevel.MEMORY_ONLY).count()