Databricks Data Engineer Professional exam dumps

Databricks Data Engineer Professional practice question 66 of 313

Databricks Certified Data Engineer Professional. Professional level, Databricks. Free question with the correct answer and a full explanation.

Databricks Data Engineer Professional Question 66

Select 3

You are working on a Databricks pipeline to write a PySpark DataFrame to disk in Parquet format, and you need to manually control the size of individual part-files being written to disk. Which of the following actions will help you achieve this?

  1. A

    Use the coalesce() method on the DataFrame before writing to reduce the number of output files.

  2. B

    Use the repartition() method on the DataFrame before writing to control the number of output partitions.

  3. C

    Specify the maxRecordsPerFile option in the .write method to limit the number of rows per file.

  4. D

    Set the spark.sql.files.maxPartitionBytes configuration property to control the size of each output file.

  5. E

    Use the checkpoint() method on the DataFrame before writing to split large partitions into smaller files.

Show answer and explanation

Correct answers: A, B, C

Explanation

To manually control the size of individual part-files when writing a PySpark DataFrame to disk, you can use methods like coalesce() or repartition() to adjust the number of partitions, which directly correlates with the number of output files. Additionally, the maxRecordsPerFile option in the .write method allows control over the number of rows per file, indirectly managing file size. Configuration properties like spark.sql.files.maxPartitionBytes and operations like checkpoint() do not serve this purpose.

  • A. Correct.

    Using coalesce() reduces the number of output partitions, which directly impacts the number of part-files written to disk. However, it does not increase the number of partitions, so its use is limited in scenarios requiring finer control.

  • B. Correct.

    Using repartition() allows you to explicitly define the number of partitions, which translates to the number of part-files written to disk. This provides fine-grained control over the output structure.

  • C. Correct.

    The maxRecordsPerFile option in the .write method ensures that each file contains no more than the specified number of rows, thus helping control the size of individual part-files.

  • D. Incorrect.

    spark.sql.files.maxPartitionBytes controls how much data can be read into memory for processing, but it does not directly control the size of output part-files.

  • E. Incorrect.

    checkpoint() is used for fault tolerance and resetting lineage but does not control the size of part-files written to disk.

Timed practice exam

Take a Databricks Data Engineer Professional practice test under exam conditions

60 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam