Apache Parquet
- Problem solved: read less data and compress better for analytics, with columnar storage that also handles nested data.
- Era: announced on 13 March 2013, version 1.0 on 30 July 2013; Apache Incubator in May 2014, top-level project in April 2015.
- Created by: engineers from Twitter (Julien Le Dem, Dmitriy Ryaboy, Jonathan Coveney) and Cloudera (Nong Li, Marcel Kornacker, Todd Lipcon), joined by Criteo.
- Category: columnar file format.
Historical context
Analytical queries often read only a few columns of very wide tables. Yet row-by-row storage forces reading everything and compresses heterogeneous values poorly. In 2010, Google's Dremel paper shows that by combining execution trees and columnar storage, tables of a trillion rows can be aggregated in seconds. But Dremel is internal to Google.
In the Hadoop ecosystem, Cloudera is preparing Impala and testing Trevni, a columnar format from the Avro project. After the Impala beta and a joint evaluation with Twitter, the two companies decide to go further. On 13 March 2013, they announce Parquet, a columnar format independent of any engine, data model or language. Real-world data is often nested: at Twitter, one common internal dataset has a schema seven levels deep, with over 80 leaf fields. Parquet therefore adopts the nested encoding described in Dremel.
Version 1.0 ships on 30 July 2013 with 18 contributors (Twitter, Cloudera, Criteo, Berkeley's AMPLab, Stripe...) and integrations with Hive, Pig, Cascading and Impala. At Twitter, large datasets shrink by a third. The project enters the Apache Incubator on 20 May 2014 and graduates on 22 April 2015: Netflix then stores more than 7 PB of its 10+ PB warehouse in it, and the press release already lists Hive, Impala, Drill, Presto and Spark SQL among the engines that read it. Table formats such as Iceberg later adopt it as a data file format.
Key idea
Store values column by column: an engine skips unneeded columns, compresses homogeneous values better and applies type-specific encodings. For nested data (lists, structs), Parquet stores two small integers with each value, the repetition level and the definition level, which are enough to rebuild the original record. On a flat schema with no optional field, these levels disappear entirely.
How it works
- Hierarchy: a file holds row groups (horizontal slices of rows); each row group holds one column chunk per column, contiguous in the file; each column chunk is split into pages, the indivisible unit of encoding and compression.
- File footer: metadata (schema, position of each column chunk) is
written after the data, for single-pass writing. The reader first reads
this footer, then only the columns it needs. The file starts and ends with
the magic word
PAR1. - Units of parallelism: the file or row group to split the work, the column chunk for I/O, the page for encoding.
- Encodings: automatic dictionary, hybrid bit packing and RLE, then per-column compression. Encoding and compression are kept separate so that engines can work directly on encoded data.
- Statistics: min and max per column chunk and per page; the page index lets readers skip whole pages without reading their headers.
- Recommended settings: row groups of 512 MB to 1 GB, 8 KB pages.
PAR1
Row group 1: [column A, chunk 1] [column B, chunk 1] ...
Row group 2: [column A, chunk 2] [column B, chunk 2] ...
File metadata (schema, offsets, statistics)
Metadata length (4 bytes)
PAR1
By the numbers
| Figure | Context | Source |
|---|---|---|
| 7 levels, 80 leaves | Nested schema of a common dataset at Twitter (2013) | Twitter blog, Parquet 1.0 |
| 18 | Contributors to version 1.0, from several organizations (2013) | Twitter blog, Parquet 1.0 |
| 1/3 | Size reduction of large datasets at Twitter (2013) | Twitter blog, Sept. 2013 |
| 7 PB out of 10+ PB | Share of the Netflix warehouse stored as Parquet (2015) | ASF press release 2015 |
| 512 MB to 1 GB | Recommended row group size | Parquet documentation |
| 8 KB | Recommended page size | Parquet documentation |
Milestones
- 2010: Google's Dremel paper, source of the nested encoding.
- 13 March 2013: Parquet announced by Cloudera and Twitter; preview in Impala 0.7.
- 30 July 2013: Parquet 1.0.
- 11 September 2013: Twitter publishes "Dremel made simple with Parquet".
- 20 May 2014: enters the Apache Incubator.
- 22 April 2015: Apache top-level project (announced on 27 April).
- Today: Java (parquet-java, formerly parquet-mr), C++, Go and Rust implementations (Arrow subprojects), and native readers in DuckDB, ClickHouse or Impala.
Did you know?
- Parquet replaced a first attempt. Cloudera first worked on Trevni, a columnar format from the Avro project. Feedback from the Impala beta led to a new format, hosted outside Avro so as not to favor any data model.
- "Dremel made simple". In September 2013, Julien Le Dem published at Twitter a step-by-step explanation of repetition and definition levels, with an address book as the example: "Having implemented this model based on the paper, we decided to provide a more accessible explanation."
- Nulls cost almost nothing. Thanks to RLE on the levels, "a sparse column with a lot of null values will compress to almost nothing".
- Stripe from day one. At graduation, Stripe stated that its warehouse "has been built on Parquet from the beginning".
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Selective column reads and page skipping through statistics | Poorly suited to row-by-row writes |
| Strong compression: a third smaller at Twitter (2013) | Costly single-row update or delete |
| Native support for nested data (Dremel encoding) | Large row groups need more buffering on write |
| Interoperable standard, independent of any engine | Requires a table layer for ACID |
What came next
- ORC, a competing columnar format born the same year on the Hive side.
- Iceberg, Hudi and Delta Lake organize Parquet files into transactional tables.
- Arrow for in-memory columnar representation; several Parquet implementations are Arrow subprojects.
- Trino, Spark and DuckDB read it natively.
Sources
raw-data/apache/parquet/parquet.md- Cloudera and Twitter announcement, 13 March 2013 (archived copy): https://web.archive.org/web/2013/http://blog.cloudera.com/blog/2013/03/introducing-parquet-columnar-storage-for-apache-hadoop/
- "Announcing Parquet 1.0", Twitter blog, 30 July 2013 (archived copy): https://web.archive.org/web/2013id_/https://blog.twitter.com/2013/announcing-parquet-10-columnar-storage-for-hadoop
- "Dremel made simple with Parquet", Twitter blog, 11 September 2013 (archived copy): https://web.archive.org/web/2013id_/https://blog.twitter.com/2013/dremel-made-simple-with-parquet
- "Dremel: Interactive Analysis of Web-Scale Datasets", VLDB 2010: https://research.google/pubs/dremel-interactive-analysis-of-web-scale-datasets-2/ (excerpt in
raw-data/chronologie/jalons-sources.md) - Iceberg incubation proposal ("All data is stored in Apache Avro, Apache ORC, or Apache Parquet files", excerpt in
raw-data/chronologie/jalons-sources.md): https://cwiki.apache.org/confluence/spaces/INCUBATOR/pages/109454835/IcebergProposal - https://incubator.apache.org/projects/parquet.html
- https://news.apache.org/foundation/entry/the_apache_software_foundation_announces75
- https://parquet.apache.org/docs/overview/
- https://parquet.apache.org/docs/concepts/
- https://parquet.apache.org/docs/file-format/
- https://parquet.apache.org/docs/file-format/configurations/
- https://parquet.apache.org/docs/file-format/pageindex/
- Limitations "poorly suited to row-by-row writes", "costly single-row update" and "table layer for ACID": carried over from the previous version, plausible but unsourced.
- Origin of the name "Parquet": no source found.
- Date when the page index was added to the specification.