Skip to content

Row Counts on Parquet V1 Data Pages: Row-Aligned Pages and Seeking Without an Offset Index

Parquet V1 data page headers record a value count but no row count. For repeated columns, readers must decode repetition levels to find where rows start and end.

Cross-posted. This article’s canonical home is Data Lakehouse Hub.

Parquet V1 data page headers record a value count but no row count. For repeated columns, readers must decode repetition levels to find where rows start and end. A Nov 23, 2026 proposal adds an optional num_rows field to V1 pages. When it is set, rows never span pages, so readers can seek without an offset index.

That paragraph describes a small change to one Thrift struct. It’s worth a full article because it sits on a fault line in the Parquet format that most engineers never look at: the difference between values and rows, and between the two data page versions. If you’ve ever wondered why reading row 5,000,000 from a Parquet file with a list column is slower than it should be, this is the reason. And if you’ve wondered whether you should write V2 data pages, this proposal comes with a real-world data point on what V2 costs.

Values Are Not Rows

Start with the distinction the proposal turns on.

For a flat column, such as an INT64 or a STRING, one row holds one value. A page with 20,000 values holds 20,000 rows. Counting rows is counting values.

For a repeated column, such as a list of integers, one row holds any number of values. A row holds zero values, one, or ten thousand. A page with 20,000 values holds 20,000 rows of single-element lists, or two rows of 10,000-element lists, or anything between.

Parquet encodes nested and repeated data with the Dremel encoding, using two small integer streams stored alongside the values.

To count rows in a page of a repeated column, a reader counts the values whose repetition level is 0. That means decoding the repetition level stream for the page. It’s not expensive per page, but it’s work that has to happen before the reader knows which rows the page contains.

What V1 and V2 Page Headers Record

Parquet has two data page header formats.

DataPageHeader, the V1 header, records num_values, the encodings used for values, definition levels, and repetition levels, and optional statistics. It does not record a row count. In V1 pages, the repetition and definition levels are compressed together with the values, as one block.

DataPageHeaderV2, the V2 header, records num_values, num_nulls, and num_rows, plus the byte lengths of the repetition and definition level sections and an is_compressed flag for the values. In V2 pages, the levels are stored uncompressed, separate from the values. That lets a reader find and decode levels without decompressing the values.

So V2 already solves the row count problem. The header says how many rows the page holds. The obvious next step is to write V2 everywhere, and that’s where the cost shows up.

A Worked Example of Repetition Levels

Levels are easier to understand with real values. Take a column tags, defined as an optional list whose elements are optional strings, and four rows.

Here’s how Parquet stores that column, one entry per stored value slot:

Stored valueRepetition levelDefinition levelMeaning
a03New row (row 0), element defined
b13Same row, next list element
c13Same row, next list element
(none)01New row (row 1), list present but empty
(none)00New row (row 2), list is NULL
d03New row (row 3), element defined

The repetition level column is what a reader scans to count rows. Every 0 starts a new row. There are four zeros, so four rows. The definition level column distinguishes the empty list from the NULL list. A level of 3 means every field on the path is defined down to the string itself. A level of 1 means the list exists but has no element. A level of 0 means the list itself is NULL.

Now picture a page of this column with 20,000 entries. To know how many rows it holds, or where row 9,000 begins inside it, the reader has to decode those repetition levels and count zeros. With a header row count, it already knows the total. With the alignment rule, it knows the page starts on a row. It still decodes levels within the page to find a specific row, but it never decodes a page it doesn’t need.

How Readers Seek Today Without an Index

It’s useful to spell out the current path, because it shows exactly which work the proposal removes.

A reader wants row 1,000,000 of a column chunk with V1 pages and no offset index.

  1. It reads the first page header. The header says how many values the page holds and how many bytes it takes, but not how many rows.
  2. It reads and decompresses the page, because in V1 the levels are compressed together with the values.
  3. It decodes the repetition levels and counts the zeros to learn how many rows the page held.
  4. It adds that to a running total. If the total is still below 1,000,000, it moves to the next page and repeats from step 1.
  5. When the total passes 1,000,000, it knows this page holds the target row. Since V1 pages without alignment can start mid-row, it also has to handle a row that began on the previous page.

Steps 2 and 3 are the cost. Every page before the target gets decompressed and partly decoded, only to count rows. For a column chunk with hundreds of pages, that’s hundreds of wasted decompressions.

With the proposed field, step 2 and step 3 disappear for every page before the target. The reader reads headers, sums num_rows, and seeks to the right page. Page headers are small and sit right before each page, so walking them is cheap. And with alignment, step 5’s edge case disappears too.

That’s also why the offset index is better still when present. It skips even the header walk, because all the page locations sit together near the footer. The proposal targets the large population of files that don’t have one, not the files that do.

Why Iceberg Positional Deletes Care

Apache Iceberg’s row-level deletes depend on row positions, which makes this proposal more relevant to lakehouses than it first appears.

A position delete or a deletion vector says “row N of data file F is deleted.” Row N here means the row’s ordinal position in the file, counted across all row groups. When an engine reads file F, it has to skip those positions as it decodes.

For a flat table, mapping positions to pages is easy, because values equal rows. For tables with nested columns, the engine has to know where rows fall in each column’s pages. If it reads only a few columns and most rows in a range are deleted, it wants to skip whole pages of deleted rows without decoding them. Header row counts plus alignment make that skip cheap. Without them, the engine decodes levels to find out which rows a page holds before it can decide to skip it.

Iceberg v3 made deletion vectors the standard way to handle row-level deletes. More merge-on-read tables means more reads that skip by position. Any improvement to positional access in Parquet compounds in that setting.

Why V2 Isn’t Free

Divjot Arora’s November 23 proposal answers that directly. His team considered switching to V2 pages and rejected it, because V2 requires leaving repetition and definition levels uncompressed. In their fleet, those levels often compress very well. Switching to V2 increased storage size by over 20% in the cases they observed.

That’s the only measurement in the proposal, and it’s specific to their data. It still makes the trade-off clear. Levels for deeply nested or highly repetitive data are long runs of similar small integers. Run-length encoding already shrinks them, and general-purpose compression shrinks them further. V2 gives up that second step in exchange for faster access to the levels.

There’s also a practical reason V1 persists. Many writers default to it. PyArrow’s data_page_version defaults to "1.0". parquet-java’s parquet.writer.version defaults to PARQUET_1_0. arrow-rs’s default writer version is PARQUET_1_0. Most Parquet files in most lakehouses are V1 data pages today, so a fix for V1 helps the files people actually have.

The Proposal

The proposal adds one field to the V1 header:

struct DataPageHeader {
  1: required i32 num_values
  2: required Encoding encoding
  3: required Encoding definition_level_encoding
  4: required Encoding repetition_level_encoding
  5: optional Statistics statistics
  // Proposed (November 23, 2026). Field ID assigned in the final PR.
  N: optional i32 num_rows
}

The first five fields are the existing V1 header. num_values counts values, including nulls, not rows. The three encoding fields name how the values and both level streams are encoded. statistics holds optional min, max, and null counts for the page. The proposed field adds the row count as an optional integer. Because it’s optional, old readers ignore it and old files remain valid. The N stands in for whatever field ID the final pull request assigns.

The proposal attaches one rule to the field. When num_rows is set, rows must not span page boundaries. A row with 10,000 array values can’t be split across two pages. The writer has to finish the row in the current page, even if that makes the page larger than its target size.

When the field isn’t set, nothing changes. Readers can’t assume rows and pages align, so they decode repetition levels to count rows, as they do today.

Why the Alignment Rule Matters

The row count alone helps. The alignment rule is what makes it powerful.

Without alignment, a page can end in the middle of a row. Its last few values belong to a row that continues on the next page. A row count for that page is ambiguous. Does a row that starts here and ends on the next page count here, there, or both?

With alignment, every page holds a whole number of complete rows. Page 1 holds rows 0 to 4,999. Page 2 holds rows 5,000 to 9,999. The cumulative sum of num_rows across pages tells a reader exactly which page holds any row, and that the page starts at a row boundary.

That’s what enables seeking. To read row 7,500, a reader walks page headers, adds num_rows until the total passes 7,500, and starts decoding at that page. It decodes only that page’s levels and values, and skips to the right row within it. No earlier pages are decompressed.

The alignment rule has a cost. A writer that must keep rows whole sometimes produces pages larger than the target size, when a single row is huge. For most data, that’s rare and harmless. For tables with occasional giant arrays, page sizes become uneven. The writer, not the reader, absorbs the cost, which is the right place for it.

How This Relates to the Offset Index

Parquet already has a structure for seeking: the offset index, part of the page index. For each column chunk, the offset index lists every page with three values.

The format requires that pages covered by an offset index start at row boundaries, meaning their first value has repetition level 0. So when a file has an offset index, readers already get row alignment and per-page row positions. They jump straight to the right page with one lookup and one byte-range read.

That’s why the proposal emphasizes files without an offset index. Plenty exist. PyArrow’s write_page_index defaults to False, so default PyArrow files have no offset index. Files written by older tools often lack it too.

Gang Wu raised the relationship to the offset index in the thread replies. The question is a fair one. Why add a header field when the offset index already solves seeking? The answers are practical. Not every file has an offset index, and adding one means rewriting the footer region. A header field travels with the page itself. And a reader scanning sequentially, as many do, reads page headers anyway, so the row count costs nothing extra to use.

Here’s how the approaches compare:

ApproachSeek without decoding levelsNeeds footer-level indexLevels compressedDefault in common writers
V1 pages, no offset index (today)NoNoYesYes, often
V1 pages with offset indexYesYesYesVaries by writer
V2 pagesYes, via header num_rowsNoNoNo
V1 pages with proposed num_rowsYes, via headerNoYesNot yet

The proposal fills the last row. It gives V1 the seekability of V2 without giving up compressed levels.

The Responses in the Thread

The thread drew replies from Antoine Pitrou, Alkis Evlogimenos, Andrew Lamb, and Gang Wu. Alkis and Andrew backed the idea. Antoine raised the idea of a V3 page header, a broader redesign that addresses this and other header limitations together.

That sets up a classic format debate. Small, targeted, optional additions are easy to adopt and help existing files quickly. A new header version can fix more at once and avoid accumulating optional fields, but takes much longer to design, implement, and adopt across every reader. Divjot’s message argued for the targeted approach directly. The row count is useful on its own, and it shouldn’t be coupled to other format changes.

Both views have merit, and they aren’t exclusive. A small optional field now doesn’t block a V3 header later, and the V3 design can absorb it.

Where This Shows Up in Real Workloads

Row seeking sounds niche. It isn’t, especially in lakehouses with Apache Iceberg tables.

Position deletes and deletion vectors. Iceberg’s row-level deletes identify rows by their position in a data file. A reader applying deletion vectors needs to map positions to pages. Faster row seeking makes skipping deleted ranges cheaper.

Point lookups. A query that uses statistics or a bloom filter to find a small set of rows, then reads them, benefits from jumping to the right page.

Row-range parallelism. Engines that split one file across several tasks by row range need to find where each range starts.

Vector and embedding columns. AI workloads store embeddings as fixed-size lists or repeated floats. Those are repeated columns, exactly where values and rows differ. A page of 768-dimension embeddings holds many values per row. Seeking to a specific row without decoding levels helps retrieval workloads that read a few rows by position.

Paged reads in services. APIs that page through Parquet data, reading rows 10,000 to 10,099 for one request, need row-based seeking.

An Experiment You Can Run on Your Own Data

The 20% figure in the proposal is one team’s observation. Your data will differ. Here’s a short PyArrow experiment that measures the V1 versus V2 storage difference on your own nested columns:

import os
import pyarrow.parquet as pq

def compare_page_versions(source_path: str, out_dir: str = "/tmp/pv") -> None:
    os.makedirs(out_dir, exist_ok=True)
    table = pq.read_table(source_path)

    results = {}
    for version in ("1.0", "2.0"):
        out = os.path.join(out_dir, f"v{version}.parquet")
        pq.write_table(
            table, out,
            data_page_version=version,
            compression="zstd",
            write_page_index=True,
        )
        results[version] = os.path.getsize(out)

    v1, v2 = results["1.0"], results["2.0"]
    print(f"V1 pages: {v1:,} bytes")
    print(f"V2 pages: {v2:,} bytes")
    print(f"V2 relative to V1: {100 * (v2 - v1) / v1:+.1f}%")

compare_page_versions("sample_with_nested_columns.parquet")

The script reads a sample file into an Arrow table, then writes it twice. The only change between the two writes is data_page_version. Both use zstd compression and write a page index, so the comparison isolates the page format. It prints both file sizes and the relative difference.

Run it on a sample from each table that has list, map, or struct columns. Flat tables show little difference, because their levels are trivial. Deeply nested or highly repetitive columns show the largest difference. If V2 costs you little, writing V2 is a reasonable choice today. If it costs a lot, the proposal matters to you, and a page index is the seeking tool to use until the field lands.

What Writers and Readers Need to Change

If the proposal is accepted, adoption follows a predictable path.

Format. The Thrift definition gains the optional field and the specification documents the alignment rule.

Writers. A writer that sets num_rows must keep rows within one page. Most writers already track row boundaries when they write an offset index, since offset index pages must start at row boundaries. For those writers, setting the field is mostly bookkeeping. Writers that don’t track boundaries need to start.

Readers. A reader that understands the field uses it for seeking when it’s present and falls back to decoding levels when it’s absent. Old readers ignore the field and keep working.

Engines. Query engines benefit only when their Parquet reader uses the field for seeking. That arrives through library upgrades: parquet-java, Arrow C++, arrow-rs, and others.

Because the field is optional and old readers ignore it, nothing breaks during the rollout. Files with the field and without it coexist in the same table.

Compatibility in Detail

Format changes live or die on compatibility, so it’s worth walking through each combination of old and new software.

New writer, old reader. The writer sets num_rows on V1 pages. The old reader’s Thrift decoder sees an unknown optional field and skips it, which is standard Thrift behavior. The reader decodes levels as it always did. The alignment rule doesn’t hurt it, because aligned pages are still valid V1 pages. Result: works, no speedup.

Old writer, new reader. The writer never sets the field. The new reader sees it absent and falls back to decoding levels. Result: works, no speedup.

New writer, new reader. The field is present and the reader uses it to seek. Result: works, faster positional access.

Mixed files in one table. A table holds files from old and new writers. Each file is read according to its own headers. Result: works, with speedups on the newer files only.

The one thing that has to be right is the alignment rule. A buggy writer that sets num_rows but lets a row span pages produces files that new readers seek incorrectly in. That’s the kind of bug that slips past simple tests, because flat columns never span pages anyway. Writer test suites need nested columns with very large rows near page size limits, which is exactly where alignment forces a page to grow past its target.

Readers can defend themselves cheaply too. When a reader seeks to a page using num_rows, it can check that the first value’s repetition level is 0. If it isn’t, the file violates the rule, and the reader can fall back to decoding from the start of the column chunk.

Practical Advice Today

Until the proposal lands and libraries adopt it, here’s how to get good row seeking on the files you write now.

  1. Write a page index. If your writer supports it, turn it on. It gives you row-aligned pages and first_row_index for every page. In PyArrow, set write_page_index=True.
  2. Measure V2 on your nested data. Use the experiment above. If the storage cost is small, V2 pages give you header row counts today.
  3. Keep page row limits. The common 20,000-row page cap keeps pages small enough that decoding one page to reach a row stays cheap.
  4. Know which files lack an index. Check the created_by field and page index presence on samples from each writer, and target those files in compaction.
  5. Watch the dev list. If the field is accepted, check your writer libraries’ release notes for support.

Failure Modes and Warning Signs

Slow positional access on nested columns. Warning sign: reading a few rows by position from a file with list columns takes far longer than from a flat file of similar size. Cause: no offset index, so the reader decodes levels page by page. Fix: write a page index, or V2 pages where storage cost allows.

Uneven page sizes after enforcing alignment. Warning sign: a few pages far larger than the target size. Cause: giant rows that can’t be split across pages. Fix: usually nothing. It’s the expected cost of alignment. If it hurts, look at whether those giant arrays belong in a separate table.

Storage growth after switching to V2. Warning sign: file sizes jump after changing data_page_version. Cause: uncompressed levels. Fix: measure per table and switch only where the cost is small.

Assuming header row counts exist. Warning sign: a custom reader errors or miscounts on V1 files. Cause: code that expects num_rows in every page header. Fix: always fall back to decoding repetition levels when the field is absent, exactly as the proposal specifies.

Conclusion

Parquet’s V1 data pages count values, not rows. For repeated columns, readers decode repetition levels to find row boundaries, which makes seeking slow when a file has no offset index. V2 pages fix that with a header row count, at the cost of uncompressed levels, which one team measured at more than 20% extra storage on their data.

The November 23 proposal gives V1 an optional num_rows field with a simple rule: when it’s set, rows don’t span pages. That brings V2’s seekability to V1’s compression, for the files most lakehouses actually hold. Old readers ignore it, and nothing breaks.

Until it lands, write page indexes, measure V2 on your own nested data, and know which of your files lack an index.

For the structures this builds on, see Parquet Page Indexes and the Last Mile of Pruning, the walkthrough of pages, row groups, and columns, and the state of Apache Parquet in 2026.

Sources: Divjot Arora’s proposal, Nov 23, 2026 · PyArrow write_table reference · parquet-java writer properties

Keep Going

If this piece was useful, I have written a lot more on Parquet and the table formats built on it. Apache Iceberg: The Definitive Guide (O’Reilly) covers how Iceberg uses Parquet files, row positions, and delete files together. You can find every book I have written, across lakehouse architecture, Apache Iceberg, Apache Polaris, and AI, at books.alexmerced.com.

Work with Alex