QuestionQ40

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

A data engineer must write DataFrame df to a Parquet file, partition it by the country column, and overwrite any data that already exists at the destination path.

Which Apache Spark code should the data engineer use to complete this task?

Explanation

Spark's DataFrameWriter uses mode("overwrite") to replace existing output, partitionBy("country") to lay out file-based output by the country column, and parquet(path) to save the DataFrame in Parquet format at the target path.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!