Skip to content

[Data] Document how to configure an Iceberg REST catalog - #66192

Closed
moomindani wants to merge 2 commits into
ray-project:masterfrom
moomindani:iceberg-rest-catalog-docs
Closed

moomindani wants to merge 2 commits into
ray-project:masterfrom
moomindani:iceberg-rest-catalog-docs

Conversation

@moomindani

Copy link
Copy Markdown
Contributor

Description

read_iceberg and Dataset.write_iceberg pass catalog_kwargs to PyIceberg's load_catalog(), so an
Iceberg REST catalog already works. Nothing in the docs said so, or showed the properties one needs: the
Iceberg tab of the loading-data guide and the read_iceberg docstring only show a Glue catalog, and the
sole mention of REST anywhere was a write_iceberg example naming {"name": "default", "type": "rest"}
with no uri, which cannot connect to anything.

This adds:

  • a REST catalog example in the Iceberg tab of loading-data.rst, in the shape the neighbouring tabs use
    -- a "To read from ..." sentence, the properties annotated inline in the code block, then the
    alternatives for AWS SigV4 (rest.sigv4-enabled, rest.signing-name, rest.signing-region) and extra
    request headers (header.<name>);
  • a closing sentence that writing goes through the same catalog_kwargs, and that the catalog has to
    serve the REST spec's table update endpoint;
  • the same example in the read_iceberg and write_iceberg docstrings.

It also changes the incomplete "type": "rest" in the partial-overwrite example to "type": "sql",
matching the other examples in that block, so the REST configuration is shown once and shown completely.

Every property name was checked against PyIceberg 0.11: credential, scope, oauth2-server-uri,
rest.sigv4-enabled, rest.signing-region, rest.signing-name in pyiceberg/catalog/rest/__init__.py,
and the header. prefix in pyiceberg/utils/properties.py.

Related issues

None. Documentation gap found while working on the Iceberg datasource.

Not a duplicate: no open issue or PR covers Iceberg catalog documentation, and no open PR touches
loading-data.rst's Iceberg tab or these docstrings.

Additional information

Verified against a real REST catalog

Run against a local OSS Unity Catalog 0.7.0-SNAPSHOT Iceberg REST catalog, with Ray master and
PyIceberg 0.11.0:

result
read_iceberg 15 rows, identical to PyIceberg's own scan().to_arrow()
.filter(expr=col("marks") > 900) 2 rows (930, 993)
projection to two columns schema ['id', 'marks']
write_iceberg APPEND 3 rows committed and read back
write_iceberg UPSERT on id [(1, 'a'), (2, 'B'), (3, 'c'), (4, 'd')], snapshots ['append', 'overwrite']

Writes need that server's experimental Iceberg REST writes turned on (server.iceberg-table.enabled, off
by default); with the default configuration the commit is refused with NotImplementedError: Server does not support endpoint: POST /v1/{prefix}/namespaces/{namespace}/tables/{table}, which is what the note
about the table update endpoint describes.

Checks

pre-commit run --files doc/source/data/loading-data.rst python/ray/data/read_api.py \
  python/ray/data/dataset.py
  -> all hooks pass

Vale passes at --minAlertLevel=suggestion with no alerts in the added lines (the hook needs rst2html
on PATH; without docutils installed it fails the same way on unmodified files). The RST was validated
separately with docutils: 0 errors, the remaining messages being Sphinx-only directives (testcode,
tab-item) that docutils doesn't know.

AI assistance

AI assistance was used for this change: the investigation, the wording, and the verification above were
produced with Claude Code. I have reviewed every changed line.

@moomindani
moomindani requested review from a team as code owners September 15, 2026 23:04

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request adds documentation and code examples for reading from and writing to an Iceberg REST catalog using Ray Data. The feedback suggests keeping a Sphinx hyperlink URL on a single line in the documentation to prevent parsing issues caused by splitting it with a backslash.

Comment thread doc/source/data/loading-data.rst Outdated
Comment on lines +681 to +683
properties in ``catalog_kwargs``. Ray Data hands them to PyIceberg's `load_catalog()
<https://py.iceberg.apache.org/reference/pyiceberg/catalog/\
#pyiceberg.catalog.load_catalog>`__, so any catalog type PyIceberg supports works.

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.

medium

Splitting the URL across lines with a backslash inside the angle brackets (<...>) can cause Sphinx to parse the URL incorrectly, leading to a broken hyperlink in the rendered documentation. It is safer and cleaner to keep the entire URL on a single line, as URLs are exempt from standard line-length limits.

Suggested change
properties in ``catalog_kwargs``. Ray Data hands them to PyIceberg's `load_catalog()
<https://py.iceberg.apache.org/reference/pyiceberg/catalog/\
#pyiceberg.catalog.load_catalog>`__, so any catalog type PyIceberg supports works.
properties in ``catalog_kwargs``. Ray Data hands them to PyIceberg's
`load_catalog() <https://py.iceberg.apache.org/reference/pyiceberg/catalog/#pyiceberg.catalog.load_catalog>`__,
so any catalog type PyIceberg supports works.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed and fixed in 9283ebc -- and it was not only a risk, the link really was broken. Rendering the
block with docutils, the backslash-split form gives

https://py.iceberg.apache.org/reference/pyiceberg/catalog/ #pyiceberg.catalog.load_catalog

so the line break becomes a space and the fragment is lost.

The same link is written the same way in the catalog_kwargs descriptions of read_iceberg and
Dataset.write_iceberg, which predate this PR, so those two were broken as well; all three are now on one
line. Verified by rendering again: no reference in the guide has a URI containing a space, and both
docstring links resolve to the intended anchor.

moomindani added a commit to moomindani/ray that referenced this pull request Sep 15, 2026
Review feedback on ray-project#66192.

The link this PR added split the URL across lines with a trailing backslash inside the
angle brackets. Docutils keeps the line break as a space, so the target came out as
".../catalog/ #pyiceberg.catalog.load_catalog" and the fragment was lost. The two
docstrings that describe catalog_kwargs already had the same link written the same way, so
those links were broken before this PR too; all three are now on one line.

Checked by rendering with docutils: no reference in the guide has a URI containing a space,
and each docstring link resolves to
https://py.iceberg.apache.org/reference/pyiceberg/catalog/#pyiceberg.catalog.load_catalog

Co-authored-by: Claude <[email protected]>
Signed-off-by: Noritaka Sekiyama <[email protected]>
@ray-gardener ray-gardener Bot added docs An issue or change related to documentation data Ray Data-related issues community-contribution Contributed by the community labels Sep 16, 2026
@dstrodtman

Copy link
Copy Markdown
Contributor

Hi @moomindani, heads-up: master converted a doc page this PR edits from reStructuredText to MyST Markdown, so that edit needs to move to the .md file when you rebase:

If you'd like help translating your edits to Markdown, DM me (Douglas Strodtman) on the Ray Slack and I'll help. If you'd rather handle it yourself, the repo has a Claude Code skill for this conversion at doc/.claude/skills/rst-to-myst/. Most small edits don't need it, though: any coding agent can translate them without the skill loaded.

moomindani and others added 2 commits September 30, 2026 10:16
read_iceberg and write_iceberg pass catalog_kwargs to PyIceberg's load_catalog, so a REST
catalog works today, but nothing in the docs said so or showed the properties one needs.
The only mention was a write_iceberg example naming "type": "rest" without a uri, which
cannot connect.

Adds a REST catalog example to the Iceberg tab of the loading-data guide, following the
shape the neighbouring tabs use: a "To read from ..." sentence, the properties annotated in
the code block, then the alternatives for SigV4 and extra headers. A closing sentence says
writing goes through the same properties and needs a catalog that serves the REST spec's
table update endpoint. Adds the same example to the read_iceberg and write_iceberg
docstrings, and makes the incomplete "type": "rest" in the partial-overwrite example a sql
catalog, consistent with the other examples there.

Verified against a local OSS Unity Catalog 0.7.0-SNAPSHOT Iceberg REST catalog: read of a
15-row table matched PyIceberg's own read, a filter came back with the 2 matching rows, a
projection returned the projected columns, and with the server's experimental Iceberg
writes enabled an append and an upsert both committed and read back correctly.

Co-authored-by: Claude <[email protected]>
Signed-off-by: Noritaka Sekiyama <[email protected]>
Review feedback on ray-project#66192.

The link this PR added split the URL across lines with a trailing backslash inside the
angle brackets. Docutils keeps the line break as a space, so the target came out as
".../catalog/ #pyiceberg.catalog.load_catalog" and the fragment was lost. The two
docstrings that describe catalog_kwargs already had the same link written the same way, so
those links were broken before this PR too; all three are now on one line.

Checked by rendering with docutils: no reference in the guide has a URI containing a space,
and each docstring link resolves to
https://py.iceberg.apache.org/reference/pyiceberg/catalog/#pyiceberg.catalog.load_catalog

Co-authored-by: Claude <[email protected]>
Signed-off-by: Noritaka Sekiyama <[email protected]>
@moomindani
moomindani force-pushed the iceberg-rest-catalog-docs branch from 9283ebc to 920e946 Compare September 30, 2026 02:27
@moomindani
moomindani requested a review from a team as a code owner September 30, 2026 02:27
@moomindani

Copy link
Copy Markdown
Contributor Author

Thanks for the heads-up, @dstrodtman. Rebased onto master and moved the REST catalog section into doc/source/data/loading-data.md as MyST. The wording is unchanged; the docstring link fix in dataset.py and read_api.py is carried over as before.

dstrodtman added a commit that referenced this pull request Oct 1, 2026
#66615)

## Why are these changes needed?

The Ray Data style-pass PRs (#66413, #66418, #66419, #66420, #66422,
#66423) left a set of mechanical and structural items open. This PR
clears them. None of the edits changes a technical claim, so it needs a
style review rather than an SME review.

**Markup and links**

- `key-concepts.md`: tags the two logical-plan output blocks as `text`,
and adds alt text to the three diagrams.
- `index.md`, `shuffling-data.md`: removes `$` prompts from shell
blocks.
- `aggregating-data.md`, `iterating-over-data.md`: uses `{meth}` instead
of `{class}` for `Dataset.max`, `min`, `sum`, and `random_shuffle`.
- `aggregating-data.md`: drops the trailing slash from the blog link
fragment `#performance-benchmarks/`.
- `train/getting-started-lightgbm.rst`,
`train/getting-started-xgboost.rst`, and two Lightning example
notebooks: replaces the hard-coded "Ray Data Quickstart" link text with
a bare reference, so the link renders the page title.
- `loading-data.md`: moves the `(reading_kafka)=` label above the Kafka
heading, stacked with `(reading-from-kafka)=`.

**Structure and wording**

- `quickstart.md`: replaces the opening bullet list, which restated the
section headings, with one sentence that keeps the section links.
- `custom-datasource-example.md`: renames the two "Implement the
constructor" headings to "Implement the datasource constructor" and
"Implement the datasink constructor". Nothing links to the old anchors.
- `loading-data.md`: moves the Iceberg tab from the distributed
DataFrame libraries tab set to the "Read files" tab set, since Iceberg
is a data format rather than a DataFrame library. The tab content is
unchanged.
- `loading-data.md`: drops the unsourced "most popular PostgreSQL
database connector" claim.
- `loading-data.md`: the Hugging Face paragraph now leads with the
token, which the example uses, and presents `HfFileSystem()` without a
token as the fallback for public datasets. See the [#66419 review
thread](#66419 (comment)).
- `working-with-llms.md`: moves the usage-data note out from under the
NIXL troubleshooting heading into its own closing section.
- `working-with-pytorch.md`: drops the `torchaudio` mention, since the
section has no `torchaudio` example.
- `index.md`: "what Datasets are" becomes "what a `Dataset` is",
matching the class that the linked key-concepts page defines.

**For reviewers**

- Please confirm the diagram alt text in `key-concepts.md`. I wrote it
from what each diagram shows.
- #66192 adds a REST-catalog example inside the Iceberg tab that this PR
moves. Whichever PR merges second needs a small rebase: the added
content moves with the tab, and its `:::` fences become `::::`.

## Related issue number

None. This isn't a duplicate: the items come from reviewing the merged
style-pass PRs above, and I searched open PRs touching
`doc/source/data/` for overlap. The only overlap is #66192, noted above.

## Checks

- [x] I've signed off every commit (DCO).
- [x] `pre-commit run --files <changed files>` passes. No hook covers
`doc/source` Markdown or notebooks, so every content hook skipped.
- [x] Checked that both edited notebooks still parse as JSON.
- [ ] Sphinx build: not run locally. Relying on the Read the Docs
preview for directive nesting and cross-reference resolution.

AI assistance (Claude Code) was used to make these edits. I reviewed
every changed line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
ray-project#66615)

## Why are these changes needed?

The Ray Data style-pass PRs (ray-project#66413, ray-project#66418, ray-project#66419, ray-project#66420, ray-project#66422,
ray-project#66423) left a set of mechanical and structural items open. This PR
clears them. None of the edits changes a technical claim, so it needs a
style review rather than an SME review.

**Markup and links**

- `key-concepts.md`: tags the two logical-plan output blocks as `text`,
and adds alt text to the three diagrams.
- `index.md`, `shuffling-data.md`: removes `$` prompts from shell
blocks.
- `aggregating-data.md`, `iterating-over-data.md`: uses `{meth}` instead
of `{class}` for `Dataset.max`, `min`, `sum`, and `random_shuffle`.
- `aggregating-data.md`: drops the trailing slash from the blog link
fragment `#performance-benchmarks/`.
- `train/getting-started-lightgbm.rst`,
`train/getting-started-xgboost.rst`, and two Lightning example
notebooks: replaces the hard-coded "Ray Data Quickstart" link text with
a bare reference, so the link renders the page title.
- `loading-data.md`: moves the `(reading_kafka)=` label above the Kafka
heading, stacked with `(reading-from-kafka)=`.

**Structure and wording**

- `quickstart.md`: replaces the opening bullet list, which restated the
section headings, with one sentence that keeps the section links.
- `custom-datasource-example.md`: renames the two "Implement the
constructor" headings to "Implement the datasource constructor" and
"Implement the datasink constructor". Nothing links to the old anchors.
- `loading-data.md`: moves the Iceberg tab from the distributed
DataFrame libraries tab set to the "Read files" tab set, since Iceberg
is a data format rather than a DataFrame library. The tab content is
unchanged.
- `loading-data.md`: drops the unsourced "most popular PostgreSQL
database connector" claim.
- `loading-data.md`: the Hugging Face paragraph now leads with the
token, which the example uses, and presents `HfFileSystem()` without a
token as the fallback for public datasets. See the [ray-project#66419 review
thread](ray-project#66419 (comment)).
- `working-with-llms.md`: moves the usage-data note out from under the
NIXL troubleshooting heading into its own closing section.
- `working-with-pytorch.md`: drops the `torchaudio` mention, since the
section has no `torchaudio` example.
- `index.md`: "what Datasets are" becomes "what a `Dataset` is",
matching the class that the linked key-concepts page defines.

**For reviewers**

- Please confirm the diagram alt text in `key-concepts.md`. I wrote it
from what each diagram shows.
- ray-project#66192 adds a REST-catalog example inside the Iceberg tab that this PR
moves. Whichever PR merges second needs a small rebase: the added
content moves with the tab, and its `:::` fences become `::::`.

## Related issue number

None. This isn't a duplicate: the items come from reviewing the merged
style-pass PRs above, and I searched open PRs touching
`doc/source/data/` for overlap. The only overlap is ray-project#66192, noted above.

## Checks

- [x] I've signed off every commit (DCO).
- [x] `pre-commit run --files <changed files>` passes. No hook covers
`doc/source` Markdown or notebooks, so every content hook skipped.
- [x] Checked that both edited notebooks still parse as JSON.
- [ ] Sphinx build: not run locally. Relying on the Read the Docs
preview for directive nesting and cross-reference resolution.

AI assistance (Claude Code) was used to make these edits. I reviewed
every changed line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Oct 14, 2026
dstrodtman added a commit that referenced this pull request Oct 21, 2026
…EXAMPLE doctests (#67209)

## Description

Converts the never-run `.. testcode::` / `:skipif: True` examples for
Ray Data's external-service sinks and the Hive reader to `>>>` doctests.
Each docstring is flagged once with the docstring-level `# doctest:
+SKIP_EXAMPLE` from #66753. The change touches only docstrings:

- **`python/ray/data/dataset.py`**: 10 blocks in `write_iceberg`,
`write_delta`, `write_webdataset`, `write_snowflake`, `write_mongo`,
`write_bigquery`, `write_clickhouse`, `write_turbopuffer` (2 blocks),
and `write_kafka`.
- **`python/ray/data/read_api.py`**: the `read_hive` example.
- **`python/ray/data/_internal/datasource/turbopuffer_datasink.py`**:
the 3 `TurbopufferDatasink` examples.

Each example needs a service, credentials, or a bucket that CI doesn't
have, so they stay render-only, as before. The flag is stripped at
render time by both Sphinx (`trim_doctest_flags`) and griffe. The
conversion follows the rules from #67080: same code in the same order,
blank lines inside a block dropped, and top-level comments as `>>> #`
lines.

Two docstrings needed something other than the flag:

- **The `Dataset` class docstring runs its example now.** That docstring
also holds 10 runnable `>>>` examples, and `+SKIP_EXAMPLE` skips a whole
docstring, so it would have stopped them from running. Instead, only the
two lines that use placeholder paths, `read_parquet("s3://bucket/path")`
and `write_csv("s3://bucket/output")`, carry `# doctest: +SKIP`. The
`range` and `from_items` lines run.
- **`write_csv`'s example had an unterminated string**,
`"s3://bucket/folder/)`. It was already `+SKIP`, so nothing ever parsed
it. The closing quote is now in place, so the docstring parses with the
stock doctest parser.

The `:skipif: True` blocks left in `dataset.py` after this PR are in
#67202 (`join`) and #67207 (`streaming_split`).

## Related issues

Related to #66753, #67080, #67202, and #67207.

## Additional information

**Not a duplicate.** I searched open PRs for each method name,
`turbopuffer`, `SKIP_EXAMPLE`, and `testcode skipif data`. #67202 and
#67207 are my own and convert other methods in `dataset.py`. Two open
PRs edit text these examples sit next to, so whichever PR lands second
needs a small rebase:

- #66192 edits the `write_iceberg` example's content, adding a REST
catalog write. This PR changes only the example's form.
- #66308 adds a deprecation notice to `write_clickhouse`, next to its
example.

#67114 and #67168 change `read_api.py` but not the `read_hive` docstring
example.

**Tests run**

- `ci/ray_ci/doc/check_docstring_only.py --base upstream/master`: "3
file(s), docstrings only."
- `ci/ray_ci/doc/run_docstring_examples.py` on the three files, in an
aarch64 image with the Ray nightly at `093faf5583e` and the changed
files mounted over the installed ones. None of the three files changed
between that commit and this PR's base. Result: 85 docstrings run and 1
failed, with 16 skipped for `+SKIP_EXAMPLE` and 5 for an omitted library
(torch, torchvision, TensorFlow, `tensorflow_datasets`). All 13
converted docstrings report `SKIP (+SKIP_EXAMPLE)`, and `Dataset` and
`Dataset.write_csv` pass. The one failure is `read_videos`, which this
PR doesn't touch. It needs `decord`, which has no aarch64 wheel. The run
installed `datasketches`, `Pillow`, `crc32c`, `soundfile`, and
`fastavro`, which the base image lacks. Without them, six more untouched
docstrings fail on the missing import.
- Every `>>>` example in the three files compiles with the stock
`doctest` parser once `SKIP_EXAMPLE` is registered.
- `pre-commit run --files` on the three files: all hooks pass, including
ruff, black, pydoclint, and the Ray docstyle check.

The PR carries the `docstring-only` label, and its commit carries an
`@rtd-build` line for the Read the Docs preview.

AI assistance (Claude Code) was used for this PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no more activity in the 14 days
since being marked stale.

Please feel free to reopen or open a new pull request if you'd still like this to be addressed.

Again, you can always ask for help on our discussion forum or Ray's public slack channel.

Thanks again for your contribution!

@github-actions github-actions Bot closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community data Ray Data-related issues docs An issue or change related to documentation stale The issue is stale. It will be closed within 7 days unless there are further conversation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants