Hi Antoine, Thanks for sharing! This is very helpful and aligns with some of the approaches we've explored internally at Databricks.
I also experimented with similar approaches during the modular footer discussion but didn't include them in the proposal to avoid introducing too many options. Here is a performance comparison using the ClickBench hits file (105 columns × 70 row groups, 867 KB footer). Each read uses a fresh reader with the footer already in memory and retrieves the selected column chunks' offsets and sizes. The timings are for single-column → full projection: [image: image.png] - *Current Thrift parser:* Parses the entire footer regardless of projection. - *Lazy ColumnChunk parsing:* Has a fixed cost of walking through all column chunks to locate the selected ones. - *Jump table extension:* Eliminates the fixed cost by retrieving the jump table directly from the extension. - *Original modular footer:* Parsing cost is proportional to projection because every field is randomly accessible. - *Latest modular footer:* Decodes entire metadata pages, making the cost less dependent on projection. Encodings supporting selective decoding, such as PFOR, could further improve narrow-projection performance. Note that the lazy parsing experiment uses a different C++ Thrift parser rather than your PoC, and only decodes the offsets and sizes. Another major advantage of the modular footer is the significant reduction in footer size. While these reader optimizations improve warm-read performance, cloud I/O rather than decoding becomes the bottleneck when reading large footers from cloud storage. Reducing this I/O cost is the primary benefit of the new footer format. Best regards, Jiayi Gang Wu <[email protected]> 于2026年11月24日周二 03:03写道: > Very interesting! It seems that many of us have tried to optimize the > thrift > parsing. I also conducted a similar experiment, using AI to understand what > arrow-rs has done and ended up writing a new C++ footer structure with lazy > parsing: https://github.com/apache/arrow/pull/55111. However, I've only > observed a maximum speedup around 2.5X based on my workload on my > macOS laptop. > > On Tue, Nov 24, 2026 at 8:08 AM Alkis Evlogimenos via dev < > [email protected]> wrote: > > > Thanks for doing this experiments Antoine! This approach ties well with > > Wills jump index for footer. > > > > Your results are similar to what we also have internally. This is valid > > strategy for wide tables and partial reads but it doesn't match the > footer > > v3 proposals compactness and speed. Parquet is too good at describing > > Parquet metadata! > > > > > > On Mon, Nov 23, 2026 at 5:19 PM PRATEEK GAUR <[email protected]> wrote: > > > > > Hi Antoine, > > > > > > This is great! > > > > > > > ColumnChunk parsing is skipped and a placeholder is recorded > > > > that points at the range of Thrift > > > > > > Haven't gone through all the details of your implementation yet. > > > But I can say I did try a similar(maybe the exact) idea recently and > > > it gave similar magnitude of improvement. > > > > > > This is a very promising optimization and absolutely should be > > > implemented. It really helps with those large footer with multi > > > row groups and large number of columns. > > > > > > Best > > > Prateek > > > > > > On Mon, Nov 23, 2026 at 8:08 AM Antoine Pitrou <[email protected]> > > wrote: > > > > > > > > > > > Hello, > > > > > > > > In the spirit of trying to make wide Parquet files faster to read > when > > > > projecting onto a couple columns, I have been experimenting with lazy > > > > parsing of Thrift ColumnChunk structures. > > > > > > > > The idea is that, when parsing the Parquet footer, ColumnChunk > parsing > > > > is skipped and a placeholder is recorded that points at the range of > > > > Thrift bytes that encode the ColumnChunk. Then, when the ColumnChunk > > > > is actually required, the range of bytes is decoded on the fly and > the > > > > decoded ColumnChunk is stored instead. > > > > > > > > Thrift being a stack-based bytecode format, this is not trivial. > Thrift > > > > C++ comes with a generic skip() function that is too slow. However, a > > > > hand-written skipping function (still generic but carefully tuned) > > > > turns out to give good results. > > > > > > > > You can find a PoC branch on Arrow C++ here: > > > > https://github.com/apache/arrow/compare/main...pitrou:thrift-exp > > > > > > > > Here are some benchmark results: > > > > * before: > > > https://gist.github.com/pitrou/772001440bdb3ed38279c075e34e59eb > > > > * after: > > https://gist.github.com/pitrou/86e4e6ce89810252f9943e31722591b0 > > > > > > > > I got an AI to distill those results as a Markdown table, hopefully > > > > the numbers are right 🙃: > > > > https://gist.github.com/pitrou/6e668f747edc50a5eec63841c8a6b5d3 > > > > > > > > The results should be almost self-explanatory: `ReadFileMetadata` > > > > just parses the Parquet footer while `ReadFileAndColumnMetadata` > > > > also accesses a subset of the column chunk metadata, triggering > > > > lazy parsing. > > > > > > > > Bottom line: > > > > > > > > 1. Lazy parsing can yield up to a 9x speedup with 100,000 column > > > > chunks in the file. > > > > > > > > 2. Selecting (== decoding the metadata for) a moderate amount of > > > > columns ("sel=5%") still yields interesting speedups, up to 5x. > > > > > > > > 3. Selecting all columns, on the other hand, is significantly slower > > > > (up to 30%) because the initial Thrift skipping adds to the total > > > > footer parsing time. > > > > > > > > Profiling the most extreme benchmarking cases gives interesting > > insights: > > > > > > > > 1. For `ReadFileMetadata/num_columns:1000/num_row_groups:100`, Thrift > > > > decoding and skipping accounts for 87% of the benchmark time; > this > > > > implies that Thrift is really the bottleneck when there is a > large > > > > number of row groups *and* columns; > > > > > > > > 2. However, for `ReadFileMetadata/num_columns:1000/num_row_groups:1`, > > > > Thrift deserialization is only 17% of the benchmark time - the > rest > > > > is Parquet C++ schema construction and destruction. Therefore, > > > > more work may be warranted in the Parquet C++ codebase itself in > > > > order to reduce inefficiencies, regardless of whether Thrift is > > > > involved at all. > > > > > > > > > > > > A couple technical details about the PoC: > > > > > > > > * I had to modify the Thrift-generated C++ files, so this is > definitely > > > > not maintainable. A clean implementation probably requires a > custom > > > > C++ Thrift parser (which would also probably be faster). > > > > > > > > * The core Thrift skipping function is non-recursive and allows for > > > > aggressive inlining (*). On my machine (a AMD Zen 2 CPU), it seems > > to > > > > skip at around 1.5 GB/s. > > > > > > > > (*) See `SkipListOfStructCompact` in `parquet_types.tcc`. > > > > > > > > > > > > This shouldn't discourage more radical Parquet footer experiments, > but > > > > may provide interesting optimization opportunities in the shorter > term, > > > > including with existing Parquet datasets. > > > > > > > > Regards > > > > > > > > Antoine. > > > > > > > > > > > > > >
