QuestionQ258

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

The code block below must cache the DataFrame storesDF only in Spark memory. Choose the response that correctly fills the numbered blanks in the code block to complete this task.

__1__.__2__(__3__).count()  
Explanation

DataFrame.persist(StorageLevel.MEMORY_ONLY) explicitly selects Spark’s memory-only storage level before count() materializes the DataFrame. DataFrame.cache() and DataFrame.persist() without a storage-level argument use the DataFrame default, MEMORY_AND_DISK_DESER, rather than memory-only storage.

Learn more

Community Discussion

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