SlideShare a Scribd company logo
Parquet
Columnar Storage for the People
Lars George
EMEA Chief Architect @ Cloudera
lars@cloudera.com
About Me
•
•

•

•

EMEA Chief Architect at Cloudera
Apache Committer
‣ HBase and Whirr
O’Reilly Author
‣ HBase – The Definitive Guide
- Now in Japanese!
Contact
‣ lars@cloudera.com
‣ @larsgeorge

日本語版も出ました!
Introduction
For analytical workloads it is often advantageous to
store the data in a layout that is more amenable to
the way it is accessed.
Parquet is an open-source file format that strives to
do exactly that, i.e. provide an efficient layout for
analytical queries.
We will be looking some context from various
companies, the results observed in production and
benchmarks, and finally do a bit of a format deepdive.
Example: Twitter
•

Twitter’s Data
‣

‣

100TB+ a day of compressed data

‣

•

230M+ monthly active users generating and
consuming 500M+ tweets a day
Huge scale for instrumentation, user graph, derived
data, etc.

Analytics Infrastructure
‣

Several 1K+ node Hadoop clusters

‣

Log Collection Pipeline

‣

Processing Tools
Example: Twitter
Twitter’s Use-case
•

Logs available on HDFS

•

Thrift to store logs

•

Example schema: 87 columns, up to 7 levels of
nesting
Example: Twitter
Goal:
!

“To have a state of the art columnar storage available
across the Hadoop platform”
!

•

Hadoop is very reliable for big long running
queries, but also I/O heavy

•

Incrementally take advantage of column based
storage in existing framework

•

Not tied to any framework in particular
Columnar Storage
•

Limits I/O to data actually needed
‣

•

Loads only the columns that need to be
accessed

Saves space
‣
‣

•

Columnar layout compresses better
Type specific encodings

Enables vectorized execution engines
Columnar vs Row-based
Here is an example of translating a logical table
schema. First the example table:

In a row-based layout each row follows the next:
While for a column-oriented layout it stores one
column after the next:
Parquet Intro
Parquet defines a common file format, which is
language independent

and

formally specified.
Implementation exist in Java for MapReduce and 

C++, which is used by Impala.
Example: Impala Results
Example: Impala TPC-DS
Example: Criteo
•

Billions of new events per day

•

Roughly 60 columns per log

•

Heavy analytic workload

•

BI analysts using Hive and RCFile

•

Frequent schema modifications
!

•

Perfect use case for Parquet + Hive!
Parquet + Hive: Basic
Requirements
•

MapReduce compatibility due to Hive

•

Correctly handle evolving schemas across Parquet
files

•

Read only the columns use by query to minimize
data read

•

Interoperability with other execution engines, for
example Pig, Impala, etc.
Performance
Performance
Example: Twitter
•

Petabytes of storage saved

•

Example jobs taking advantage of projection push
down:
‣

Job 1 (Pig): reading 32% less data -> 20% task
time saving

‣

Job 2 (Scalding): reading 14 out of 35 columns,
reading 80% less data -> 66% task time saving

‣

Terabytes of scanning saved every day
Parquet Model
•

The algorithm is borrowed from Google Dremel’s
ColumnIO file format

•

Schema is defined in a familiar format

•

Supports nested data structures

•

Each cell is encoded as triplet: repetition level,
definition level, and the value

•

Level values are bound by the depth of the
schema
‣

Stored in a compact form
Parquet Model
•

Schema similar to Protocol Buffers, but with
simplifications (e.g. no Maps, Lists or Sets)
‣

These complex types can be expressed as a
combination of the other features

•

Root of schema is a group of fields called a
message

•

Field types are either group or primitive type with
repetition of required, optional or repeated
‣

exactly one, zero or one, or zero or more
Example Schema
!

message AddressBook {

required string owner;

repeated string ownerPhoneNumbers;

repeated group contacts { 

required string name; 

optional string phoneNumber;
}

} 

Represent Lists/Sets
Representing Maps
Schema as a Tree
Field per Primitive
Primitive fields are mapped to the columns in the
columnar format, shown in blue here:
Levels
The structure of the record is captured for each
value by two integers called repetition level and
definition level.
Using these two levels we can fully reconstruct the
nested structures while still being able to store each
primitive separately.
Definition Levels
Example:
message ExampleDefinitionLevel {

optional group a {

optional group b {

optional string c;

}

}

}
Contains one column “a.b.c” where all fields are
optional and can be null.
Definition Levels
Definition Levels
Example with a required field:
message ExampleDefinitionLevel { 

optional group a {

required group b {

optional string c;

}

}
}
Repetition Levels
Repeated fields require that we store where a lists
starts in a column of values, since these are stored
sequentially in the same place. The repetition level
denotes per value where a new lists starts, and are
basically a marker which also indicates the level
where to start the new list.
Only levels that are repeated need a repetition level,
i.e. optional or required fields are never repeated and
can be skipped while attributing repetition levels.
Repetition Levels
Repetition Levels
•

0 marks every new record and
implies creating a new level1
and level2 list

•

1 marks every new level1 list
and implies creating a new
level2 list as well

•

2 marks every new element in a
level2 list
Repetition Levels
Combining the Levels
Applying the two to the AddressBook example:
!
!
!
!
!

In particular for the column “contacts.phoneNumber”, a
defined phone number will have the maximum definition
level of 2, and a contact without phone number will have a
definition level of 1. In the case where contacts are absent,
it will be 0.
Example: AddressBook
AddressBook {
owner: "Julien Le Dem",
ownerPhoneNumbers: "555 123 4567",
ownerPhoneNumbers: "555 666 1337",
contacts: {
name: "Dmitriy Ryaboy",
phoneNumber: "555 987 6543",
},
contacts: {
name: "Chris Aniszczyk"
}
}
AddressBook {
owner: "A. Nonymous"
}

Looking at
contacts.phoneNumber
Example: AddressBook
AddressBook {

contacts: {

phoneNumber: "555 987 6543"

}

contacts: {

}
}
AddressBook {
}
Example: AddressBook
Example: AddressBook
When writing:
•

contacts.phoneNumber: “555 987 6543”
‣
‣

•

new record: R = 0
value defined: D = max (2)

contacts.phoneNumber: NULL
‣
‣

•

repeated contacts: R = 1
only defined up to contacts: D = 1

contacts: NULL
‣

new record: R = 0

‣

only defined up to AddressBook: D = 0
Example: AddressBook
During reading
•

R=0, D=2, Value = “555 987 6543”:!
‣

‣
•

R = 0 means a new record. We recreate the nested records from the root
until the definition level (here 2)
D = 2 which is the maximum. The value is defined and is inserted.

R=1, D=1:!
‣
‣

•

R = 1 means a new entry in the contacts list at level 1.
D = 1 means contacts is defined but not phoneNumber, so we just create
an empty contacts.

R=0, D=0:!
‣

R = 0 means a new record. we create the nested records from the root
until the definition level

‣

D = 0 => contacts is actually null, so we only have an empty AddressBook
Example: AddressBook
AddressBook {

contacts: {

phoneNumber: "555 987 6543"

}

contacts: {

}
}
AddressBook {
}
Storing Levels
Each primitive type has three sub columns, though
the overhead is low thanks to the columnar
representation and the fact that values are bound by
the depth of the schema, resulting in only a few bits
used.
When all fields are required in a flat schema we can
omit the levels altogether since they are would
always be zero.
Otherwise compression, such as RLE, takes care of
condensing data efficiently.
File Format
•

Row Groups: A group of rows in columnar format
‣
‣

One (or more) per split while reading

‣
•

Max size buffered in memory while writing
About 50MB < row group < 1GB

Columns Chunk: Data for one column in row group
‣

•

Column chunks can be read independently for efficient scans

Page: Unit of access in a column chunk
‣

Should be big enough for efficient compression

‣

Min size to read while accessing a single record

‣

About 8KB < page < 1MB
File Format
File Format
•

Layout
‣

‣

•

Row groups in
columnar format
footer contains
column chunks
offset and
schema

Language
independent
‣

Well defined
format

‣

Hadop and
Impala support
Integration
Hive and Pig natively support projection push-down.
Based on the query executed only the columns for
the fields accessed are fetched.
MapReduce and other tools use a globbing syntax,
for example:
field1;field2/**;field4{subfield1,subfield2}

This will return field1, all the columns under field2,
subfield1 and 2 under field4 but not field3
Encodings
•

Bit Packing
‣

‣

•

Small integers encoded in the minimum bits
required
Useful for repetition level, definition levels and
dictionary keys

Run Length Encoding (RLE)
‣

Used in combination with bit packing

‣

Cheap compression

‣

Works well for definition level of sparse columns
Encodings
…continued:
•

Dictionary Encoding
‣
‣

•

Useful for columns with few (<50k) distinct values
When applicable, compresses better and faster
than heavyweight algorithms (e.g. gzip, lzo,
snappy)

Extensible
‣

Defining new encodings is supported by the
format
Future
•

Parquet 2.0
‣

More encodings
-

‣

Statistics
-

‣

Delta encodings, improved encodings
For query planners and predicate pushdown

New page format
-

skip ahead better
Questions?
•

Contact: @larsgeorge, lars@cloudera.com

•

Sources
‣

Parquet Sources: https://github.com/parquet/
parquet-format

‣

Blog Post with Info: https://blog.twitter.com/2013/
dremel-made-simple-with-parquet

‣

Impala Source: https://github.com/cloudera/impala

‣

Impala: http://www.cloudera.com/content/
cloudera/en/campaign/introducing-impala.html

More Related Content

PDF
The Parquet Format and Performance Optimization Opportunities
PDF
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
PDF
Parquet performance tuning: the missing guide
PDF
Apache Iceberg - A Table Format for Hige Analytic Datasets
PDF
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
PPTX
The columnar roadmap: Apache Parquet and Apache Arrow
PDF
Amazon S3 Best Practice and Tuning for Hadoop/Spark in the Cloud
PDF
Building a SIMD Supported Vectorized Native Engine for Spark SQL
The Parquet Format and Performance Optimization Opportunities
Deep Dive into Spark SQL with Advanced Performance Tuning with Xiao Li & Wenc...
Parquet performance tuning: the missing guide
Apache Iceberg - A Table Format for Hige Analytic Datasets
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
The columnar roadmap: Apache Parquet and Apache Arrow
Amazon S3 Best Practice and Tuning for Hadoop/Spark in the Cloud
Building a SIMD Supported Vectorized Native Engine for Spark SQL

What's hot (20)

PDF
The Rise of ZStandard: Apache Spark/Parquet/ORC/Avro
PPTX
RocksDB detail
PDF
Parquet Hadoop Summit 2013
PPTX
Apache Spark Architecture
PDF
Apache Spark Core – Practical Optimization
PDF
Apache Spark At Scale in the Cloud
PDF
Apache Spark Core—Deep Dive—Proper Optimization
PDF
[Meetup] a successful migration from elastic search to clickhouse
PDF
Efficient Data Storage for Analytics with Parquet 2.0 - Hadoop Summit 2014
PDF
Efficient Data Storage for Analytics with Apache Parquet 2.0
PDF
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
PDF
Streaming Event Time Partitioning with Apache Flink and Apache Iceberg - Juli...
PDF
Cost-based Query Optimization in Apache Phoenix using Apache Calcite
PDF
Streaming SQL with Apache Calcite
PDF
Parquet Strata/Hadoop World, New York 2013
PDF
Deep Dive: Memory Management in Apache Spark
PDF
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
PDF
Common Strategies for Improving Performance on Your Delta Lakehouse
PDF
How to upgrade like a boss to MySQL 8.0 - PLE19
PPTX
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
The Rise of ZStandard: Apache Spark/Parquet/ORC/Avro
RocksDB detail
Parquet Hadoop Summit 2013
Apache Spark Architecture
Apache Spark Core – Practical Optimization
Apache Spark At Scale in the Cloud
Apache Spark Core—Deep Dive—Proper Optimization
[Meetup] a successful migration from elastic search to clickhouse
Efficient Data Storage for Analytics with Parquet 2.0 - Hadoop Summit 2014
Efficient Data Storage for Analytics with Apache Parquet 2.0
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
Streaming Event Time Partitioning with Apache Flink and Apache Iceberg - Juli...
Cost-based Query Optimization in Apache Phoenix using Apache Calcite
Streaming SQL with Apache Calcite
Parquet Strata/Hadoop World, New York 2013
Deep Dive: Memory Management in Apache Spark
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
Common Strategies for Improving Performance on Your Delta Lakehouse
How to upgrade like a boss to MySQL 8.0 - PLE19
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
Ad

Viewers also liked (20)

PPTX
Choosing an HDFS data storage format- Avro vs. Parquet and more - StampedeCon...
PPT
Parquet overview
PDF
Spark, Python and Parquet
PPTX
Programming in Spark using PySpark
PPTX
Taking Hadoop to Enterprise Security Standards
PPT
Ysance conference - cloud computing - aws - 3 mai 2010
PPTX
Hadoop unit
PDF
Social Networks and the Richness of Data
PDF
Hadoop is dead - long live Hadoop | BiDaTA 2013 Genoa
KEY
From Batch to Realtime with Hadoop - Berlin Buzzwords - June 2012
PPTX
Introduction sur les problématiques d'une architecture distribuée
PPT
Présentation Club STORM
PDF
HBase Applications - Atlanta HUG - May 2014
PDF
HBase Sizing Notes
PDF
Big Data is not Rocket Science
PDF
Cassandra and Spark
PDF
Phoenix - A High Performance Open Source SQL Layer over HBase
PPTX
data science toolkit 101: set up Python, Spark, & Jupyter
PDF
Tech day hadoop, Spark
PDF
HBase and Impala Notes - Munich HUG - 20131017
Choosing an HDFS data storage format- Avro vs. Parquet and more - StampedeCon...
Parquet overview
Spark, Python and Parquet
Programming in Spark using PySpark
Taking Hadoop to Enterprise Security Standards
Ysance conference - cloud computing - aws - 3 mai 2010
Hadoop unit
Social Networks and the Richness of Data
Hadoop is dead - long live Hadoop | BiDaTA 2013 Genoa
From Batch to Realtime with Hadoop - Berlin Buzzwords - June 2012
Introduction sur les problématiques d'une architecture distribuée
Présentation Club STORM
HBase Applications - Atlanta HUG - May 2014
HBase Sizing Notes
Big Data is not Rocket Science
Cassandra and Spark
Phoenix - A High Performance Open Source SQL Layer over HBase
data science toolkit 101: set up Python, Spark, & Jupyter
Tech day hadoop, Spark
HBase and Impala Notes - Munich HUG - 20131017
Ad

Similar to Parquet - Data I/O - Philadelphia 2013 (20)

PDF
(Julien le dem) parquet
PPTX
Hadoop and HBase experiences in perf log project
PDF
Big Data - Lab A1 (SC 11 Tutorial)
PDF
Design for Scalability in ADAM
PDF
Parquet Twitter Seattle open house
PPTX
Emerging technologies /frameworks in Big Data
PDF
Perly Parallel Processing of Fixed Width Data Records
PPTX
Introduction to NoSql
PPTX
Hadoop with Python
PDF
Data Structures Handling Trillions of Daily Streaming Events by Evan Chan
PDF
UNIT I cloud computing ppt cloud ccd all about the cloud computing
PPTX
Analytics Beyond RAM Capacity using R
PPTX
Big Data Processing
PPTX
Learn c++ Programming Language
PDF
The Future of Fast Databases: Lessons from a Decade of QuestDB
PDF
On Rails with Apache Cassandra
PPTX
Lens at apachecon
PDF
محاضرة برنامج التحليل الكمي R program د.هديل القفيدي
PDF
PyCascading for Intuitive Flow Processing with Hadoop (gabor szabo)
PDF
Advanced Data Science on Spark-(Reza Zadeh, Stanford)
(Julien le dem) parquet
Hadoop and HBase experiences in perf log project
Big Data - Lab A1 (SC 11 Tutorial)
Design for Scalability in ADAM
Parquet Twitter Seattle open house
Emerging technologies /frameworks in Big Data
Perly Parallel Processing of Fixed Width Data Records
Introduction to NoSql
Hadoop with Python
Data Structures Handling Trillions of Daily Streaming Events by Evan Chan
UNIT I cloud computing ppt cloud ccd all about the cloud computing
Analytics Beyond RAM Capacity using R
Big Data Processing
Learn c++ Programming Language
The Future of Fast Databases: Lessons from a Decade of QuestDB
On Rails with Apache Cassandra
Lens at apachecon
محاضرة برنامج التحليل الكمي R program د.هديل القفيدي
PyCascading for Intuitive Flow Processing with Hadoop (gabor szabo)
Advanced Data Science on Spark-(Reza Zadeh, Stanford)

More from larsgeorge (7)

PPTX
HBase in Practice
PPTX
Backup and Disaster Recovery in Hadoop
PPTX
Data Pipelines in Hadoop - SAP Meetup in Tel Aviv
PDF
HBase Status Report - Hadoop Summit Europe 2014
PDF
HBase Sizing Guide
PPTX
HBase Advanced Schema Design - Berlin Buzzwords - June 2012
PDF
Realtime Analytics with Hadoop and HBase
HBase in Practice
Backup and Disaster Recovery in Hadoop
Data Pipelines in Hadoop - SAP Meetup in Tel Aviv
HBase Status Report - Hadoop Summit Europe 2014
HBase Sizing Guide
HBase Advanced Schema Design - Berlin Buzzwords - June 2012
Realtime Analytics with Hadoop and HBase

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Approach and Philosophy of On baking technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Cloud computing and distributed systems.
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Spectral efficient network and resource selection model in 5G networks
PPT
Teaching material agriculture food technology
Digital-Transformation-Roadmap-for-Companies.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Empathic Computing: Creating Shared Understanding
Review of recent advances in non-invasive hemoglobin estimation
20250228 LYD VKU AI Blended-Learning.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Approach and Philosophy of On baking technology
Big Data Technologies - Introduction.pptx
Unlocking AI with Model Context Protocol (MCP)
Dropbox Q2 2025 Financial Results & Investor Presentation
NewMind AI Monthly Chronicles - July 2025
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Encapsulation_ Review paper, used for researhc scholars
Mobile App Security Testing_ A Comprehensive Guide.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Cloud computing and distributed systems.
“AI and Expert System Decision Support & Business Intelligence Systems”
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Spectral efficient network and resource selection model in 5G networks
Teaching material agriculture food technology

Parquet - Data I/O - Philadelphia 2013

  • 1. Parquet Columnar Storage for the People Lars George EMEA Chief Architect @ Cloudera lars@cloudera.com
  • 2. About Me • • • • EMEA Chief Architect at Cloudera Apache Committer ‣ HBase and Whirr O’Reilly Author ‣ HBase – The Definitive Guide - Now in Japanese! Contact ‣ lars@cloudera.com ‣ @larsgeorge 日本語版も出ました!
  • 3. Introduction For analytical workloads it is often advantageous to store the data in a layout that is more amenable to the way it is accessed. Parquet is an open-source file format that strives to do exactly that, i.e. provide an efficient layout for analytical queries. We will be looking some context from various companies, the results observed in production and benchmarks, and finally do a bit of a format deepdive.
  • 4. Example: Twitter • Twitter’s Data ‣ ‣ 100TB+ a day of compressed data ‣ • 230M+ monthly active users generating and consuming 500M+ tweets a day Huge scale for instrumentation, user graph, derived data, etc. Analytics Infrastructure ‣ Several 1K+ node Hadoop clusters ‣ Log Collection Pipeline ‣ Processing Tools
  • 5. Example: Twitter Twitter’s Use-case • Logs available on HDFS • Thrift to store logs • Example schema: 87 columns, up to 7 levels of nesting
  • 6. Example: Twitter Goal: ! “To have a state of the art columnar storage available across the Hadoop platform” ! • Hadoop is very reliable for big long running queries, but also I/O heavy • Incrementally take advantage of column based storage in existing framework • Not tied to any framework in particular
  • 7. Columnar Storage • Limits I/O to data actually needed ‣ • Loads only the columns that need to be accessed Saves space ‣ ‣ • Columnar layout compresses better Type specific encodings Enables vectorized execution engines
  • 8. Columnar vs Row-based Here is an example of translating a logical table schema. First the example table: In a row-based layout each row follows the next: While for a column-oriented layout it stores one column after the next:
  • 9. Parquet Intro Parquet defines a common file format, which is language independent and formally specified. Implementation exist in Java for MapReduce and 
 C++, which is used by Impala.
  • 12. Example: Criteo • Billions of new events per day • Roughly 60 columns per log • Heavy analytic workload • BI analysts using Hive and RCFile • Frequent schema modifications ! • Perfect use case for Parquet + Hive!
  • 13. Parquet + Hive: Basic Requirements • MapReduce compatibility due to Hive • Correctly handle evolving schemas across Parquet files • Read only the columns use by query to minimize data read • Interoperability with other execution engines, for example Pig, Impala, etc.
  • 16. Example: Twitter • Petabytes of storage saved • Example jobs taking advantage of projection push down: ‣ Job 1 (Pig): reading 32% less data -> 20% task time saving ‣ Job 2 (Scalding): reading 14 out of 35 columns, reading 80% less data -> 66% task time saving ‣ Terabytes of scanning saved every day
  • 17. Parquet Model • The algorithm is borrowed from Google Dremel’s ColumnIO file format • Schema is defined in a familiar format • Supports nested data structures • Each cell is encoded as triplet: repetition level, definition level, and the value • Level values are bound by the depth of the schema ‣ Stored in a compact form
  • 18. Parquet Model • Schema similar to Protocol Buffers, but with simplifications (e.g. no Maps, Lists or Sets) ‣ These complex types can be expressed as a combination of the other features • Root of schema is a group of fields called a message • Field types are either group or primitive type with repetition of required, optional or repeated ‣ exactly one, zero or one, or zero or more
  • 19. Example Schema ! message AddressBook {
 required string owner;
 repeated string ownerPhoneNumbers;
 repeated group contacts { 
 required string name; 
 optional string phoneNumber; } } 

  • 22. Schema as a Tree
  • 23. Field per Primitive Primitive fields are mapped to the columns in the columnar format, shown in blue here:
  • 24. Levels The structure of the record is captured for each value by two integers called repetition level and definition level. Using these two levels we can fully reconstruct the nested structures while still being able to store each primitive separately.
  • 25. Definition Levels Example: message ExampleDefinitionLevel {
 optional group a {
 optional group b {
 optional string c;
 }
 }
 } Contains one column “a.b.c” where all fields are optional and can be null.
  • 27. Definition Levels Example with a required field: message ExampleDefinitionLevel { 
 optional group a {
 required group b {
 optional string c;
 }
 } }
  • 28. Repetition Levels Repeated fields require that we store where a lists starts in a column of values, since these are stored sequentially in the same place. The repetition level denotes per value where a new lists starts, and are basically a marker which also indicates the level where to start the new list. Only levels that are repeated need a repetition level, i.e. optional or required fields are never repeated and can be skipped while attributing repetition levels.
  • 30. Repetition Levels • 0 marks every new record and implies creating a new level1 and level2 list • 1 marks every new level1 list and implies creating a new level2 list as well • 2 marks every new element in a level2 list
  • 32. Combining the Levels Applying the two to the AddressBook example: ! ! ! ! ! In particular for the column “contacts.phoneNumber”, a defined phone number will have the maximum definition level of 2, and a contact without phone number will have a definition level of 1. In the case where contacts are absent, it will be 0.
  • 33. Example: AddressBook AddressBook { owner: "Julien Le Dem", ownerPhoneNumbers: "555 123 4567", ownerPhoneNumbers: "555 666 1337", contacts: { name: "Dmitriy Ryaboy", phoneNumber: "555 987 6543", }, contacts: { name: "Chris Aniszczyk" } } AddressBook { owner: "A. Nonymous" } Looking at contacts.phoneNumber
  • 34. Example: AddressBook AddressBook {
 contacts: {
 phoneNumber: "555 987 6543"
 }
 contacts: {
 } } AddressBook { }
  • 36. Example: AddressBook When writing: • contacts.phoneNumber: “555 987 6543” ‣ ‣ • new record: R = 0 value defined: D = max (2) contacts.phoneNumber: NULL ‣ ‣ • repeated contacts: R = 1 only defined up to contacts: D = 1 contacts: NULL ‣ new record: R = 0 ‣ only defined up to AddressBook: D = 0
  • 37. Example: AddressBook During reading • R=0, D=2, Value = “555 987 6543”:! ‣ ‣ • R = 0 means a new record. We recreate the nested records from the root until the definition level (here 2) D = 2 which is the maximum. The value is defined and is inserted. R=1, D=1:! ‣ ‣ • R = 1 means a new entry in the contacts list at level 1. D = 1 means contacts is defined but not phoneNumber, so we just create an empty contacts. R=0, D=0:! ‣ R = 0 means a new record. we create the nested records from the root until the definition level ‣ D = 0 => contacts is actually null, so we only have an empty AddressBook
  • 38. Example: AddressBook AddressBook {
 contacts: {
 phoneNumber: "555 987 6543"
 }
 contacts: {
 } } AddressBook { }
  • 39. Storing Levels Each primitive type has three sub columns, though the overhead is low thanks to the columnar representation and the fact that values are bound by the depth of the schema, resulting in only a few bits used. When all fields are required in a flat schema we can omit the levels altogether since they are would always be zero. Otherwise compression, such as RLE, takes care of condensing data efficiently.
  • 40. File Format • Row Groups: A group of rows in columnar format ‣ ‣ One (or more) per split while reading ‣ • Max size buffered in memory while writing About 50MB < row group < 1GB Columns Chunk: Data for one column in row group ‣ • Column chunks can be read independently for efficient scans Page: Unit of access in a column chunk ‣ Should be big enough for efficient compression ‣ Min size to read while accessing a single record ‣ About 8KB < page < 1MB
  • 42. File Format • Layout ‣ ‣ • Row groups in columnar format footer contains column chunks offset and schema Language independent ‣ Well defined format ‣ Hadop and Impala support
  • 43. Integration Hive and Pig natively support projection push-down. Based on the query executed only the columns for the fields accessed are fetched. MapReduce and other tools use a globbing syntax, for example: field1;field2/**;field4{subfield1,subfield2} This will return field1, all the columns under field2, subfield1 and 2 under field4 but not field3
  • 44. Encodings • Bit Packing ‣ ‣ • Small integers encoded in the minimum bits required Useful for repetition level, definition levels and dictionary keys Run Length Encoding (RLE) ‣ Used in combination with bit packing ‣ Cheap compression ‣ Works well for definition level of sparse columns
  • 45. Encodings …continued: • Dictionary Encoding ‣ ‣ • Useful for columns with few (<50k) distinct values When applicable, compresses better and faster than heavyweight algorithms (e.g. gzip, lzo, snappy) Extensible ‣ Defining new encodings is supported by the format
  • 46. Future • Parquet 2.0 ‣ More encodings - ‣ Statistics - ‣ Delta encodings, improved encodings For query planners and predicate pushdown New page format - skip ahead better
  • 47. Questions? • Contact: @larsgeorge, lars@cloudera.com • Sources ‣ Parquet Sources: https://github.com/parquet/ parquet-format ‣ Blog Post with Info: https://blog.twitter.com/2013/ dremel-made-simple-with-parquet ‣ Impala Source: https://github.com/cloudera/impala ‣ Impala: http://www.cloudera.com/content/ cloudera/en/campaign/introducing-impala.html