Which of the following code blocks attempts to cache the partitions of DataFrame storesDF only in Spark’s memory?
Which of the following code blocks attempts to cache the partitions of DataFrame storesDF only in Spark’s memory?
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.
D. storesDF.persist(StorageLevel.MEMORY_ONLY).count()