Skip to content

Apache Parquet

Key idea:

Apache Parquet — columnar storage format developed by Twitter + Cloudera (2013), ASF top-level project. Default format for analytics on a data lake. Benefits: 10-100x compression vs CSV, column pruning (read only needed columns), predicate pushdown (filter applied in reader). Write Spark/Pandas/DuckDB, read anywhere.

Below: details, example, related terms, FAQ.

Check your site →

Details

  • Columnar: data stored by columns, not rows
  • Compression: Snappy, Gzip, ZSTD, LZ4 per column
  • Encoding: dictionary, RLE, bit-packing, delta for efficient storage
  • Predicate pushdown: WHERE date > 2026-01-01 at reader level, not scan
  • Schema embedded in file → self-describing

Example

# Python (pandas)
import pandas as pd
df = pd.read_csv('sales.csv')
df.to_parquet('sales.parquet', compression='snappy')

# Read only needed columns (column pruning)
df = pd.read_parquet('sales.parquet', columns=['date', 'amount'])

# DuckDB — query parquet directly
duckdb.sql("SELECT SUM(amount) FROM 'sales.parquet' WHERE date > '2026-01-01'")

Related Terms

Understanding Columnar Storage in Apache Parquet

Apache Parquet is a columnar storage format that optimizes data storage and retrieval in big data environments. Unlike traditional row-based storage formats like CSV, Parquet organizes data by columns. This structure enhances performance, particularly in analytical workloads where only a subset of columns is accessed. The key benefits of this approach include:

  • Efficient Compression: Parquet uses various encoding techniques such as dictionary encoding and run-length encoding, achieving compression rates that can be 10-100x better than row-based formats.
  • Column Pruning: When querying data, only the necessary columns are read, which significantly reduces the amount of data transferred and processed.
  • Predicate Pushdown: This feature allows filtering to occur at the storage level, meaning that unnecessary data is not loaded into memory, further improving query performance.

These optimizations make Parquet an ideal choice for data lakes and large-scale data processing frameworks, such as Apache Spark and Apache Hive.

Practical Examples of Using Apache Parquet

Implementing Apache Parquet in data processing workflows can greatly enhance performance and efficiency. Below are practical examples demonstrating how to create, read, and write Parquet files using popular tools like Apache Spark and Pandas.

Using Apache Spark

from pyspark.sql import SparkSession
spark = SparkSession.builder.appName('ParquetExample').getOrCreate()
df = spark.read.csv('data.csv', header=True, inferSchema=True)
df.write.parquet('output.parquet')

This code snippet creates a Spark DataFrame from a CSV file and writes it to a Parquet file.

Using Pandas

import pandas as pd
df = pd.read_csv('data.csv')
df.to_parquet('output.parquet')

Similarly, in Pandas, you can read a CSV file into a DataFrame and save it as a Parquet file with just two lines of code.

Using DuckDB

import duckdb
con = duckdb.connect()
con.execute("CREATE TABLE my_table AS SELECT * FROM 'data.csv'")
con.execute("COPY my_table TO 'output.parquet' (FORMAT 'parquet')")

DuckDB allows you to create a table directly from a CSV and export it as a Parquet file, demonstrating its seamless integration with this format.

Integration of Apache Parquet with Data Processing Frameworks

Apache Parquet is widely supported across various data processing frameworks, making it a versatile choice for analytics and data engineering tasks. Here’s how it integrates with some popular frameworks:

Apache Spark

Spark natively supports Parquet, allowing users to read and write Parquet files efficiently. When working with Spark, you can leverage its built-in optimizations for faster query execution. The use of DataFrames in Spark makes it simple to manipulate data stored in Parquet format.

Apache Hive

Hive also supports Parquet format, enabling users to run SQL-like queries on data stored in Parquet files. This integration allows for better performance due to the optimizations provided by Parquet's columnar storage.

Apache Drill

Drill is another framework that supports Parquet files, allowing for interactive analysis of large datasets. Its ability to query Parquet directly makes it a powerful tool for data exploration.

In addition to these frameworks, many BI tools and data warehouses can read Parquet files, making it an excellent choice for organizations looking to implement a data lake architecture. The widespread support and performance benefits make Apache Parquet a go-to format for modern data processing tasks.

Learn more

Frequently Asked Questions

Parquet vs CSV?

CSV: human-readable, row-oriented, no schema, no compression. Parquet: binary, columnar, schema embedded, 10-100x smaller. For analytics — always Parquet.

Parquet vs ORC?

Similar columnar formats. ORC: Hive ecosystem history, better indexing. Parquet: broader adoption (Spark default). 2026 — Parquet wins.

Typical size?

CSV 1 GB → Parquet 50-200 MB with Snappy compression (5-20x). ZSTD gives 2-3x better but at CPU cost.

Try the live tool that powered this guide

Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.