The code block shown below should cache DataFrame storesDF only in Spark's memory. Choose the response that correctly fil ls in the numbered blanks within the code block to complete this task.
Code block:
__1__.__2__(__3__).count()
The code block shown below should cache DataFrame storesDF only in Spark's memory. Choose the response that correctly fil ls in the numbered blanks within the code block to complete this task.
Code block:
__1__.__2__(__3__).count()
To cache a DataFrame in Spark's memory, you use the persist method with the StorageLevel.MEMORY_ONLY parameter. The persist method allows you to specify storage levels, whereas cache defaults to MEMORY_AND_DISK. Therefore, the correct code block to cache storesDF only in memory is storesDF.persist(StorageLevel.MEMORY_ONLY).count().
E: df.persist(StorageLevel.MEMORY_ONLY).count()