Skip to content

[python] Enable Parquet page indexes when supported - #9976

Merged
JingsongLi merged 4 commits into
apache:masterfrom
XiaoHongbo-Hope:codex/parquet-write-page-index
Sep 20, 2026
Merged

JingsongLi merged 4 commits into
apache:masterfrom
XiaoHongbo-Hope:codex/parquet-write-page-index

Conversation

@XiaoHongbo-Hope

@XiaoHongbo-Hope XiaoHongbo-Hope commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Enable Parquet page indexes by default when supported (PyArrow >= 13), preserving older-version compatibility. parquet.write-page-index.enabled=false disables them; explicit true rejects unsupported versions before creating files.

Tests

286 local tests passed. Verified all three states, vector files, PyArrow 6/12 compatibility, and Java Parquet/Rust readback. Lint, license checks, and git diff --check passed.

@XiaoHongbo-Hope
XiaoHongbo-Hope marked this pull request as ready for review September 19, 2026 08:03
@JingsongLi

Copy link
Copy Markdown
Contributor

I think the default behavior should align with the Java writer: write the Parquet Page Index whenever the installed PyArrow version supports it, instead of defaulting to false.

Paimon Java, through parquet-java, already writes ColumnIndex and OffsetIndex by default. Keeping Python disabled by default means that files written to the same table have different metadata depending on the writer implementation.

A plain default_value(True) would break the PyArrow 6/7 versions that PyPaimon still supports, so I suggest capability-aware, three-state semantics:

  • unset: enable automatically on PyArrow >= 13; omit the argument on older versions;
  • explicit true: enable it, and fail before creating output when PyArrow < 13;
  • explicit false: always disable it.

This could be implemented by making the option have no configured default and resolving the default in create_parquet_writer_options based on the installed PyArrow version. The documentation could describe the default as: "enabled when supported by the installed PyArrow version (PyArrow >= 13); otherwise disabled."

The tests should then expect setting=None to produce Page Indexes on PyArrow >= 13, while a mocked PyArrow 12 should still write successfully without passing write_page_index.

The option name itself looks reasonable to me: "Page Index" is the Parquet specification term, and write-page-index is consistent with PyArrow write_page_index and Impala PARQUET_WRITE_PAGE_INDEX.

@XiaoHongbo-Hope XiaoHongbo-Hope changed the title [python] Add opt-in Parquet page index writing [python] Enable Parquet page indexes when supported Sep 20, 2026
@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi
JingsongLi merged commit 0b67f36 into apache:master Sep 20, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants