Apache DataFusion
- Problem solved: build a new data system (specialized database, accelerator, SQL tool) without rewriting a whole analytical query engine.
- Era: started around 2017 by Andy Grove, donated to the Apache Arrow project in February 2019, Apache top-level project since April 16, 2024.
- Category: embeddable, extensible query engine (Rust library).
Historical context
High-performance analytical engines have historically been tightly integrated systems (Vertica, Spark, DuckDB): file format, memory layout and execution are optimized together. The DataFusion paper (SIGMOD 2024) notes that building such a system "is expensive and requires substantial commercial and/or research funding". Every new specialized database (time series, streaming, observability) therefore reimplements a parser, optimizer and operators that are already well understood.
DataFusion starts as a small SQL engine in Rust. When it is donated to the
Arrow project in 2019, it only handles SELECT, WHERE and a few
aggregates over CSV files. It grows inside Arrow until it becomes a standalone
Apache project in 2024.
Key idea
A query engine made of building blocks: it works as is as an embedded SQL engine, but every stage can be replaced by an extension. The paper compares it to LLVM for compilers: a shared, high-quality foundation on which each system only builds what is specific to it. This is the so-called deconstructed database trend, alongside Calcite and Velox.
How it works
- Arrow memory: data flows as Arrow RecordBatches (8,192 rows by default), with no conversion between operators.
- Classic pipeline: a front end (SQL or DataFrame) produces a LogicalPlan, optimizers rewrite it (projection, filter and limit pushdown, join reordering), then it is lowered to a physical ExecutionPlan.
- Execution: pull-based streaming, parallelized across cores by partitions (Volcano-style exchange operators), on the Tokio async runtime. Sorts, final aggregations and hash joins can spill to disk.
- Sources: built-in Parquet, CSV, JSON, Avro and Arrow IPC, direct reads from
S3, Azure Blob Storage or Google Cloud Storage, and custom sources through
TableProvider. - More than 10 extension APIs: user-defined functions (scalar, aggregate, window), new languages, plan nodes, optimizer passes. Plans can be exchanged through Substrait.
By the numbers
| Figure | Context | Source |
|---|---|---|
| About 2x | Spark's performance reached on simple queries, according to Andy Grove (February 2018) | Andy Grove's blog |
| 8,192 rows | Default size of the RecordBatches produced by operators (2024) | SIGMOD 2024 paper |
| More than 10 | Major extension APIs (2024) | SIGMOD 2024 paper |
| From 11.7x faster to 6.74x slower | DataFusion 32.0.0 against DuckDB 0.9.1 on ClickBench, 1 core, depending on the query (2024) | SIGMOD 2024 paper |
| 32 cores | Up to this point, DataFusion and DuckDB scale near-linearly (2024) | SIGMOD 2024 paper |
| Over 30% | ClickBench improvement between DataFusion 34 (December 2023) and 43 (November 2024) | DataFusion blog |
| 14 GB, 100 files | ClickBench partitioned Parquet dataset on which DataFusion ranks first (November 2024) | DataFusion blog |
Milestones
- January 28, 2018: Andy Grove announces DataFusion on his blog ("Rust is for Big Data"), to test the idea of a Spark written in Rust.
- April 5, 2018: DataFusion adopts Arrow as its internal memory representation.
- November 4, 2018: Andy Grove stops promoting DataFusion as a Spark replacement and treats it as a hobby project.
- February 4, 2019: DataFusion is donated to the Arrow project.
- July 2019: Andy Grove starts Ballista, for distributed execution; Ballista is donated to Arrow in April 2021.
- February 2020: Andy Grove self-publishes the book "How Query Engines Work", which explains the design of DataFusion and Ballista.
- March 2024: Apple donates DataFusion Comet, an accelerator for Spark.
- April 16, 2024: DataFusion becomes an Apache top-level project, the same year as its SIGMOD 2024 paper.
- November 18, 2024: DataFusion is announced as the fastest engine on ClickBench's Parquet files, a first for a Rust engine.
Did you know?
- Born from a hypothesis about Spark: "had Apache Spark been implemented in Rust from the beginning then the performance of even a naive implementation would have been pretty good", Andy Grove wrote in 2018, while he spent his days on Spark jobs.
- From Arrow Rust to Apple: while looking for a memory format, Andy Grove donated the code that became the basis of the Rust implementation of Arrow. In April 2024, he joined Apple to work on Comet.
- Standards cost nothing: against DuckDB, the SIGMOD 2024 paper concludes
"there is nothing about using open standards that fundamentally limits
DataFusion's performance". DuckDB keeps the edge on high-cardinality
GROUP BY, and was still slightly faster on the cold ClickBench run in November 2024.
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Avoids reimplementing a full engine | A library, not a turnkey product |
| Extensible at almost every stage | Minimal catalog: the host system must provide its own |
| Native Arrow, Parquet and object stores | Runs on one machine; distribution comes from third-party projects (Ballista) |
| Apache governance, Apache 2.0 license | Rust-centric ecosystem (Python bindings available) |
Place in the system
- Foundation for specialized databases: InfluxDB 3.0, GreptimeDB (time series), Arroyo, Synnada (streaming).
- Native execution engine for Spark: Comet and Blaze keep Spark's parsing and optimization but run the plans with DataFusion.
- Building block of the Rust lakehouse ecosystem: delta-rs (Delta Lake), iceberg-rust (Iceberg).
- Cousin of DuckDB and Polars (vectorized columnar engines), but designed first as a component to assemble.
Sources
raw-data/apache/datafusion/datafusion.md- https://datafusion.apache.org/
- https://arrow.apache.org/blog/2019/02/04/datafusion-donation/
- https://datafusion.apache.org/blog/2024/05/07/datafusion-tlp/
- https://dl.acm.org/doi/10.1145/3626246.3653368
- https://andygrove.io/2018/01/rust-is-for-big-data/
- https://andygrove.io/2018/02/datafusion-update-02-11-18/
- https://andygrove.io/2018/04/datafusion-apache-arrow/
- https://andygrove.io/2018/11/datafusion-2019/
- https://datafusion.apache.org/blog/2024/11/18/datafusion-fastest-single-node-parquet-clickbench/
- Date of the first commit (the donation post says "started two years ago", so around 2017; first public announcement found on January 28, 2018).
- Detail Ballista (distributed execution) and Comet.