Databricks Certified Associate Developer for Apache Spark

Databricks Certified Associate Developer for Apache Spark

Get started today

Ultimate access to all questions.


What is the correct order of the following lines of code to write DataFrame storesDF to file path filePath as Parquet format partitioned by values in the column "division"?

Lines of code:

  1. storesDF \
  2. .write \
  3. .partitionBy("division") \
  4. .parquet(filePath)





Explanation:

To correctly write the DataFrame storesDF to a file path as parquet and partition by the 'division' column, the sequence must start with the DataFrame, followed by .write, then .partitionBy('division'), and finally .parquet(filePath). The correct sequence is option C: 4, 6, 2, 3. This sequence ensures that the DataFrame is written in the desired format and partitioned correctly. Other options either use incorrect methods or do not partition the data as required.