Exam Associate-Developer-Apache-Spark-3.5 Topic 1 Question 83 Discussion
Actual exam question for Databricks's Associate-Developer-Apache-Spark-3.5 exam
Question #: 83
Topic #: 1
Question #: 83
Topic #: 1
14 of 55.
A developer created a DataFrame with columns color, fruit, and taste, and wrote the data to a Parquet directory using:
df.write.partitionBy("color", "taste").parquet("/path/to/output")
What is the result of this code?
A developer created a DataFrame with columns color, fruit, and taste, and wrote the data to a Parquet directory using:
df.write.partitionBy("color", "taste").parquet("/path/to/output")
What is the result of this code?
Suggested Answer: C Vote an answer
When writing a DataFrame using .partitionBy() in Spark, the data is physically organized into directory structures corresponding to unique combinations of the partition columns.
Example:
/path/to/output/color=Red/taste=Sweet/part-0001.parquet
/path/to/output/color=Green/taste=Sour/part-0002.parquet
This structure improves query performance by pruning partitions when filtering on these columns.
Why the other options are incorrect:
A: Appending requires .mode("append"), which isn't used here.
B: Null values in partition columns are handled; they don't raise errors.
D: Partitioning prevents storing all data in a single file.
Reference:
PySpark DataFrameWriter API - partitionBy() and .parquet() methods.
Databricks Exam Guide (June 2025): Section "Using Spark SQL" - partitioning and writing optimized output files.
Example:
/path/to/output/color=Red/taste=Sweet/part-0001.parquet
/path/to/output/color=Green/taste=Sour/part-0002.parquet
This structure improves query performance by pruning partitions when filtering on these columns.
Why the other options are incorrect:
A: Appending requires .mode("append"), which isn't used here.
B: Null values in partition columns are handled; they don't raise errors.
D: Partitioning prevents storing all data in a single file.
Reference:
PySpark DataFrameWriter API - partitionBy() and .parquet() methods.
Databricks Exam Guide (June 2025): Section "Using Spark SQL" - partitioning and writing optimized output files.
by Hugo at Aug 21, 2026, 11:37 AM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).