Metadata-Version: 2.4
Name: parquet-analyzer
Version: 0.6.0
Summary: Inspect the on-disk layout and metadata of Parquet files.
Project-URL: Homepage, https://github.com/clee704/parquet-analyzer
Project-URL: Issues, https://github.com/clee704/parquet-analyzer/issues
Project-URL: Source, https://github.com/clee704/parquet-analyzer
Author: Chungmin Lee
License: 
                                         Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright 2025 Chungmin Lee
        
           Licensed 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.
License-File: LICENSE
Keywords: data-engineering,debugging,parquet,thrift
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: System :: Filesystems
Requires-Python: >=3.11
Requires-Dist: cramjam>=2.7
Requires-Dist: jinja2==3.1.6
Requires-Dist: thrift>=0.16
Provides-Extra: dev
Requires-Dist: hatch; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: numpy; extra == 'dev'
Requires-Dist: pyarrow; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-benchmark; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# Parquet Analyzer

A Python tool for deep inspection and analysis of Apache Parquet files, providing detailed insights into file structure, metadata, and binary layout.

For an example interactive HTML report generated by this tool, see: https://clee704.github.io/parquet-analyzer/examples/example.html.

## Installation

```bash
pip install parquet-analyzer
```

### Requirements

- Python 3.11+

## Usage

`parquet-analyzer` ships two complementary CLI surfaces:

- **Verb-noun subcommands** (`parquet-analyzer file kv ...`, `column show ...`, etc.) — small, composable, AI-friendly. One subcommand → one JSON object. Footer-only and fast. See [Subcommands](#subcommands).
- **Whole-file modes** (`parquet-analyzer <path> [--output-mode ...]`) — the original "show me everything" surface for interactive exploration and the HTML report.

### Basic usage

```bash
# Verb-noun subcommands (footer-only, fast)
parquet-analyzer file summary example.parquet
parquet-analyzer column show example.parquet --column ints
parquet-analyzer rowgroup list example.parquet

# Whole-file: analyze and emit the JSON summary/footer/pages bundle
parquet-analyzer example.parquet

# Show raw segment structures (offsets, lengths, thrift payloads)
parquet-analyzer --output-mode segments example.parquet

# Generate an interactive HTML report and save it to disk
parquet-analyzer --output-mode html -o report.html example.parquet

# Generate an HTML report with selected sections only
parquet-analyzer --output-mode html \
  --html-sections summary schema key-value-metadata row-groups columns segments \
  -o report.html example.parquet

# Enable debug logging while running any mode
parquet-analyzer --log-level DEBUG example.parquet

# Run via python -m if the console script is unavailable
python -m parquet_analyzer example.parquet
```

## Subcommands

The verb-noun surface answers one question per invocation and is built for
chaining with `jq` and consumption by AI agents. The eight verb-noun
subcommands under `file`/`rowgroup`/`column` are **footer-only** — they do not
walk page headers or read page bodies. A ninth verb,
[`show`](#show--path-addressed-navigation), offers path-addressed tree
navigation (also bounded — it never walks page headers unless you pass
`--walk-pages`). The [`page`](#page--page-level-inspection) verb is the escape
hatch into the page layer: it lists a chunk's pages, dumps a single page
header, extracts raw body bytes, and decodes a page body into its
encoding-faithful structure. Reading page bodies is opt-in by construction —
you pay the per-page cost only for the page you name.

### Conventions

- **One subcommand → one JSON object on stdout.** List-shaped outputs wrap in `{items, total, returned, truncated}`.
- **Every output object carries a `$schema` field** of the form `parquet-analyzer/v1/<command>` so downstream tools can validate the shape.
- **`--schema-version`** on any subcommand short-circuits to print just the schema URI — no file is opened.
- **`--limit N`** caps list-shaped outputs. Truncation is reported explicitly via the `truncated` field; nothing is silently dropped.
- **`-o / --output PATH`** writes JSON to a file instead of stdout.
- **`--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}`** is the top-level global option.
- **Navigation cross-link.** Every `rowgroup`/`column` `list` and `show` item carries a `_path` — its canonical [`show`](#show--path-addressed-navigation) navigation path (`row_groups/2/columns/1`). Use the flat commands as a search/sort surface, then feed a `_path` straight back into `show` to drill in (no need to hand-build the path):
  ```bash
  parquet-analyzer column list data.parquet | jq -r '.items | max_by(.compressed_size)._path' \
    | xargs parquet-analyzer show data.parquet
  ```
- **Errors → stderr** as a single JSON line: `{"$schema": "parquet-analyzer/v1/error", "error": "<code>", "message": "<human>", "fix": "<retry command>"}`. The process exits non-zero on operational errors; `file validate` reports parse failures as findings (exit 0).
- **Column path matching.** Every emitted column carries both `column` (dot-joined display string) and `path` (list of segments). `--column NAME` matches against the dot-joined form. Ambiguous matches (when multiple distinct paths join to the same string) produce a JSON error listing the candidate paths.

> **Design contract for what goes in the output:** see
> [`docs/output-principles.md`](docs/output-principles.md). The TL;DR is
> "footer-bounded and walk-free": every emitted field is derivable from
> the parsed footer plus, at most, one extra parse of an index thrift
> the writer already wrote (OffsetIndex, ColumnIndex, BloomFilter
> header). Anything that would require walking per-page thrift headers
> or reading page bodies is handled by the
> [`page`](#page--page-level-inspection) subcommand surface — the deliberate,
> per-page opt-in into header walks and body reads.

### `file` — file-level inspection

```bash
$ parquet-analyzer file summary example.parquet
{
  "$schema": "parquet-analyzer/v1/file-summary",
  "num_rows": 891,
  "num_row_groups": 1,
  "num_columns": 12,
  "uncompressed_page_size": 90429,
  "compressed_page_size": 38839,
  "column_index_size": 0,
  "offset_index_size": 0,
  "bloom_filter_size": 0,
  "footer_size": 1162,
  "file_size": 40013,
  "footer_offset": 38843
}

$ parquet-analyzer file kv example.parquet
$ parquet-analyzer file kv example.parquet --key ARROW:schema  # filter by key
{
  "$schema": "parquet-analyzer/v1/file-kv",
  "items": [{"key": "ARROW:schema", "value": "..."}],
  "returned": 1, "total": 1, "truncated": false,
  "filter_key": "ARROW:schema"
}

$ parquet-analyzer file schema example.parquet
{
  "$schema": "parquet-analyzer/v1/file-schema",
  "elements": [
    {"name": "root", "repetition_type": "REQUIRED", "num_children": 12},
    {"name": "PassengerId", "type": "INT64", ...},
    ...
  ]
}

$ parquet-analyzer file validate example.parquet
{
  "$schema": "parquet-analyzer/v1/file-validate",
  "path": "example.parquet",
  "valid": true,
  "errors": []
}
```

`file kv` preserves duplicate keys and original ordering (parquet's spec
allows duplicate KV entries). `file validate` runs footer-only structural
checks: magic-number parse, row-count consistency between file and row
groups, per-row-group column count matches schema, and column chunks with
rows have non-zero compressed size. Parse failures (bad magic, unparseable
footer) are reported as findings with `valid: false` rather than as CLI
errors. Deep validation (byte-range overlap detection, page-count vs.
column metadata) requires an eager walk and will land in a future release.

### `rowgroup` — row-group inspection

```bash
$ parquet-analyzer rowgroup list example.parquet
{
  "$schema": "parquet-analyzer/v1/rowgroup-list",
  "items": [
    {"row_group": 0, "num_rows": 891, "file_offset": 4,
     "total_byte_size": 306419, "total_compressed_size": 38839,
     "num_columns": 12}
  ],
  "returned": 1, "total": 1, "truncated": false
}

$ parquet-analyzer rowgroup show example.parquet --row-group 0
{
  "$schema": "parquet-analyzer/v1/rowgroup-show",
  "row_group": 0,
  "num_rows": 891,
  "file_offset": 4,
  "total_byte_size": 306419,
  "total_compressed_size": 38839,
  "num_columns": 12,
  "columns": [
    {
      "row_group": 0, "column": "PassengerId", "path": ["PassengerId"],
      "type": "INT64", "encodings": ["PLAIN"], "codec": "SNAPPY",
      "num_values": 891, "compressed_size": 4357, "uncompressed_size": 7155,
      "chunk_offset": 4, "chunk_length": 4357,
      "data_page_offset": 4, "dictionary_page_offset": null,
      "has_dictionary": false,
      "has_offset_index": false, "offset_index_offset": null, "offset_index_length": null,
      "has_column_index": false, "column_index_offset": null, "column_index_length": null,
      "has_bloom_filter": false, "bloom_filter_offset": null, "bloom_filter_length": null,
      "num_pages": null, "num_pages_known": false,
      "num_pages_hint": "no OffsetIndex; re-run with --walk-pages to count pages (reads page headers)",
      ...
    },
    ...
  ]
}
```

### `column` — column-chunk inspection

```bash
# One entry per (row_group, column_chunk); --row-group N to filter
$ parquet-analyzer column list example.parquet
$ parquet-analyzer column list example.parquet --row-group 0 --limit 5

# Aggregated view across row groups for one named column
$ parquet-analyzer column show example.parquet --column Sex
{
  "$schema": "parquet-analyzer/v1/column-show",
  "column": "Sex",
  "path": ["Sex"],
  "type": "BYTE_ARRAY",
  "num_row_groups": 1,
  "total_num_values": 891,
  "total_compressed_size": 501,
  "total_uncompressed_size": 897,
  "row_groups": [
    {
      "row_group": 0, "column": "Sex", "path": ["Sex"],
      "encodings": ["PLAIN", "RLE_DICTIONARY"], "codec": "SNAPPY",
      "num_values": 891, "compressed_size": 501, "uncompressed_size": 897,
      "chunk_offset": 24256, "chunk_length": 501,
      "data_page_offset": 24276, "dictionary_page_offset": 24256,
      "has_dictionary": true,
      "has_offset_index": false, "offset_index_offset": null, "offset_index_length": null,
      "has_column_index": false, "column_index_offset": null, "column_index_length": null,
      "has_bloom_filter": false, "bloom_filter_offset": null, "bloom_filter_length": null,
      "num_pages": null, "num_pages_known": false,
      "num_pages_hint": "no OffsetIndex; re-run with --walk-pages to count pages (reads page headers)",
      "statistics": {"min": "...", "max": "...", "null_count": 0}
    }
  ]
}
```

`num_pages` is reported (`num_pages_known: true`) when the chunk has an
`OffsetIndex` — an O(1) lookup. Without one, counting pages requires walking
page headers, which the footer-bounded default avoids (`num_pages: null`,
`num_pages_known: false`, plus a `num_pages_hint` string pointing at
`--walk-pages` so the output is self-describing). Pass **`--walk-pages`** (on
`column show`, `column list`, or `rowgroup show`) to opt into that walk and
populate `num_pages` anyway — it reads the page headers of every selected
chunk, so `--limit` caps the output but not the walk. SNPW (Spark Native
Parquet Writer) writes OffsetIndex on every chunk; pyarrow does when
`write_page_index=True`; older parquet-mr and many DuckDB files do not.

**Byte-range pairs.** Every per-chunk output carries the seek-and-read
pair `chunk_offset` / `chunk_length`, plus `offset_index_offset` /
`offset_index_length`, `column_index_offset` / `column_index_length`,
and `bloom_filter_offset` / `bloom_filter_length` (each `null` when the
writer didn't emit the corresponding structure). `chunk_offset` is the
dictionary page offset when a dictionary is present, otherwise the data
page offset (parquet's spec: dictionary always precedes data within a
chunk; `total_compressed_size` already includes the dictionary). Together
these let an AI agent issue `read(chunk_offset, chunk_length)` against
the file and get the entire compressed chunk bytes without re-parsing the
footer.

### `show` — path-addressed navigation

`show FILE [PATH]` renders the node at `PATH` plus its immediate children
as stubs, each annotated with the canonical path to descend into it. You
explore the file like a map, one bounded step at a time, by extending the
path along the `row_groups → columns → pages` spine:

```bash
parquet-analyzer show data.parquet                              # file: row groups (stubs)
parquet-analyzer show data.parquet row_groups/0                  # that group: columns (stubs)
parquet-analyzer show data.parquet row_groups/0/columns/3        # column metadata + stats; pages (stubs)
parquet-analyzer show data.parquet row_groups/0/columns/3/pages/5  # that page (direct-seek)
```

Paths are **canonical and index-based**. Each child stub carries a `_path`
to feed back into the next `show`, columns also carry their display `name`,
and a `_navigation` block reports the current `path`, its `parent`, and the
node `kind` — so a caller (human or agent) never has to construct a path by
hand:

```jsonc
{
  "$schema": "parquet-analyzer/v1/show",
  "_kind": "row_group", "_location": {"offset": 620, "length": 210}, "num_rows": 10,
  "columns": [
    {"_kind": "column_chunk", "_location": {"offset": 622, "length": 112},
     "_path": "row_groups/0/columns/0", "name": "id"}
  ],
  "_navigation": {"path": "row_groups/0", "parent": "", "kind": "row_group"}
}
```

(The `show` envelope is a v1 CLI response; the node stubs inside it carry the
v3 tree-node `_location` address — `{offset, length}`, the file byte range.)

**Listing a column's pages never forces a page-header walk.** With an
OffsetIndex the pages are listed from it (one small read, independent of
page count). Without one, the listing is withheld behind an explicit
`--walk-pages` opt-in, and `show` reports a `_walk_required` affordance
instead of paying an O(pages) walk:

```jsonc
"pages": {"_walk_required": true, "reason": "no OffsetIndex",
          "hint": "re-run with '.../pages/<n> --walk-pages' ..."}
```

`--walk-pages` enables listing/addressing pages of such a column (it reads
every page header). A column can have many thousands of pages, so the child
listing is capped by **`--limit N`** (default 100; `0` lists all); the
`_navigation` block reports `children_total` / `children_shown` /
`children_truncated`, and truncation only bounds the *listing* — every child
stays addressable by its index. `show` is tree-structured; the verb-noun
subcommands above remain the way to get flat, aggregated views.

### `page` — page-level inspection

The `page` verb is the escape hatch into the page layer — the one surface that
deliberately reads past the footer. Where the footer-only verbs stop at the
column chunk, `page` walks into the pages of a single chunk to list them, dump
a header, extract raw body bytes, or decode a body into the structure of its
actual on-disk encoding. You pay the page cost only for the page(s) you name.

All four nouns share a page selector: `--column NAME`, `--page-index N` (over
the chunk's full page order — the dictionary page is index `0` when present,
then the data pages; negative indexes count from the end), and `--row-group M`
(required only when the file has more than one row group). The singular verbs
report both `page_index` (full order) and `data_page_index` (position among
data pages only — the `OffsetIndex` correspondence, `null` for the dictionary
page).

Equivalently, any page noun accepts a **navpath** positional — the same
`_path` that `page list` (and `show`) emit — instead of the selectors, so a
`page list` → `page decode` round-trip is copy-paste. For the singular verbs
the navpath addresses a page (`row_groups/0/columns/4/pages/1`); for `page
list` it scopes to a row group (`row_groups/0`) or a column chunk
(`row_groups/0/columns/4`). The navpath and the `--column`/`--page-index`/
`--row-group` selectors are mutually exclusive. Every singular-verb output
echoes the resolved `_path`.

**`--limit N`** bounds the potentially-large output (`page list` and `page
decode` accept it; `page header` and `page extract` don't — they return a
single object or raw bytes). For `page list` it caps the `items`. For `page
decode` it bounds each collection in the view to the first **N rows** of the
page: each level stream's `levels`, the resolved/PLAIN `values`, and the
dictionary index `runs` — with the `runs` *clipped* so they cover exactly N
rows (a single `{value: 0, length: 1000000}` run shows as `{value: 0, length:
5}` under `--limit 5`, not in full). Every bounded collection reports its own
`total` / `returned` / `truncated`, so a truncation is always explicit.
`--kind statistics` ignores it (the header's statistics aren't per-row).
Default is no limit (the whole page).

One subtlety on **nullable** columns: the level streams have one entry per row
(nulls included), while the value/index collections — resolved `values`, PLAIN
`values`, and the dictionary `runs` — only carry the **present (non-null)**
values, since parquet stores no index or value for a null. So `--limit N`
bounds the level streams to the first N rows and the value/index collections to
the first N present values; the two coincide exactly when the page has no
nulls, and otherwise their `total`s differ (rows vs. non-null count) and their
windows diverge by the nulls in the prefix.

This makes `--limit` the tool for a page that's tiny on disk but expands to
millions of values (one long RLE run): `page decode … --kind values --limit 10`
samples the first ten decoded values without materializing the rest.

```bash
$ parquet-analyzer page list data.parquet --column Sex | jq -r '.items[1]._path' \
  | xargs parquet-analyzer page decode data.parquet
```

**`page list`** is the page-walk surface: a column's (or every column's) pages
as lightweight stubs. It is cheap when the writer emitted an `OffsetIndex` (the
extents come from it, and stubs carry `first_row_index`); otherwise it walks
the per-page headers. Like the other `list` verbs it wraps in
`{items, total, returned, truncated}` and every item carries a `_path`.

```bash
$ parquet-analyzer page list example.parquet --column Sex
{
  "$schema": "parquet-analyzer/v1/page-list",
  "items": [
    {"row_group": 0, "column": "Sex", "_path": "row_groups/0/columns/4/pages/0",
     "page_index": 0, "data_page_index": null, "kind": "dictionary_page",
     "offset": 24256, "length": 33, "first_row_index": null},
    {"row_group": 0, "column": "Sex", "_path": "row_groups/0/columns/4/pages/1",
     "page_index": 1, "data_page_index": 0, "kind": "data_page",
     "offset": 24289, "length": 468, "first_row_index": null}
  ],
  "returned": 2, "total": 2, "truncated": false, "column": "Sex"
}
```

**`page header`** dumps one page's full header fields. It is version-aware: V1
data pages report the level encodings, V2 data pages report
`num_nulls`/`num_rows`/`is_compressed` and the level byte lengths.

```bash
$ parquet-analyzer page header example.parquet --column Sex --page-index 1
{
  "$schema": "parquet-analyzer/v1/page-header",
  "_path": "row_groups/0/columns/4/pages/1",
  "row_group": 0, "column": "Sex", "page_index": 1, "data_page_index": 0,
  "kind": "data_page", "page_type": "DATA_PAGE", "offset": 24289,
  "header_size": 20, "compressed_size": 448, "uncompressed_size": 846,
  "num_values": 891, "encoding": "RLE_DICTIONARY",
  "definition_level_encoding": "RLE", "repetition_level_encoding": "RLE",
  "statistics": null
}
```

**`page extract`** emits one page's raw body bytes. `--decompress` removes the
page codec (page-type aware: a V2 page keeps its uncompressed level streams and
expands only the values section). `--as {hex,base64,raw}` chooses the encoding;
`--as raw` is the JSON escape hatch — it writes the bytes verbatim to stdout
(or `-o FILE`) with no JSON envelope.

```bash
$ parquet-analyzer page extract example.parquet --column Sex --page-index 0 --as hex
$ parquet-analyzer page extract example.parquet --column Sex --page-index 1 --decompress --as raw -o body.bin
```

**`page decode`** decodes a page body. With no `--kind` it emits the full
**encoding-faithful** decode in one object — the definition/repetition level
streams plus the values section in its native encoding form, which the page's
encoding determines (no choice to make):

```bash
$ parquet-analyzer page decode example.parquet row_groups/0/columns/4/pages/1 --limit 3
{
  "$schema": "parquet-analyzer/v1/page-decode",
  "_path": "row_groups/0/columns/4/pages/1",
  "row_group": 0, "column": "Sex", "page_index": 1, "data_page_index": 0,
  "encoding": "RLE_DICTIONARY", "num_values": 891, "num_nulls": 0,
  "definition_levels": {"bit_width": 1, "total": 891, "returned": 3, "truncated": true, "levels": [1, 1, 1]},
  "repetition_levels": null,
  "encoded_values": {
    "kind": "dictionary_indices", "bit_width": 2, "total": 891, "returned": 3, "truncated": true,
    "runs": [{"kind": "rle", "value": 0, "length": 1}, {"kind": "rle", "value": 1, "length": 2}]
  }
}
```

`encoded_values` is the values section as it is literally stored: for a
dictionary-encoded page the index RLE/bit-packed runs (`kind:
"dictionary_indices"`); for a PLAIN page the verbatim values (`kind: "plain"`).
This is the encoding-faithful view — the data the encoding scheme actually
stores, not a flattened logical reconstruction.

`--kind` narrows to a single view (and is the only way to get the *resolved*
physical values):

- `values` — the page's **resolved** physical values, with dictionary indices
  resolved through the sibling dictionary page to the physical-type values.
  Nulls are skipped, so `total` is the non-null count.
- `levels` — just the definition and repetition level streams (each a
  `bit_width` plus the expanded `levels`; either `null` when the column has no
  such block — a flat column has no repetition levels, a required column no
  definition levels).
- `rle-runs` — just the dictionary index runs (`kind_not_available` on a PLAIN
  page).
- `statistics` — the page header's statistics (header-only; no body decode).

```bash
$ parquet-analyzer page decode example.parquet --column Sex --page-index 1 --kind values --limit 2
```

A page whose encoding or codec this tool does not yet decode returns a
structured error (`encoding_not_supported` / `codec_not_supported`) that names
the unsupported scheme — fall back to `page extract` for the raw bytes.

### Schema-version discovery

Every subcommand accepts `--schema-version`, which short-circuits to print
the JSON `$schema` URI for that subcommand's output without opening the
file. Useful for tools that want to fetch the matching schema definition.

```bash
$ parquet-analyzer column show --schema-version
{
  "$schema": "parquet-analyzer/v1/column-show"
}
```

### Errors

Errors are written to **stderr** as a single JSON line with the contract:

```json
{
  "$schema": "parquet-analyzer/v1/error",
  "error": "column_not_found",
  "message": "column 'foo' not found. Available: a, b, c",
  "fix": "parquet-analyzer column list example.parquet"
}
```

The `fix` field always contains an exact command to retry. The process
exits non-zero on operational errors. `file validate` is the exception:
parse failures are reported as findings (`valid: false`, exit 0) so the
subcommand stays useful for "is this file partially-written?" queries.

## Output Formats

### Standard output (`--output-mode default`)

The default output provides a structured JSON payload with three main sections:

#### Summary statistics
```json
{
  "summary": {
    "num_rows": 10,
    "num_row_groups": 1,
    "num_columns": 2,
    "num_pages": 2,
    "num_data_pages": 2,
    "num_v1_data_pages": 2,
    "num_v2_data_pages": 0,
    "num_dict_pages": 0,
    "page_header_size": 47,
    "uncompressed_page_data_size": 130,
    "compressed_page_data_size": 96,
    "uncompressed_page_size": 177,
    "compressed_page_size": 143,
    "column_index_size": 48,
    "offset_index_size": 23,
    "bloom_filter_size": 0,
    "footer_size": 527,
    "file_size": 753
  }
}
```

#### Footer metadata
Complete Parquet file metadata including:
- Schema definition with column types and repetition levels
- Row group information
- Column chunk metadata
- Encoding and compression details

#### Page information
Detailed breakdown of all pages organized by column:
- Data pages with encoding and statistics
- Dictionary pages
- Column indexes
- Offset indexes
- Bloom filters

### Segments (`--output-mode segments`)

When using `--output-mode segments`, the tool outputs a detailed segment-by-segment breakdown showing:

```json
[
  {
    "offset": 0,
    "length": 4,
    "name": "magic_number",
    "value": "PAR1"
  },
  {
    "offset": 4,
    "length": 24,
    "name": "page",
    "value": [
      {
        "offset": 5,
        "length": 1,
        "name": "type",
        "value": 0,
        "metadata": {
          "type": "i32",
          "enum_type": "PageType",
          "enum_name": "DATA_PAGE"
        }
      }
    ]
  }
]
```

This mode is useful for:
- Understanding exact binary layout
- Analyzing file format compliance
- Optimizing file structure

### HTML report (`--output-mode html`)

Emits a standalone HTML document with collapsible sections for summary statistics, schema, key-value metadata, row groups, aggregated column statistics, segments, and the raw footer. Use the `--html-sections` flag to control which sections are rendered:

```bash
parquet-analyzer --output-mode html \
  --html-sections summary schema key-value-metadata row-groups columns segments \
  -o report.html \
  example.parquet
```

Example: https://clee704.github.io/parquet-analyzer/examples/example.html

## Library API

`parquet-analyzer` is also a Python library. Anything the CLI does is available as an importable function, so you can build encoding-level verification scripts without shelling out.

### `ParquetFile` (the primary entry point)

```python
from parquet_analyzer import ParquetFile

with ParquetFile("example.parquet") as pf:
    # Footer-only — instant on any file size.
    print(pf.num_rows, pf.num_row_groups, pf.num_columns)
    print(pf.schema)
    print(pf.kv_metadata_lookup("com.acme.author"))

    # Walk row groups + column chunks — still footer-only, no body reads.
    for rg in pf.row_groups:
        for cc in rg.columns:
            print(cc.path, cc.type, cc.encodings, cc.codec, cc.num_values)
```

`ParquetFile` reads only the footer on construction (a few KB at end of file). Per-row-group / per-column / per-page metadata is exposed through wrapper classes that defer expensive parsing until you actually ask for it.

Two summary surfaces:

- `pf.footer_summary` — cheap, footer-only (row/group/column counts, footer + file size, aggregate compressed/uncompressed column-chunk sizes).
- `pf.full_summary` — same shape as legacy `get_summary()`, includes per-page counts (`num_pages`, `num_data_pages`, etc.). **Triggers a full eager walk.**

Per-chunk lazy page walking:

```python
# How many pages does this chunk have? Fast (O(1)) if the writer included
# an OffsetIndex; falls back to walking otherwise.
cc = pf.row_groups[0].columns[0]
if cc.has_offset_index:
    print(f"chunk has {cc.num_pages} pages (cheap lookup via OffsetIndex)")
else:
    print(f"chunk has {cc.num_pages} pages (paid full walk to count them)")

# Iterate the page headers themselves (walks once, caches).
for page in cc.pages():
    print(page.type, page.encoding, page.num_values, page.offset)
```

`columnchunk.pages()` walks only that one chunk's page headers (cached after first call) — much cheaper than the full-file walk. `num_pages` is even cheaper when an OffsetIndex is present (SNPW always writes one; pyarrow does when `write_page_index=True`; older parquet-mr files often don't).

### Decoding page bodies

Each `Page` decodes its own body on demand — **faithfully to the encoding**,
not as a flattened reconstruction — without walking the rest of the file.
Every encoded stream is exposed in its own structure:

```python
cc = pf.row_groups[0].columns[0]
page = cc.page(1)                 # seeks via the OffsetIndex when present

decoded = page.decode()           # a DecodedPage (cached on the page)
decoded.num_nulls                 # V2: from the header; V1: from def levels

# Level streams: RleBitPackedStream (the encoding parquet uses for levels),
# or None when the column has no such block on disk (required / non-repeated).
decoded.definition_levels         # RleBitPackedStream | None
decoded.repetition_levels         # RleBitPackedStream | None
lvl = decoded.definition_levels
lvl.bit_width                     # packing width (from max_definition_level)
lvl.runs                          # ordered (RleRun | BitPackedRun) — on-disk structure
lvl.values                        # the expanded per-value levels

# Values section: PlainValues for PLAIN, or — because dictionary indices use
# the SAME RLE/bit-packed encoding as levels — an RleBitPackedStream of the
# raw indices for a dictionary page.
decoded.values                    # PlainValues | RleBitPackedStream
# e.g. for a dict page: decoded.values.bit_width / .runs / .values (indices)

# Physical-TYPE values (one level below logical): the encoding decoded and
# dict indices resolved, but NOT logical-type-interpreted — a UTF8 column
# yields b'S', not 'S' (a logical_values() companion is planned):
page.physical_values()
page.definition_levels()          # convenience: expanded levels ([0]*n if no block)
page.repetition_levels()
page.raw_body()                   # the on-disk body bytes (no decode)

# The chunk's dictionary (decoded once, cached) when it has a dictionary page:
cc.dictionary()                   # list of physical-type values, or None
cc.max_definition_level           # schema-derived, cheap
cc.max_repetition_level
```

`decode()` gives you the encoding's own data: an `RleBitPackedStream`
(`bit_width` + ordered `RleRun` / `BitPackedRun`) for levels and dictionary
indices, and `PlainValues` for PLAIN. The values section carries only the
**non-null** entries (`num_values - num_nulls`); the nulls live in the
definition levels — this is the on-disk shape, not a reassembled column.

There are three levels between the on-disk bytes and the logical values:
the **encoding representation** (`decode().values` — indices/runs/PLAIN
bytes), the **physical-type values** (`physical_values()` — decoded to the
parquet physical type with the dictionary resolved, e.g. `b'S'`), and the
**logical-type values** (the physical values reinterpreted via the column's
logical type, e.g. `'S'` / `Decimal` / a timestamp — not yet implemented).
The dictionary is an *encoding*, not a type, so `physical_values()` yields
the same physical type whether or not the page was dictionary-encoded.

V1 (length-prefixed levels inside the compressed body) and V2 (uncompressed
levels ahead of an optionally-compressed values section) are handled
transparently. An out-of-scope encoding or an undecompressable codec on
`decode()`, a non-data page on `decode()`, or a missing dictionary on
`physical_values()` raises a typed `PageDecodeError` subclass
(`UnsupportedEncodingError`,
`UnsupportedCodecError`, `UnsupportedPageTypeError`, `MissingDictionaryError`)
carrying a stable `.code`.


### Full eager walk (legacy shape)

When you genuinely need the complete byte-range view of every structural element:

```python
with ParquetFile("example.parquet") as pf:
    every_segment = pf.all_segments()       # sorted + gap-filled
    every_page = pf.all_pages()             # per-column pages tree
    chunk_offset_map = pf.column_offset_map # legacy parse_parquet_file()[1] shape
```

These are the only methods that trigger the full per-page Thrift walk that the legacy `parse_parquet_file()` always did. The CLI's `--output-mode segments` mode uses `pf.all_segments()`; the `default` and `html` modes use `pf.full_summary` + `pf.footer` + `pf.all_pages()`.

**Breaking change in v0.4:** the free functions `parse_parquet_file()`, `get_summary()`, `get_pages()`, and `find_footer_segment()` were removed. Use the `ParquetFile` methods above as drop-in replacements.

`segment_to_json`, `json_encode`, and `fill_gaps` remain as module-level utilities.

### Decoders (`parquet_analyzer.decoders`)

Page-level decoders for the encoded streams a Parquet inspector actually needs to read:

```python
from parquet_analyzer.decoders import (
    decompress,
    decode_rle_bitpacked_hybrid,
    decode_rle_bitpacked_hybrid_stream,
    decode_levels,
    decode_v1_level_block,
    decode_plain,
    DecodeStats,
    RleBitPackedStream,
    RleRun,
    BitPackedRun,
)
```

| Function | What it does |
|---|---|
| `decompress(data, codec, uncompressed_size)` | Decompress a Parquet compressed byte slice. Supports `UNCOMPRESSED`, `SNAPPY`, `GZIP`, `ZSTD`, `LZ4` (legacy Hadoop framed), `LZ4_RAW`. |
| `decode_rle_bitpacked_hybrid_stream(data, bit_width, num_values)` | Decode a raw RLE / bit-packed-hybrid stream into an `RleBitPackedStream` — the encoding's own structure: `bit_width` plus the ordered `runs` (each an `RleRun(value, length)` or `BitPackedRun(length, values)`) plus the flattened `values`. This is the faithful "encoder-logical" view used for both level streams and dictionary indices. |
| `decode_rle_bitpacked_hybrid(data, bit_width, num_values)` | The same stream as a `(values, DecodeStats)` pair — the flattened values plus a flat run summary. Use `decode_rle_bitpacked_hybrid_stream` when the ordered, per-run structure matters. |
| `decode_levels(data, max_level, num_values)` | Decode definition or repetition levels to a flat list. Bit width is derived from `max_level`. Returns `[0] * num_values` if `max_level == 0` (no level block exists on disk for required columns). |
| `decode_v1_level_block(data, offset, max_level, num_values)` | V1-data-page helper that handles the 4-byte little-endian length prefix in front of each level block. Returns `(levels, new_offset)`. V2 data pages store level byte lengths in the page header instead — for those, slice the bytes yourself and call `decode_levels` directly. |
| `decode_plain(data, parquet_type, num_values, type_length=None)` | Decode `PLAIN`-encoded values. Supported types: `BOOLEAN`, `INT32`, `INT64`, `INT96`, `FLOAT`, `DOUBLE`, `BYTE_ARRAY`, `FIXED_LEN_BYTE_ARRAY` (`type_length` required). `INT96` is returned as 12-byte `bytes` — interpretation is the caller's responsibility. |

End-to-end example — decode the indices of a dictionary-encoded V1 data page
and recover the original values. For most callers, `Page.decode()` (above)
does exactly this; reach for the raw decoders only when you need a custom
decode path. The byte ranges come from the public `Page` API:

```python
from parquet_analyzer import ParquetFile
from parquet_analyzer.decoders import (
    decompress, decode_v1_level_block, decode_rle_bitpacked_hybrid, decode_plain,
)

pf = ParquetFile("example.parquet")
cc = pf.row_groups[0].columns[0]            # a dict-encoded BYTE_ARRAY column
dict_page = next(p for p in cc.pages() if p._kind == "dictionary_page")
data_page = cc.page(cc.num_pages - 1)

# Dictionary entries are PLAIN values of the column's physical type.
dict_raw = decompress(dict_page.raw_body(), cc.codec, dict_page.uncompressed_size)
dict_values = decode_plain(dict_raw, cc.type, dict_page.num_values)

# V1 data page layout: [4-byte LE def-level block length][def-level RLE stream]
#                      [1-byte indices bit-width][indices RLE/bit-packed stream]
raw = decompress(data_page.raw_body(), cc.codec, data_page.uncompressed_size)
def_levels, after_def = decode_v1_level_block(
    raw, 0, cc.max_definition_level, data_page.num_values
)
indices_bit_width = raw[after_def]

# In dict-encoded pages, the indices stream contains entries only for
# non-null rows (nulls are represented in the def-level stream above and
# carry no value). So the index count is `num_non_null`, NOT `num_values`.
num_non_null = sum(1 for d in def_levels if d == cc.max_definition_level)
indices, stats = decode_rle_bitpacked_hybrid(
    raw[after_def + 1:], indices_bit_width, num_non_null,
)
print(f"RLE runs: {stats.rle_run_count}, bit-packed runs: {stats.bit_packed_run_count}")

# Reassemble nulls into the final value list using the def-level stream.
it = iter(indices)
values = [
    dict_values[next(it)] if d == cc.max_definition_level else None
    for d in def_levels
]
```

Gotchas worth knowing:

* **V1 vs V2 level layout.** V1 prefixes each level block with a 4-byte LE length. V2 stores the byte length in the page header instead (see the next bullet for V2's body layout). Use `decode_v1_level_block` for V1; for V2 slice the bytes yourself and call `decode_levels`.
* **V2 page body layout is `[rep_levels][def_levels][values]`.** Levels are stored uncompressed regardless of `is_compressed`; only the values section is (optionally) compressed. Concretely, V2 callers should slice `raw[:rep_len]`, `raw[rep_len:rep_len + def_len]`, and `raw[rep_len + def_len:]` using `repetition_levels_byte_length` and `definition_levels_byte_length` from the page header, then call `decode_levels` directly on the level slices (and `decompress` on the values slice only when `is_compressed` is true). Do not pass an entire V2 page body to `decompress` as one block.
* **Required columns have no level block.** When `max_def_level == 0`, the file contains no def-level bytes at all. `decode_levels` returns `[0] * num_values` in that case.
* **Indices skip nulls.** For nullable columns, the indices stream length is the non-null row count (`sum(def_levels)` when `max_def_level == 1`), not the page's `num_values`. Asking `decode_rle_bitpacked_hybrid` for too many values raises `truncated` (or silently produces garbage indices if the indices block is followed by other bytes).
* **Per-page dictionary-index bit width.** Dictionary-encoded data pages start their indices block with a 1-byte `bit_width` chosen by the writer (it may exceed `ceil(log2(dict_size))`). Read that byte first, then pass the rest to `decode_rle_bitpacked_hybrid`.

## Technical details

The tool uses a custom Thrift protocol implementation (`OffsetRecordingProtocol`) that wraps the standard Thrift compact protocol to track byte offsets and lengths of all decoded structures. This enables precise mapping of logical Parquet structures to their binary representation.

### Footer cache

Because each command is a one-shot process, a complex footer (hundreds of row groups × tens of columns) would re-pay the offset-recording decode — seconds — on every invocation. To keep repeated inspection of the same file fast, the parsed footer of a large file is cached on disk and served on the next open of an unchanged file (e.g. an interactive sequence of commands drops from seconds to tens of milliseconds per call).

The cache is transparent and safe by construction:

- **Content-addressed** on the footer bytes, so it is self-invalidating — any change to the file produces a different key and a stale entry can never be served. The cache also invalidates automatically across tool/Thrift upgrades.
- Stored in a private (`0700`) per-user cache directory; if that directory cannot be confirmed private, the cache silently disables itself and parsing proceeds normally.
- Written only for footers large enough to be worth it, and bounded in total size (oldest entries evicted).

It is fully optional:

| Environment variable | Effect |
|---|---|
| `PARQUET_ANALYZER_NO_CACHE=1` | Disable the cache entirely (always parse). |
| `PARQUET_ANALYZER_CACHE_DIR=<path>` | Relocate the cache directory (default: `$XDG_CACHE_HOME/parquet-analyzer/` or `~/.cache/parquet-analyzer/`). |
| `PARQUET_ANALYZER_CACHE_MAX_BYTES=<n>` | Eviction ceiling for the cache directory (default 1 GiB). |

The `ParquetFile(path, use_cache=False)` keyword bypasses it programmatically.

## Development

### Environment setup

```bash
pip install -e .[dev]
hatch run dev:check  # will format, lint, type-check, test with coverage
```

The development extra pulls in tooling (`hatch`, `ruff`, `pytest`, `pytest-benchmark`) and `pyarrow` / `numpy` so tests can generate Parquet fixtures on the fly.

### Benchmarks

Benchmark tests live under `tests/bench/` and are **excluded from the default `pytest` run** (and from `hatch run dev:check`) — they're heavier than the unit tests and not meant for every commit. Run them explicitly:

```bash
# Run all benchmarks (synthetic parquet fixtures generated on the fly)
pytest tests/bench/ --benchmark-only

# Compare against the committed baseline (captured at the start of the
# lazy-core work; see tests/bench/baselines/ for the JSON).
# Note: the leading "0001_" is pytest-benchmark's auto-prepended save-
# sequence prefix; --benchmark-compare matches by prefix, so the full
# filename stem is required.
# The -W flag suppresses pytest-benchmark's "machine_info changed"
# warning, which fires noisily on virtualized hosts where cpu.hz_actual
# jitters between runs even on the same machine.
pytest tests/bench/ --benchmark-only \
  --benchmark-storage=file://tests/bench/baselines \
  --benchmark-compare=0001_eager-v0.4.0 \
  -W ignore::pytest_benchmark.logger.PytestBenchmarkWarning
```

The synthetic fixture generator (`tests/bench/generate.py`) produces three shapes that stress different lazy-parsing boundaries:

- `wide` — many columns, few rows (footer is large relative to body)
- `tall` — few columns, many rows (body is huge relative to footer; the canonical case for the lazy-core's footer-only fast path)
- `deep` — few columns, many rows split across many row groups (stresses per-row-group / per-chunk walking)

To capture a fresh baseline (e.g., after a behavior change in the eager path):

```bash
pytest tests/bench/ --benchmark-only \
  --benchmark-storage=file://tests/bench/baselines \
  --benchmark-save=eager-vX.Y.Z
```

Baseline files are platform-specific (CPU, Python version) — pytest-benchmark stores them under `tests/bench/baselines/<platform>/`.

> **⚠️ Cross-machine comparisons are not meaningful.** The committed baseline (`eager-v0.4.0`) was captured on the maintainer's machine (Linux/CPython 3.14/x86_64, AMD EPYC 9V74). The per-platform subdirectory prevents the most obvious mismatches (Linux vs macOS, x86 vs ARM), but does **not** distinguish between CPU SKUs in the same broad category — an old i7 and a current EPYC both land in `Linux-CPython-3.14-64bit/`, with wildly different absolute numbers. When validating perf changes against the lazy-core work, **capture your own baseline before the change and compare against that**, not against the committed one. The committed baseline is useful for the maintainer's own session-to-session comparisons and as a frozen reference for the perf claims in PR #18. There's no CI gating on benchmark numbers; perf validation is operator-driven on a single machine at a time.

### Regenerating Thrift bindings

The Python modules in `src/parquet` are generated from `parquet.thrift`.

1. Install the Apache Thrift compiler (`brew install thrift` on macOS, or download a release from the [Apache Thrift](https://thrift.apache.org/) project).
2. From the repository root, regenerate everything in one step:

   ```bash
   hatch run dev:update-thrift
   ```

   This refreshes `parquet.thrift`, runs the compiler, and removes any stray `src/__init__.py` the compiler may create.

## Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

## License

This project is licensed under the [Apache License 2.0](LICENSE).

© 2025 Chungmin Lee
