# Columnar Formats: Parquet and ORC

> Understand how Parquet stores data in row groups and column chunks, why it is fast and small, and how to write it well. Free notes, key concepts, resources and...

Canonical: https://www.internhack.in/roadmaps/tracks/data-engineer/parquet
Last updated: 2026-11-28

Understand how Parquet stores data in row groups and column chunks, why it is fast and small, and how to write it well.

Intermediate · about 4 hours · difficulty 3/5

Learn first: [Row-Based Formats: CSV and JSON](https://www.internhack.in/roadmaps/tracks/data-engineer/row-formats), [OLTP vs OLAP Workloads](https://www.internhack.in/roadmaps/tracks/data-engineer/oltp-vs-olap)

Parquet is the default file format of the modern data stack. Spark, warehouses, lakehouse table formats, DuckDB and pandas all read it natively.

### How Parquet works

- A file is split into **row groups** (for example 128 MB each). Inside each row group, data is stored **column by column** in column chunks, split into pages.
- Each column chunk has **statistics** (min, max, null count). Engines skip row groups whose stats rule them out: this is **predicate pushdown**.
- Only the columns you select are read: **column pruning**.
- Similar values sit together, so **encodings** (dictionary, run-length) and **compression** (Snappy, Zstd) work very well.
- The **schema** is embedded in the file, with real types including nested structs and lists.

### Writing good Parquet

- Aim for files of roughly 128 MB to 1 GB. Thousands of tiny files kill performance (the "small files problem").
- Sort or cluster by commonly filtered columns so min and max stats are useful.
- Choose Snappy for speed or Zstd for a better size ratio.
- Use proper types: dates as dates, decimals for money, not everything as strings.

### ORC

ORC is a similar columnar format from the Hive world. Same ideas; Parquet has wider support today.

### Pitfalls

- Writing one file per record in a streaming job and ending up with millions of tiny files.
- Schema mismatch across files (an `amount` column as int in some files and string in others).
- Treating Parquet files as updatable. They are immutable; updates need a table format (Delta, Iceberg).

You are ready to move on when you can convert a CSV dataset to Parquet, inspect its row groups and statistics with pyarrow or DuckDB, and show a measured speed and size difference for a filtered query.

## Key concepts

- **Row groups, column chunks, pages**
- **Column pruning**
- **Predicate pushdown and statistics**
- **Encodings and compression codecs**
- **Target file sizes**
- **Nested types**
- **ORC**
- **Apache Arrow in-memory format**

## Mini project

Convert a 1 to 5 GB CSV dataset to Parquet with Snappy and Zstd. Record file sizes, then time the same filtered aggregate in DuckDB over CSV and both Parquet versions. Print row group stats with pyarrow.

## Check yourself

A query filters on order_date but still reads every row group. What about how the data was written could cause that?

## Free resources

- [Apache Parquet documentation](https://parquet.apache.org/docs/) (Apache Parquet)
- [Apache Arrow Python docs](https://arrow.apache.org/docs/python/) (Apache Arrow)
- [DuckDB documentation](https://duckdb.org/docs/) (DuckDB)

Previous: [Row-Based Formats: CSV and JSON](https://www.internhack.in/roadmaps/tracks/data-engineer/row-formats) · Next: [Avro and Schema Evolution](https://www.internhack.in/roadmaps/tracks/data-engineer/avro-schema-evolution)

## More in Storage, File Formats and Data Layout

- [Row-Based Formats: CSV and JSON](https://www.internhack.in/roadmaps/tracks/data-engineer/row-formats)
- [Columnar Formats: Parquet and ORC](https://www.internhack.in/roadmaps/tracks/data-engineer/parquet)
- [Avro and Schema Evolution](https://www.internhack.in/roadmaps/tracks/data-engineer/avro-schema-evolution)
- [Object Storage, Partitioning and Data Lake Layout](https://www.internhack.in/roadmaps/tracks/data-engineer/object-storage-layout)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Data Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/data-engineer)
