nerdexam
Databricks

DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #97

The code block shown below should write DataFrame storesDF to file path filePath as parquet and partition by values in column division. Choose the response that correctly fills in the numbered…

The correct answer is B. 1. write. To write a DataFrame as partitioned Parquet, the correct method chain is: storesDF.write.partitionBy("division").parquet(filePath). Breaking this down for the blanks: (1) write - a property (no parentheses) that returns a DataFrameWriter; (2) partitionBy - the method that…

Spark I/O Operations

Question

The code block shown below should write DataFrame storesDF to file path filePath as parquet and partition by values in column division. Choose the response that correctly fills in the numbered blanks within the code block to complete this task. Code block:

storesDF.1.2(3).4(5)

Options

  • A
    1. write
  • B
    1. write
  • C
    1. write
  • D
    1. write()
  • E
    1. write

How the community answered

(45 responses)
  • B
    87% (39)
  • C
    4% (2)
  • D
    2% (1)
  • E
    7% (3)

Explanation

To write a DataFrame as partitioned Parquet, the correct method chain is: storesDF.write.partitionBy("division").parquet(filePath). Breaking this down for the blanks: (1) write - a property (no parentheses) that returns a DataFrameWriter; (2) partitionBy - the method that specifies the partition column; (3) "division" - the column name as a string; (4) parquet - the method that sets the format and triggers the write; (5) filePath - the destination path. Option B correctly has write without parentheses (it's a property, not a method call). Options with write() (parentheses) would cause an error.

Topics

#Spark DataFrame API#Data Persistence#Parquet Format#Data Partitioning

Community Discussion

No community discussion yet for this question.

Full DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Practice