This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/datafusion-site.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 7f45a0e Commit build products
7f45a0e is described below
commit 7f45a0e2bfe7d0a4f24f813ee604d6a87fd788b1
Author: Build Pelican (action) <[email protected]>
AuthorDate: Thu Mar 20 16:38:46 2025 +0000
Commit build products
---
output/2025/03/20/parquet-pruning/index.html | 126 ++++++++++++++++++++++
output/author/xiangpeng-hao.html | 109 +++++++++++++++++++
output/category/blog.html | 40 +++++++
output/feed.xml | 23 +++-
output/feeds/all-en.atom.xml | 88 ++++++++++++++-
output/feeds/blog.atom.xml | 88 ++++++++++++++-
output/feeds/xiangpeng-hao.atom.xml | 88 +++++++++++++++
output/feeds/xiangpeng-hao.rss.xml | 23 ++++
output/images/parquet-pruning/filter-pushdown.jpg | Bin 0 -> 376764 bytes
output/images/parquet-pruning/read-parquet.jpg | Bin 0 -> 284097 bytes
output/index.html | 40 +++++++
11 files changed, 622 insertions(+), 3 deletions(-)
diff --git a/output/2025/03/20/parquet-pruning/index.html
b/output/2025/03/20/parquet-pruning/index.html
new file mode 100644
index 0000000..5afb3dc
--- /dev/null
+++ b/output/2025/03/20/parquet-pruning/index.html
@@ -0,0 +1,126 @@
+<!doctype html>
+<html class="no-js" lang="en" dir="ltr">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Parquet Pruning in DataFusion: Read Only What Matters - Apache
DataFusion Blog</title>
+<link href="/blog/css/bootstrap.min.css" rel="stylesheet">
+<link href="/blog/css/fontawesome.all.min.css" rel="stylesheet">
+<link href="/blog/css/headerlink.css" rel="stylesheet">
+<link href="/blog/highlight/default.min.css" rel="stylesheet">
+<script src="/blog/highlight/highlight.js"></script>
+<script>hljs.highlightAll();</script> </head>
+ <body class="d-flex flex-column h-100">
+ <main class="flex-shrink-0">
+<!-- nav bar -->
+<nav class="navbar navbar-expand-lg navbar-dark bg-dark" aria-label="Fifth
navbar example">
+ <div class="container-fluid">
+ <a class="navbar-brand" href="/blog"><img
src="/blog/images/logo_original4x.png" style="height: 32px;"/> Apache
DataFusion Blog</a>
+ <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarADP" aria-controls="navbarADP" aria-expanded="false"
aria-label="Toggle navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+
+ <div class="collapse navbar-collapse" id="navbarADP">
+ <ul class="navbar-nav me-auto mb-2 mb-lg-0">
+ <li class="nav-item">
+ <a class="nav-link" href="/blog/about.html">About</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="/blog/feed.xml">RSS</a>
+ </li>
+ </ul>
+ </div>
+ </div>
+</nav>
+
+
+<!-- page contents -->
+<div id="contents">
+ <div class="bg-white p-5 rounded">
+ <div class="col-sm-8 mx-auto">
+ <h1>
+ Parquet Pruning in DataFusion: Read Only What Matters
+ </h1>
+ <p>Posted on: Thu 20 March 2025 by Xiangpeng Hao</p>
+ <!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng Hao's
blog</a>. Thanks to <a href="https://www.influxdata.com/">InfluxData</a> for
sponsoring this work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a> has become the
industry standard for storing columnar data, and reading Parquet efficiently --
especially from remote storage -- is crucial for query performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache DataFusion</a> implements
advanced Parquet pruning techniques to effectively read only the data that
matters for a given query.</p>
+<p>Achieving high performance adds complexity.
+This post provides an overview of the techniques used in DataFusion to
selectively read Parquet files.</p>
+<h3>The pipeline</h3>
+<p>The diagram below illustrates the <a
href="https://docs.rs/datafusion/46.0.0/datafusion/datasource/physical_plan/parquet/source/struct.ParquetSource.html```">Parquet
reading pipeline</a> in DataFusion, highlighting how data flows through
various pruning stages before being converted to Arrow format:</p>
+<p><img alt="Parquet pruning pipeline in DataFusion" class="img-responsive"
src="/blog/images/parquet-pruning/read-parquet.jpg" width="100%"/></p>
+<h4>Background: Parquet file structure</h4>
+<p>As shown in the figure above, each Parquet file has multiple row groups.
Each row group contains a set of columns, and each column contains a set of
pages.</p>
+<p>Pages are the smallest units of data in Parquet files and typically contain
compressed and encoded values for a specific column. This hierarchical
structure enables efficient columnar access and forms the foundation for the
pruning techniques we'll discuss.</p>
+<p>Check out <a
href="https://www.influxdata.com/blog/querying-parquet-millisecond-latency/">Querying
Parquet with Millisecond Latency</a> for more details on the Parquet file
structure.</p>
+<h4>1. Read metadata</h4>
+<p>DataFusion first reads the <a
href="https://parquet.apache.org/docs/file-format/metadata/">Parquet
metadata</a> to understand the data in the file.
+Metadata often includes data schema, the exact location of each row group and
column chunk, and their corresponding statistics (e.g., min/max values).
+It also optionally includes <a
href="https://parquet.apache.org/docs/file-format/pageindex/">page-level
stats</a> and <a
href="https://www.influxdata.com/blog/using-parquets-bloom-filters/">Bloom
filters</a>.
+This information is used to prune the file before reading the actual data.</p>
+<p><a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L118">Fetching
metadata</a> requires up to two network requests: one to read the footer size
from the end of the file, and another to read the footer itself. </p>
+<p><a
href="https://www.influxdata.com/blog/how-good-parquet-wide-tables/">Decoding
metadata</a> is generally fast since it only requires parsing a small amount of
data. However, for tables with hundreds or thousands of columns, the metadata
can become quite large and decoding it can become a bottleneck. This is
particularly noticeable when scanning many small files.</p>
+<p>Reading metadata is latency-critical, so DataFusion allows users to cache
metadata through the <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L39">ParquetFileReaderFactory</a>
trait.</p>
+<h4>2. Prune by projection</h4>
+<p>The simplest yet perhaps most effective pruning is to read only the columns
that are needed.
+This is because queries usually don't select all columns, e.g., <code>SELECT a
FROM table</code> only reads column <code>a</code>.
+As a <strong>columnar</strong> format, Parquet allows DataFusion to <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/mod.rs#L778">only
read</a> the <strong>columns</strong> that are needed.</p>
+<p>This projection pruning happens at the column level and can dramatically
reduce I/O when working with wide tables where queries typically access only a
small subset of columns.</p>
+<h4>3. Prune by row group stats and Bloom filters</h4>
+<p>Each row group has <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/physical_optimizer/pruning.rs#L81">basic
stats</a> like min/max values for each column.
+DataFusion applies the query predicates to these stats to prune row groups,
e.g., <code>SELECT * FROM table WHERE a > 10</code> will only read row
groups where <code>a</code> has a max value greater than 10.</p>
+<p>Sometimes min/max stats are too simple to prune effectively, so Parquet
also supports <a
href="https://www.influxdata.com/blog/using-parquets-bloom-filters/">Bloom
filters</a>. DataFusion <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/opener.rs#L202">uses
Bloom filters when available</a>.</p>
+<p>Bloom filters are particularly effective for equality predicates
(<code>WHERE a = 10</code>) and can significantly reduce the number of row
groups that need to be read for point queries or queries with highly selective
predicates.</p>
+<h4>4. Prune by page stats</h4>
+<p>Parquet optionally supports <a
href="https://github.com/apache/parquet-format/blob/master/PageIndex.md">page-level
stats</a> -- similar to row group stats but more fine-grained.
+DataFusion implements <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/opener.rs#L219">page
pruning</a> when the stats are present.</p>
+<p>Page-level pruning provides an additional layer of filtering after row
group pruning. It allows DataFusion to skip individual pages within a row
group, further reducing the amount of data that needs to be read and
decoded.</p>
+<h4>5. Read from storage</h4>
+<p>Now we (hopefully) have pruned the Parquet file into small ranges of bytes,
i.e., the <a
href="https://github.com/apache/datafusion/blob/76a7789ace33ced54c973fa0d5fc9d1866e1bf19/datafusion/datasource-parquet/src/access_plan.rs#L86">Access
Plan</a>.
+The last step is to <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L103">make
requests</a> to fetch those bytes and decode them into Arrow RecordBatch. </p>
+<h3>Preview of coming attractions: filter pushdown</h3>
+<p>So far we have discussed techniques that prune the Parquet file using only
the metadata, i.e., before reading the actual data.</p>
+<p>Filter pushdown, also known as predicate pushdown or late materialization,
is a technique that prunes data during scanning, with filters being generated
and applied in the Parquet reader.</p>
+<p><img alt="Filter pushdown in DataFusion" class="img-responsive"
src="/blog/images/parquet-pruning/filter-pushdown.jpg" width="100%"/></p>
+<p>Unlike metadata-based pruning which works at the row group or page level,
filter pushdown operates at the row level, allowing DataFusion to filter out
individual rows that don't match the query predicates during the decoding
process.</p>
+<p>DataFusion <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs#L154">implements
filter pushdown</a> but has <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/common/src/config.rs#L382">not
enabled it by default</a> due to <a
href="https://github.com/apache/datafusion/issues/3463">some performance
regressions</a>.</p>
+<p>We are working to remove the <a
href="https://github.com/apache/arrow-rs/issues/5523#issuecomment-2429470872">remaining
performance issues</a> and enable it by default, which we will discuss in the
next blog post.</p>
+<h3>Conclusion</h3>
+<p>DataFusion employs a multi-step approach to Parquet pruning, from column
projection to row group stats, page stats, and potentially row-level filtering.
+Each step may reduce the amount of data to be read and processed,
significantly improving query performance.</p>
+ </div>
+ </div>
+ </div>
+ <!-- footer -->
+ <div class="row">
+ <div class="large-12 medium-12 columns">
+ <p style="font-style: italic; font-size: 0.8rem; text-align: center;">
+ Copyright 2025, <a href="https://www.apache.org/">The Apache
Software Foundation</a>, Licensed under the <a
href="https://www.apache.org/licenses/LICENSE-2.0">Apache License, Version
2.0</a>.<br/>
+ Apache® and the Apache feather logo are trademarks of The Apache
Software Foundation.
+ </p>
+ </div>
+ </div>
+ <script src="/blog/js/bootstrap.bundle.min.js"></script> </main>
+ </body>
+</html>
diff --git a/output/author/xiangpeng-hao.html b/output/author/xiangpeng-hao.html
new file mode 100644
index 0000000..f2303b8
--- /dev/null
+++ b/output/author/xiangpeng-hao.html
@@ -0,0 +1,109 @@
+ <!doctype html>
+ <html class="no-js" lang="en" dir="ltr">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Apache DataFusion Blog</title>
+<link href="/blog/css/bootstrap.min.css" rel="stylesheet">
+<link href="/blog/css/fontawesome.all.min.css" rel="stylesheet">
+<link href="/blog/css/headerlink.css" rel="stylesheet">
+<link href="/blog/highlight/default.min.css" rel="stylesheet">
+<script src="/blog/highlight/highlight.js"></script>
+<script>hljs.highlightAll();</script> <link
href="/blog/css/blog_index.css" rel="stylesheet">
+ </head>
+ <body class="d-flex flex-column h-100">
+ <main class="flex-shrink-0">
+ <div>
+
+<!-- nav bar -->
+<nav class="navbar navbar-expand-lg navbar-dark bg-dark" aria-label="Fifth
navbar example">
+ <div class="container-fluid">
+ <a class="navbar-brand" href="/blog"><img
src="/blog/images/logo_original4x.png" style="height: 32px;"/> Apache
DataFusion Blog</a>
+ <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarADP" aria-controls="navbarADP" aria-expanded="false"
aria-label="Toggle navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+
+ <div class="collapse navbar-collapse" id="navbarADP">
+ <ul class="navbar-nav me-auto mb-2 mb-lg-0">
+ <li class="nav-item">
+ <a class="nav-link" href="/blog/about.html">About</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="/blog/feed.xml">RSS</a>
+ </li>
+ </ul>
+ </div>
+ </div>
+</nav>
+ <div id="contents">
+ <div class="bg-white p-5 rounded">
+ <div class="col-sm-8 mx-auto">
+<div id="contents">
+ <div class="bg-white p-5 rounded">
+ <div class="col-sm-8 mx-auto">
+
+ <h3>Welcome to the Apache DataFusion Blog!</h3>
+ <p><i>Here you can find the latest updates from DataFusion and
related projects.</i></p>
+
+
+ <!-- Post -->
+ <div class="row">
+ <div class="callout">
+ <article class="post">
+ <header>
+ <div class="title">
+ <h1><a href="/blog/2025/03/20/parquet-pruning">Parquet
Pruning in DataFusion: Read Only What Matters</a></h1>
+ <p>Posted on: Thu 20 March 2025 by Xiangpeng Hao</p>
+ <p><!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng Hao's
blog</a>. Thanks to <a href="https://www.influxdata.com/">InfluxData</a> for
sponsoring this work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a> has become the
industry standard for storing columnar data, and reading Parquet efficiently --
especially from remote storage -- is crucial for query performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache DataFusion …</a></p></p>
+ <footer>
+ <ul class="actions">
+ <div style="text-align: right"><a
href="/blog/2025/03/20/parquet-pruning" class="button medium">Continue
Reading</a></div>
+ </ul>
+ <ul class="stats">
+ </ul>
+ </footer>
+ </article>
+ </div>
+ </div>
+
+ </div>
+ </div>
+</div> </div>
+ </div>
+ </div>
+
+ <!-- footer -->
+ <div class="row">
+ <div class="large-12 medium-12 columns">
+ <p style="font-style: italic; font-size: 0.8rem; text-align: center;">
+ Copyright 2025, <a href="https://www.apache.org/">The Apache
Software Foundation</a>, Licensed under the <a
href="https://www.apache.org/licenses/LICENSE-2.0">Apache License, Version
2.0</a>.<br/>
+ Apache® and the Apache feather logo are trademarks of The Apache
Software Foundation.
+ </p>
+ </div>
+ </div>
+ <script src="/blog/js/bootstrap.bundle.min.js"></script> </div>
+ </main>
+ </body>
+ </html>
diff --git a/output/category/blog.html b/output/category/blog.html
index 2081a78..a911192 100644
--- a/output/category/blog.html
+++ b/output/category/blog.html
@@ -47,6 +47,46 @@
<p><i>Here you can find the latest updates from DataFusion and
related projects.</i></p>
+ <!-- Post -->
+ <div class="row">
+ <div class="callout">
+ <article class="post">
+ <header>
+ <div class="title">
+ <h1><a href="/blog/2025/03/20/parquet-pruning">Parquet
Pruning in DataFusion: Read Only What Matters</a></h1>
+ <p>Posted on: Thu 20 March 2025 by Xiangpeng Hao</p>
+ <p><!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng Hao's
blog</a>. Thanks to <a href="https://www.influxdata.com/">InfluxData</a> for
sponsoring this work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a> has become the
industry standard for storing columnar data, and reading Parquet efficiently --
especially from remote storage -- is crucial for query performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache DataFusion …</a></p></p>
+ <footer>
+ <ul class="actions">
+ <div style="text-align: right"><a
href="/blog/2025/03/20/parquet-pruning" class="button medium">Continue
Reading</a></div>
+ </ul>
+ <ul class="stats">
+ </ul>
+ </footer>
+ </article>
+ </div>
+ </div>
<!-- Post -->
<div class="row">
<div class="callout">
diff --git a/output/feed.xml b/output/feed.xml
index 992f031..e055437 100644
--- a/output/feed.xml
+++ b/output/feed.xml
@@ -1,5 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0"><channel><title>Apache DataFusion
Blog</title><link>https://datafusion.apache.org/blog/</link><description></description><lastBuildDate>Tue,
11 Mar 2025 00:00:00 +0000</lastBuildDate><item><title>Using Ordering for
Better Plans in Apache
DataFusion</title><link>https://datafusion.apache.org/blog/2025/03/11/ordering-analysis</link><description><!--
+<rss version="2.0"><channel><title>Apache DataFusion
Blog</title><link>https://datafusion.apache.org/blog/</link><description></description><lastBuildDate>Thu,
20 Mar 2025 00:00:00 +0000</lastBuildDate><item><title>Parquet Pruning in
DataFusion: Read Only What
Matters</title><link>https://datafusion.apache.org/blog/2025/03/20/parquet-pruning</link><description><!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng
Hao's blog</a>. Thanks to <a
href="https://www.influxdata.com/">InfluxData</a> for sponsoring this
work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a>
has become the industry standard for storing columnar data, and reading Parquet
efficiently -- especially from remote storage -- is crucial for query
performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache DataFusion
…</a></p></description><dc:creator
xmlns:dc="http://purl.org/dc/elements/1.1/">Xiangpeng
Hao</dc:creator><pubDate>Thu, 20 Mar 2025 00:00:00 +0000</pubDate><guid
isPermaLink="false">tag:datafusion.apache.org,2025-03-20:/blog/2025/03/20/parquet-pruning</guid><category>blog</category></item><item><title>Using
Ordering for Better Plans in Apache
DataFusion</title><link>https://datafusion.apache.org/blog/202 [...]
{% comment %}
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
diff --git a/output/feeds/all-en.atom.xml b/output/feeds/all-en.atom.xml
index 1c61f3b..178be50 100644
--- a/output/feeds/all-en.atom.xml
+++ b/output/feeds/all-en.atom.xml
@@ -1,5 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom"><title>Apache DataFusion
Blog</title><link href="https://datafusion.apache.org/blog/"
rel="alternate"></link><link
href="https://datafusion.apache.org/blog/feeds/all-en.atom.xml"
rel="self"></link><id>https://datafusion.apache.org/blog/</id><updated>2025-03-11T00:00:00+00:00</updated><subtitle></subtitle><entry><title>Using
Ordering for Better Plans in Apache DataFusion</title><link
href="https://datafusion.apache.org/blog/2025/03/11/ordering-ana [...]
+<feed xmlns="http://www.w3.org/2005/Atom"><title>Apache DataFusion
Blog</title><link href="https://datafusion.apache.org/blog/"
rel="alternate"></link><link
href="https://datafusion.apache.org/blog/feeds/all-en.atom.xml"
rel="self"></link><id>https://datafusion.apache.org/blog/</id><updated>2025-03-20T00:00:00+00:00</updated><subtitle></subtitle><entry><title>Parquet
Pruning in DataFusion: Read Only What Matters</title><link
href="https://datafusion.apache.org/blog/2025/03/20/parquet-pru [...]
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng
Hao's blog</a>. Thanks to <a
href="https://www.influxdata.com/">InfluxData</a> for sponsoring this
work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a>
has become the industry standard for storing columnar data, and reading Parquet
efficiently -- especially from remote storage -- is crucial for query
performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache DataFusion
…</a></p></summary><content type="html"><!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng
Hao's blog</a>. Thanks to <a
href="https://www.influxdata.com/">InfluxData</a> for sponsoring this
work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a>
has become the industry standard for storing columnar data, and reading Parquet
efficiently -- especially from remote storage -- is crucial for query
performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache
DataFusion</a> implements advanced Parquet pruning techniques to
effectively read only the data that matters for a given query.</p>
+<p>Achieving high performance adds complexity.
+This post provides an overview of the techniques used in DataFusion to
selectively read Parquet files.</p>
+<h3>The pipeline</h3>
+<p>The diagram below illustrates the <a
href="https://docs.rs/datafusion/46.0.0/datafusion/datasource/physical_plan/parquet/source/struct.ParquetSource.html```">Parquet
reading pipeline</a> in DataFusion, highlighting how data flows through
various pruning stages before being converted to Arrow format:</p>
+<p><img alt="Parquet pruning pipeline in DataFusion"
class="img-responsive" src="/blog/images/parquet-pruning/read-parquet.jpg"
width="100%"/></p>
+<h4>Background: Parquet file structure</h4>
+<p>As shown in the figure above, each Parquet file has multiple row
groups. Each row group contains a set of columns, and each column contains a
set of pages.</p>
+<p>Pages are the smallest units of data in Parquet files and typically
contain compressed and encoded values for a specific column. This hierarchical
structure enables efficient columnar access and forms the foundation for the
pruning techniques we'll discuss.</p>
+<p>Check out <a
href="https://www.influxdata.com/blog/querying-parquet-millisecond-latency/">Querying
Parquet with Millisecond Latency</a> for more details on the Parquet
file structure.</p>
+<h4>1. Read metadata</h4>
+<p>DataFusion first reads the <a
href="https://parquet.apache.org/docs/file-format/metadata/">Parquet
metadata</a> to understand the data in the file.
+Metadata often includes data schema, the exact location of each row group and
column chunk, and their corresponding statistics (e.g., min/max values).
+It also optionally includes <a
href="https://parquet.apache.org/docs/file-format/pageindex/">page-level
stats</a> and <a
href="https://www.influxdata.com/blog/using-parquets-bloom-filters/">Bloom
filters</a>.
+This information is used to prune the file before reading the actual
data.</p>
+<p><a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L118">Fetching
metadata</a> requires up to two network requests: one to read the footer
size from the end of the file, and another to read the footer itself. </p>
+<p><a
href="https://www.influxdata.com/blog/how-good-parquet-wide-tables/">Decoding
metadata</a> is generally fast since it only requires parsing a small
amount of data. However, for tables with hundreds or thousands of columns, the
metadata can become quite large and decoding it can become a bottleneck. This
is particularly noticeable when scanning many small files.</p>
+<p>Reading metadata is latency-critical, so DataFusion allows users to
cache metadata through the <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L39">ParquetFileReaderFactory</a>
trait.</p>
+<h4>2. Prune by projection</h4>
+<p>The simplest yet perhaps most effective pruning is to read only the
columns that are needed.
+This is because queries usually don't select all columns, e.g.,
<code>SELECT a FROM table</code> only reads column
<code>a</code>.
+As a <strong>columnar</strong> format, Parquet allows DataFusion
to <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/mod.rs#L778">only
read</a> the <strong>columns</strong> that are
needed.</p>
+<p>This projection pruning happens at the column level and can
dramatically reduce I/O when working with wide tables where queries typically
access only a small subset of columns.</p>
+<h4>3. Prune by row group stats and Bloom filters</h4>
+<p>Each row group has <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/physical_optimizer/pruning.rs#L81">basic
stats</a> like min/max values for each column.
+DataFusion applies the query predicates to these stats to prune row groups,
e.g., <code>SELECT * FROM table WHERE a &gt; 10</code> will
only read row groups where <code>a</code> has a max value greater
than 10.</p>
+<p>Sometimes min/max stats are too simple to prune effectively, so
Parquet also supports <a
href="https://www.influxdata.com/blog/using-parquets-bloom-filters/">Bloom
filters</a>. DataFusion <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/opener.rs#L202">uses
Bloom filters when available</a>.</p>
+<p>Bloom filters are particularly effective for equality predicates
(<code>WHERE a = 10</code>) and can significantly reduce the number
of row groups that need to be read for point queries or queries with highly
selective predicates.</p>
+<h4>4. Prune by page stats</h4>
+<p>Parquet optionally supports <a
href="https://github.com/apache/parquet-format/blob/master/PageIndex.md">page-level
stats</a> -- similar to row group stats but more fine-grained.
+DataFusion implements <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/opener.rs#L219">page
pruning</a> when the stats are present.</p>
+<p>Page-level pruning provides an additional layer of filtering after
row group pruning. It allows DataFusion to skip individual pages within a row
group, further reducing the amount of data that needs to be read and
decoded.</p>
+<h4>5. Read from storage</h4>
+<p>Now we (hopefully) have pruned the Parquet file into small ranges of
bytes, i.e., the <a
href="https://github.com/apache/datafusion/blob/76a7789ace33ced54c973fa0d5fc9d1866e1bf19/datafusion/datasource-parquet/src/access_plan.rs#L86">Access
Plan</a>.
+The last step is to <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L103">make
requests</a> to fetch those bytes and decode them into Arrow
RecordBatch. </p>
+<h3>Preview of coming attractions: filter pushdown</h3>
+<p>So far we have discussed techniques that prune the Parquet file using
only the metadata, i.e., before reading the actual data.</p>
+<p>Filter pushdown, also known as predicate pushdown or late
materialization, is a technique that prunes data during scanning, with filters
being generated and applied in the Parquet reader.</p>
+<p><img alt="Filter pushdown in DataFusion" class="img-responsive"
src="/blog/images/parquet-pruning/filter-pushdown.jpg"
width="100%"/></p>
+<p>Unlike metadata-based pruning which works at the row group or page
level, filter pushdown operates at the row level, allowing DataFusion to filter
out individual rows that don't match the query predicates during the decoding
process.</p>
+<p>DataFusion <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs#L154">implements
filter pushdown</a> but has <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/common/src/config.rs#L382">not
enabled it by default</a> due to <a
href="https://github.com/apache/datafusion/issues/3463">some perform [...]
+<p>We are working to remove the <a
href="https://github.com/apache/arrow-rs/issues/5523#issuecomment-2429470872">remaining
performance issues</a> and enable it by default, which we will discuss
in the next blog post.</p>
+<h3>Conclusion</h3>
+<p>DataFusion employs a multi-step approach to Parquet pruning, from
column projection to row group stats, page stats, and potentially row-level
filtering.
+Each step may reduce the amount of data to be read and processed,
significantly improving query performance.</p></content><category
term="blog"></category></entry><entry><title>Using Ordering for Better Plans in
Apache DataFusion</title><link
href="https://datafusion.apache.org/blog/2025/03/11/ordering-analysis"
rel="alternate"></link><published>2025-03-11T00:00:00+00:00</published><updated>2025-03-11T00:00:00+00:00</updated><author><name>Mustafa
Akur, Andrew Lamb</name></author><i [...]
{% comment %}
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
diff --git a/output/feeds/blog.atom.xml b/output/feeds/blog.atom.xml
index 67f1633..15bc2f2 100644
--- a/output/feeds/blog.atom.xml
+++ b/output/feeds/blog.atom.xml
@@ -1,5 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom"><title>Apache DataFusion Blog -
blog</title><link href="https://datafusion.apache.org/blog/"
rel="alternate"></link><link
href="https://datafusion.apache.org/blog/feeds/blog.atom.xml"
rel="self"></link><id>https://datafusion.apache.org/blog/</id><updated>2025-03-11T00:00:00+00:00</updated><subtitle></subtitle><entry><title>Using
Ordering for Better Plans in Apache DataFusion</title><link
href="https://datafusion.apache.org/blog/2025/03/11/orderin [...]
+<feed xmlns="http://www.w3.org/2005/Atom"><title>Apache DataFusion Blog -
blog</title><link href="https://datafusion.apache.org/blog/"
rel="alternate"></link><link
href="https://datafusion.apache.org/blog/feeds/blog.atom.xml"
rel="self"></link><id>https://datafusion.apache.org/blog/</id><updated>2025-03-20T00:00:00+00:00</updated><subtitle></subtitle><entry><title>Parquet
Pruning in DataFusion: Read Only What Matters</title><link
href="https://datafusion.apache.org/blog/2025/03/20/parque [...]
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng
Hao's blog</a>. Thanks to <a
href="https://www.influxdata.com/">InfluxData</a> for sponsoring this
work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a>
has become the industry standard for storing columnar data, and reading Parquet
efficiently -- especially from remote storage -- is crucial for query
performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache DataFusion
…</a></p></summary><content type="html"><!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng
Hao's blog</a>. Thanks to <a
href="https://www.influxdata.com/">InfluxData</a> for sponsoring this
work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a>
has become the industry standard for storing columnar data, and reading Parquet
efficiently -- especially from remote storage -- is crucial for query
performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache
DataFusion</a> implements advanced Parquet pruning techniques to
effectively read only the data that matters for a given query.</p>
+<p>Achieving high performance adds complexity.
+This post provides an overview of the techniques used in DataFusion to
selectively read Parquet files.</p>
+<h3>The pipeline</h3>
+<p>The diagram below illustrates the <a
href="https://docs.rs/datafusion/46.0.0/datafusion/datasource/physical_plan/parquet/source/struct.ParquetSource.html```">Parquet
reading pipeline</a> in DataFusion, highlighting how data flows through
various pruning stages before being converted to Arrow format:</p>
+<p><img alt="Parquet pruning pipeline in DataFusion"
class="img-responsive" src="/blog/images/parquet-pruning/read-parquet.jpg"
width="100%"/></p>
+<h4>Background: Parquet file structure</h4>
+<p>As shown in the figure above, each Parquet file has multiple row
groups. Each row group contains a set of columns, and each column contains a
set of pages.</p>
+<p>Pages are the smallest units of data in Parquet files and typically
contain compressed and encoded values for a specific column. This hierarchical
structure enables efficient columnar access and forms the foundation for the
pruning techniques we'll discuss.</p>
+<p>Check out <a
href="https://www.influxdata.com/blog/querying-parquet-millisecond-latency/">Querying
Parquet with Millisecond Latency</a> for more details on the Parquet
file structure.</p>
+<h4>1. Read metadata</h4>
+<p>DataFusion first reads the <a
href="https://parquet.apache.org/docs/file-format/metadata/">Parquet
metadata</a> to understand the data in the file.
+Metadata often includes data schema, the exact location of each row group and
column chunk, and their corresponding statistics (e.g., min/max values).
+It also optionally includes <a
href="https://parquet.apache.org/docs/file-format/pageindex/">page-level
stats</a> and <a
href="https://www.influxdata.com/blog/using-parquets-bloom-filters/">Bloom
filters</a>.
+This information is used to prune the file before reading the actual
data.</p>
+<p><a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L118">Fetching
metadata</a> requires up to two network requests: one to read the footer
size from the end of the file, and another to read the footer itself. </p>
+<p><a
href="https://www.influxdata.com/blog/how-good-parquet-wide-tables/">Decoding
metadata</a> is generally fast since it only requires parsing a small
amount of data. However, for tables with hundreds or thousands of columns, the
metadata can become quite large and decoding it can become a bottleneck. This
is particularly noticeable when scanning many small files.</p>
+<p>Reading metadata is latency-critical, so DataFusion allows users to
cache metadata through the <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L39">ParquetFileReaderFactory</a>
trait.</p>
+<h4>2. Prune by projection</h4>
+<p>The simplest yet perhaps most effective pruning is to read only the
columns that are needed.
+This is because queries usually don't select all columns, e.g.,
<code>SELECT a FROM table</code> only reads column
<code>a</code>.
+As a <strong>columnar</strong> format, Parquet allows DataFusion
to <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/mod.rs#L778">only
read</a> the <strong>columns</strong> that are
needed.</p>
+<p>This projection pruning happens at the column level and can
dramatically reduce I/O when working with wide tables where queries typically
access only a small subset of columns.</p>
+<h4>3. Prune by row group stats and Bloom filters</h4>
+<p>Each row group has <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/physical_optimizer/pruning.rs#L81">basic
stats</a> like min/max values for each column.
+DataFusion applies the query predicates to these stats to prune row groups,
e.g., <code>SELECT * FROM table WHERE a &gt; 10</code> will
only read row groups where <code>a</code> has a max value greater
than 10.</p>
+<p>Sometimes min/max stats are too simple to prune effectively, so
Parquet also supports <a
href="https://www.influxdata.com/blog/using-parquets-bloom-filters/">Bloom
filters</a>. DataFusion <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/opener.rs#L202">uses
Bloom filters when available</a>.</p>
+<p>Bloom filters are particularly effective for equality predicates
(<code>WHERE a = 10</code>) and can significantly reduce the number
of row groups that need to be read for point queries or queries with highly
selective predicates.</p>
+<h4>4. Prune by page stats</h4>
+<p>Parquet optionally supports <a
href="https://github.com/apache/parquet-format/blob/master/PageIndex.md">page-level
stats</a> -- similar to row group stats but more fine-grained.
+DataFusion implements <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/opener.rs#L219">page
pruning</a> when the stats are present.</p>
+<p>Page-level pruning provides an additional layer of filtering after
row group pruning. It allows DataFusion to skip individual pages within a row
group, further reducing the amount of data that needs to be read and
decoded.</p>
+<h4>5. Read from storage</h4>
+<p>Now we (hopefully) have pruned the Parquet file into small ranges of
bytes, i.e., the <a
href="https://github.com/apache/datafusion/blob/76a7789ace33ced54c973fa0d5fc9d1866e1bf19/datafusion/datasource-parquet/src/access_plan.rs#L86">Access
Plan</a>.
+The last step is to <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L103">make
requests</a> to fetch those bytes and decode them into Arrow
RecordBatch. </p>
+<h3>Preview of coming attractions: filter pushdown</h3>
+<p>So far we have discussed techniques that prune the Parquet file using
only the metadata, i.e., before reading the actual data.</p>
+<p>Filter pushdown, also known as predicate pushdown or late
materialization, is a technique that prunes data during scanning, with filters
being generated and applied in the Parquet reader.</p>
+<p><img alt="Filter pushdown in DataFusion" class="img-responsive"
src="/blog/images/parquet-pruning/filter-pushdown.jpg"
width="100%"/></p>
+<p>Unlike metadata-based pruning which works at the row group or page
level, filter pushdown operates at the row level, allowing DataFusion to filter
out individual rows that don't match the query predicates during the decoding
process.</p>
+<p>DataFusion <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs#L154">implements
filter pushdown</a> but has <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/common/src/config.rs#L382">not
enabled it by default</a> due to <a
href="https://github.com/apache/datafusion/issues/3463">some perform [...]
+<p>We are working to remove the <a
href="https://github.com/apache/arrow-rs/issues/5523#issuecomment-2429470872">remaining
performance issues</a> and enable it by default, which we will discuss
in the next blog post.</p>
+<h3>Conclusion</h3>
+<p>DataFusion employs a multi-step approach to Parquet pruning, from
column projection to row group stats, page stats, and potentially row-level
filtering.
+Each step may reduce the amount of data to be read and processed,
significantly improving query performance.</p></content><category
term="blog"></category></entry><entry><title>Using Ordering for Better Plans in
Apache DataFusion</title><link
href="https://datafusion.apache.org/blog/2025/03/11/ordering-analysis"
rel="alternate"></link><published>2025-03-11T00:00:00+00:00</published><updated>2025-03-11T00:00:00+00:00</updated><author><name>Mustafa
Akur, Andrew Lamb</name></author><i [...]
{% comment %}
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
diff --git a/output/feeds/xiangpeng-hao.atom.xml
b/output/feeds/xiangpeng-hao.atom.xml
new file mode 100644
index 0000000..ed74057
--- /dev/null
+++ b/output/feeds/xiangpeng-hao.atom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom"><title>Apache DataFusion Blog -
Xiangpeng Hao</title><link href="https://datafusion.apache.org/blog/"
rel="alternate"></link><link
href="https://datafusion.apache.org/blog/feeds/xiangpeng-hao.atom.xml"
rel="self"></link><id>https://datafusion.apache.org/blog/</id><updated>2025-03-20T00:00:00+00:00</updated><subtitle></subtitle><entry><title>Parquet
Pruning in DataFusion: Read Only What Matters</title><link
href="https://datafusion.apache.org/blog [...]
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng
Hao's blog</a>. Thanks to <a
href="https://www.influxdata.com/">InfluxData</a> for sponsoring this
work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a>
has become the industry standard for storing columnar data, and reading Parquet
efficiently -- especially from remote storage -- is crucial for query
performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache DataFusion
…</a></p></summary><content type="html"><!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng
Hao's blog</a>. Thanks to <a
href="https://www.influxdata.com/">InfluxData</a> for sponsoring this
work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a>
has become the industry standard for storing columnar data, and reading Parquet
efficiently -- especially from remote storage -- is crucial for query
performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache
DataFusion</a> implements advanced Parquet pruning techniques to
effectively read only the data that matters for a given query.</p>
+<p>Achieving high performance adds complexity.
+This post provides an overview of the techniques used in DataFusion to
selectively read Parquet files.</p>
+<h3>The pipeline</h3>
+<p>The diagram below illustrates the <a
href="https://docs.rs/datafusion/46.0.0/datafusion/datasource/physical_plan/parquet/source/struct.ParquetSource.html```">Parquet
reading pipeline</a> in DataFusion, highlighting how data flows through
various pruning stages before being converted to Arrow format:</p>
+<p><img alt="Parquet pruning pipeline in DataFusion"
class="img-responsive" src="/blog/images/parquet-pruning/read-parquet.jpg"
width="100%"/></p>
+<h4>Background: Parquet file structure</h4>
+<p>As shown in the figure above, each Parquet file has multiple row
groups. Each row group contains a set of columns, and each column contains a
set of pages.</p>
+<p>Pages are the smallest units of data in Parquet files and typically
contain compressed and encoded values for a specific column. This hierarchical
structure enables efficient columnar access and forms the foundation for the
pruning techniques we'll discuss.</p>
+<p>Check out <a
href="https://www.influxdata.com/blog/querying-parquet-millisecond-latency/">Querying
Parquet with Millisecond Latency</a> for more details on the Parquet
file structure.</p>
+<h4>1. Read metadata</h4>
+<p>DataFusion first reads the <a
href="https://parquet.apache.org/docs/file-format/metadata/">Parquet
metadata</a> to understand the data in the file.
+Metadata often includes data schema, the exact location of each row group and
column chunk, and their corresponding statistics (e.g., min/max values).
+It also optionally includes <a
href="https://parquet.apache.org/docs/file-format/pageindex/">page-level
stats</a> and <a
href="https://www.influxdata.com/blog/using-parquets-bloom-filters/">Bloom
filters</a>.
+This information is used to prune the file before reading the actual
data.</p>
+<p><a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L118">Fetching
metadata</a> requires up to two network requests: one to read the footer
size from the end of the file, and another to read the footer itself. </p>
+<p><a
href="https://www.influxdata.com/blog/how-good-parquet-wide-tables/">Decoding
metadata</a> is generally fast since it only requires parsing a small
amount of data. However, for tables with hundreds or thousands of columns, the
metadata can become quite large and decoding it can become a bottleneck. This
is particularly noticeable when scanning many small files.</p>
+<p>Reading metadata is latency-critical, so DataFusion allows users to
cache metadata through the <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L39">ParquetFileReaderFactory</a>
trait.</p>
+<h4>2. Prune by projection</h4>
+<p>The simplest yet perhaps most effective pruning is to read only the
columns that are needed.
+This is because queries usually don't select all columns, e.g.,
<code>SELECT a FROM table</code> only reads column
<code>a</code>.
+As a <strong>columnar</strong> format, Parquet allows DataFusion
to <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/mod.rs#L778">only
read</a> the <strong>columns</strong> that are
needed.</p>
+<p>This projection pruning happens at the column level and can
dramatically reduce I/O when working with wide tables where queries typically
access only a small subset of columns.</p>
+<h4>3. Prune by row group stats and Bloom filters</h4>
+<p>Each row group has <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/physical_optimizer/pruning.rs#L81">basic
stats</a> like min/max values for each column.
+DataFusion applies the query predicates to these stats to prune row groups,
e.g., <code>SELECT * FROM table WHERE a &gt; 10</code> will
only read row groups where <code>a</code> has a max value greater
than 10.</p>
+<p>Sometimes min/max stats are too simple to prune effectively, so
Parquet also supports <a
href="https://www.influxdata.com/blog/using-parquets-bloom-filters/">Bloom
filters</a>. DataFusion <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/opener.rs#L202">uses
Bloom filters when available</a>.</p>
+<p>Bloom filters are particularly effective for equality predicates
(<code>WHERE a = 10</code>) and can significantly reduce the number
of row groups that need to be read for point queries or queries with highly
selective predicates.</p>
+<h4>4. Prune by page stats</h4>
+<p>Parquet optionally supports <a
href="https://github.com/apache/parquet-format/blob/master/PageIndex.md">page-level
stats</a> -- similar to row group stats but more fine-grained.
+DataFusion implements <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/opener.rs#L219">page
pruning</a> when the stats are present.</p>
+<p>Page-level pruning provides an additional layer of filtering after
row group pruning. It allows DataFusion to skip individual pages within a row
group, further reducing the amount of data that needs to be read and
decoded.</p>
+<h4>5. Read from storage</h4>
+<p>Now we (hopefully) have pruned the Parquet file into small ranges of
bytes, i.e., the <a
href="https://github.com/apache/datafusion/blob/76a7789ace33ced54c973fa0d5fc9d1866e1bf19/datafusion/datasource-parquet/src/access_plan.rs#L86">Access
Plan</a>.
+The last step is to <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/reader.rs#L103">make
requests</a> to fetch those bytes and decode them into Arrow
RecordBatch. </p>
+<h3>Preview of coming attractions: filter pushdown</h3>
+<p>So far we have discussed techniques that prune the Parquet file using
only the metadata, i.e., before reading the actual data.</p>
+<p>Filter pushdown, also known as predicate pushdown or late
materialization, is a technique that prunes data during scanning, with filters
being generated and applied in the Parquet reader.</p>
+<p><img alt="Filter pushdown in DataFusion" class="img-responsive"
src="/blog/images/parquet-pruning/filter-pushdown.jpg"
width="100%"/></p>
+<p>Unlike metadata-based pruning which works at the row group or page
level, filter pushdown operates at the row level, allowing DataFusion to filter
out individual rows that don't match the query predicates during the decoding
process.</p>
+<p>DataFusion <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/core/src/datasource/physical_plan/parquet/row_filter.rs#L154">implements
filter pushdown</a> but has <a
href="https://github.com/apache/datafusion/blob/31701b8dc9c6486856c06a29a32107d9f4549cec/datafusion/common/src/config.rs#L382">not
enabled it by default</a> due to <a
href="https://github.com/apache/datafusion/issues/3463">some perform [...]
+<p>We are working to remove the <a
href="https://github.com/apache/arrow-rs/issues/5523#issuecomment-2429470872">remaining
performance issues</a> and enable it by default, which we will discuss
in the next blog post.</p>
+<h3>Conclusion</h3>
+<p>DataFusion employs a multi-step approach to Parquet pruning, from
column projection to row group stats, page stats, and potentially row-level
filtering.
+Each step may reduce the amount of data to be read and processed,
significantly improving query performance.</p></content><category
term="blog"></category></entry></feed>
\ No newline at end of file
diff --git a/output/feeds/xiangpeng-hao.rss.xml
b/output/feeds/xiangpeng-hao.rss.xml
new file mode 100644
index 0000000..d48cdfa
--- /dev/null
+++ b/output/feeds/xiangpeng-hao.rss.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<rss version="2.0"><channel><title>Apache DataFusion Blog - Xiangpeng
Hao</title><link>https://datafusion.apache.org/blog/</link><description></description><lastBuildDate>Thu,
20 Mar 2025 00:00:00 +0000</lastBuildDate><item><title>Parquet Pruning in
DataFusion: Read Only What
Matters</title><link>https://datafusion.apache.org/blog/2025/03/20/parquet-pruning</link><description><!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng
Hao's blog</a>. Thanks to <a
href="https://www.influxdata.com/">InfluxData</a> for sponsoring this
work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a>
has become the industry standard for storing columnar data, and reading Parquet
efficiently -- especially from remote storage -- is crucial for query
performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache DataFusion
…</a></p></description><dc:creator
xmlns:dc="http://purl.org/dc/elements/1.1/">Xiangpeng
Hao</dc:creator><pubDate>Thu, 20 Mar 2025 00:00:00 +0000</pubDate><guid
isPermaLink="false">tag:datafusion.apache.org,2025-03-20:/blog/2025/03/20/parquet-pruning</guid><category>blog</category></item></channel></rss>
\ No newline at end of file
diff --git a/output/images/parquet-pruning/filter-pushdown.jpg
b/output/images/parquet-pruning/filter-pushdown.jpg
new file mode 100644
index 0000000..23e16cf
Binary files /dev/null and b/output/images/parquet-pruning/filter-pushdown.jpg
differ
diff --git a/output/images/parquet-pruning/read-parquet.jpg
b/output/images/parquet-pruning/read-parquet.jpg
new file mode 100644
index 0000000..22b54c4
Binary files /dev/null and b/output/images/parquet-pruning/read-parquet.jpg
differ
diff --git a/output/index.html b/output/index.html
index 7e41ff4..744f383 100644
--- a/output/index.html
+++ b/output/index.html
@@ -44,6 +44,46 @@
<p><i>Here you can find the latest updates from DataFusion and
related projects.</i></p>
+ <!-- Post -->
+ <div class="row">
+ <div class="callout">
+ <article class="post">
+ <header>
+ <div class="title">
+ <h1><a href="/blog/2025/03/20/parquet-pruning">Parquet
Pruning in DataFusion: Read Only What Matters</a></h1>
+ <p>Posted on: Thu 20 March 2025 by Xiangpeng Hao</p>
+ <p><!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+<p><em>Editor's Note: This blog was first published on <a
href="https://blog.xiangpeng.systems/posts/parquet-to-arrow/">Xiangpeng Hao's
blog</a>. Thanks to <a href="https://www.influxdata.com/">InfluxData</a> for
sponsoring this work as part of his PhD funding.</em></p>
+<hr/>
+<p><a href="https://parquet.apache.org/">Apache Parquet</a> has become the
industry standard for storing columnar data, and reading Parquet efficiently --
especially from remote storage -- is crucial for query performance.</p>
+<p><a href="https://datafusion.apache.org/">Apache DataFusion …</a></p></p>
+ <footer>
+ <ul class="actions">
+ <div style="text-align: right"><a
href="/blog/2025/03/20/parquet-pruning" class="button medium">Continue
Reading</a></div>
+ </ul>
+ <ul class="stats">
+ </ul>
+ </footer>
+ </article>
+ </div>
+ </div>
<!-- Post -->
<div class="row">
<div class="callout">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]