Skip to content

docs: Document the doc field metadata key for PyArrow schemas - #4515

Merged
Fokko merged 1 commit into
apache:mainfrom
prateek11rai:docs-pyarrow-field-doc
Nov 29, 2026
Merged

Fokko merged 1 commit into
apache:mainfrom
prateek11rai:docs-pyarrow-field-doc

Conversation

@prateek11rai

Copy link
Copy Markdown
Contributor

Note

🤖 claude-opus-5-5 on behalf of Prateek

Rationale for this change

When a table is created from a PyArrow schema, column descriptions come from the doc key in each field's metadata:

# pyiceberg/io/pyarrow.py
PYARROW_FIELD_DOC_KEY = b"doc"

The docs don't mention this key. A description stored under another key, such as description, is not used, and there is no error, so the table ends up with no column descriptions. I ran into this writing a table with a few hundred described columns to a REST catalog and found the key by reading pyiceberg/io/pyarrow.py.

This adds a description to one field in the "create a table using a pyarrow schema" example, and a short paragraph on the key, including that union_by_name reads it too and that reading a table back into PyArrow sets it.

Are these changes tested?

Docs only. I checked each statement against a local SqlCatalog: create_table with doc stores the description in the table metadata and with description stores none, union_by_name adds a new column's description, and scan().to_arrow() returns fields with doc metadata. make lint passes, and mkdocs build --strict passes with the #union-by-name link resolving.

Are there any user-facing changes?

Docs only. No code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Fokko Fokko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable, thanks for adding this @prateek11rai

@Fokko
Fokko added this pull request to the merge queue Nov 29, 2026
Merged via the queue into apache:main with commit 366ecaa Nov 29, 2026
20 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