Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Databricks Certified Associate Developer for Apache Spark 3.5 Exam - Topic 1 Question 18 Discussion

Posted by Erasmo on Jun 28, 2026 at 10:37 AM

24 of 55. Which code should be used to display the schema of the Parquet file stored in the location events.parquet?

A.

spark.sql("SELECT * FROM events.parquet").show()

B.

spark.read.format("parquet").load("events.parquet").show()

C.

spark.read.parquet("events.parquet").printSchema()

D.

spark.sql("SELECT schema FROM events.parquet").show()

Suggested Answer: C

To view the schema of a Parquet file, you must use the DataFrameReader to load the Parquet data and call the .printSchema() method.

Correct syntax:

spark.read.parquet('events.parquet').printSchema()

This command loads the file metadata (without triggering a full read) and prints the column names, data types, and nullability information in a tree format.

Why the other options are incorrect:

A/D: SQL queries can't directly introspect file schemas.

B: .show() displays data rows, not schema.


PySpark DataFrameReader API --- read.parquet() and DataFrame.printSchema().

Databricks Exam Guide (June 2025): Section ''Using Spark SQL'' --- describes reading files and examining schemas in Spark SQL and DataFrame APIs.

===========

Get Premium Databricks Certified Associate Developer for Apache Spark 3.5 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
27 comments · newest first
GW
Gwen
C is clear and straightforward.
ST
Steffanie 5 days ago
Yeah, D doesn't even show the schema properly.
GI
Gianna 10 days ago
D is definitely incorrect.
GI
Gilberto 15 days ago
A is not specific for schema.
GW
Gwen 21 days ago
Option A seems wrong to me.
RO
Rodolfo 26 days ago
B loads the data, not just the schema.
ST
Steffanie 1 month ago
I prefer Option B.
GI
Gilberto 1 month ago
It directly prints the schema.
RO
Rodolfo 1 month ago
Why C?
GI
Gilberto 2 months ago
I think Option C is the best.
TE
Tesha 2 months ago
I’ll stick with C too. It’s clear.
VA
Valentine 2 months ago
C is straightforward and efficient.
SU
Sue 2 months ago
Yeah, schema isn't a column in Parquet files.
EL
Elenore 2 months ago
Option D doesn't make sense at all.
DE
Delila 2 months ago
I feel like Option A is misleading.
TE
Tesha 3 months ago
Option B is also good, but it shows data, not schema.
VA
Valentine 3 months ago
Agreed! It directly prints the schema.
SU
Sue 3 months ago
I think Option C is the best choice.
CL
Cletus 3 months ago
Why would anyone use Option D? That seems wrong.
SO
Solange 3 months ago
Totally agree with C, it's the most straightforward!
JA
Jacquelyne 3 months ago
Wait, can you really use SQL to get the schema? Sounds off.
SA
Sarah 4 months ago
I think Option B is better for loading data.
LA
Lashawnda 4 months ago
Option C is the right choice!
MA
Mari 4 months ago
I’m a bit confused about option A; it seems like it’s trying to select from a file directly, which doesn’t sound right to me.
ED
Edmond 4 months ago
I practiced a similar question where we had to load Parquet files, and I feel like option C is definitely the way to go for getting the schema.
DA
Dante 4 months ago
I'm not entirely sure, but I remember something about using .show() for displaying data, so maybe option B could be a contender too?
SA
Sarah 4 months ago
I think option C is the right choice because it specifically mentions printing the schema, which is what the question asks for.
0/2000 characters

Save Cancel