
Databricks Certified Associate Developer for Apache Spark
Get started today
Ultimate access to all questions.
The following code block should cache the DataFrame storesDF
exclusively in Spark's memory. Select the option that accurately fills in the numbered blanks within the code block to accomplish this task.
Code block:
1.2(3).count()
The following code block should cache the DataFrame storesDF
exclusively in Spark's memory. Select the option that accurately fills in the numbered blanks within the code block to accomplish this task.
Code block:
1.2(3).count()
Explanation:
The question requires caching the DataFrame storesDF
only in Spark's memory. To achieve this, the correct methods are cache()
(which defaults to StorageLevel.MEMORY_ONLY
) or persist(StorageLevel.MEMORY_ONLY)
. Option C uses cache()
without parameters, which is equivalent to persist(StorageLevel.MEMORY_ONLY)
, caching in memory only. Option E uses persist(StorageLevel.MEMORY_ONLY)
, explicitly setting the storage level to memory-only. Other options either use invalid syntax or do not specify memory-only caching.