Skip to the page
Tecyfy

PySpark interview question · easy

What are the advantages of using Parquet files in Spark?

The short answerParquet is a columnar, compressed, self-describing file format, and Spark is built to exploit it.

The full answer

Parquet is a columnar, compressed, self-describing file format, and Spark is built to exploit it. Queries read only the columns they need, skip data using the statistics stored in each file, decompress quickly, and get the schema from the file itself. That usually makes Parquet many times faster and smaller than CSV or JSON for analytics.

1. Columnar storage: read only what you need Values of each column are stored together. SELECT customer_id, amount on a 100-column table reads two columns' data, not the whole rows. Spark's column pruning does this automatically.

2. Predicate pushdown and data skipping Each file is split into row groups, and each row group stores the minimum and maximum (and null counts) for every column. Spark pushes filters such as amount > 1000 into the reader (spark.sql.parquet.filterPushdown, on by default) and skips row groups that can't match. Sorting or clustering data by commonly filtered columns makes this much more effective.

3. Compression and encoding Similar values stored together compress well. Parquet uses dictionary and run-length encoding plus a codec: Spark writes Snappy by default, and zstd usually gives smaller files at similar speed. Files are commonly several times smaller than the same data in CSV.

4. Schema stored with the data Column names and types are in the file footer, so there is no schema inference and no type guessing; nested structures (structs, arrays, maps) are supported natively.

5. Fast reading in Spark Spark's vectorised Parquet reader decodes batches of column values at a time, which works well with whole-stage code generation.

6. Splittable Files can be read in parallel by row group, even when compressed.

7. Partition discovery Directory layouts such as /sales/year=2026/month=10/ are read as partition columns, and filters on them skip whole directories.

8. The foundation of table formats Delta Lake, Apache Iceberg and Apache Hudi usually store data as Parquet files and add transactions, schema evolution, time travel and file-level statistics on top. In practice you usually use one of them rather than plain Parquet folders, but the speed comes from Parquet underneath.

9. Interoperability Almost every data tool reads Parquet: pandas, Polars, DuckDB, Trino, BigQuery, Snowflake and the cloud warehouses.

Limitations

  • Files are immutable: updating a row means rewriting a file, which is why table formats exist.
  • Writing is slower than appending to a row format, so it's less suited to many tiny writes.
  • Many small files ruin performance; aim for files of roughly 128 MB to 1 GB.
  • Schema changes across files need mergeSchema or a table format to manage.
df.write.mode("overwrite").option("compression", "zstd").partitionBy("order_date").parquet("/data/orders")
spark.read.parquet("/data/orders").filter("order_date = '2026-10-01' AND amount > 1000").select("order_id", "amount")

Last updated 16 October 2026

Sources

Where each fact comes from

  1. 1Parquet files
  2. 2Spark configuration
  3. 3Performance tuning