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.
[References:, 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., ===========, ]
Submit