Skip to content

[Data] Deprecate read_clickhouse and write_clickhouse in favor of community-maintained ray-clickhouse - #66308

Closed
richardliaw wants to merge 4 commits into
ray-project:masterfrom
richardliaw:deprecate-clickhouse
Closed

richardliaw wants to merge 4 commits into
ray-project:masterfrom
richardliaw:deprecate-clickhouse

Conversation

@richardliaw

Copy link
Copy Markdown
Contributor

Summary

  • Deprecate read_clickhouse and write_clickhouse in favor of the community-maintained ray-clickhouse package.
  • Add @Deprecated(warning=True) to both APIs so users get a runtime deprecation warning.
  • Update the loading/saving data API docs with .. deprecated:: directives pointing to ray-clickhouse.

Test plan

  • Verify deprecation warnings are emitted when calling read_clickhouse / write_clickhouse
  • Verify docs render the deprecation notice correctly

🤖 Generated with Claude Code

…munity-maintained ray-clickhouse

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: Richard Liaw <[email protected]>
@richardliaw
richardliaw requested review from a team as code owners September 18, 2026 23:42
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@ray-gardener ray-gardener Bot added docs An issue or change related to documentation data Ray Data-related issues deprecation Scheduled for deprecation labels Sep 19, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: Richard Liaw <[email protected]>
@richardliaw
richardliaw requested a review from a team as a code owner September 28, 2026 20:03
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: Richard Liaw <[email protected]>
@richardliaw richardliaw added the go add ONLY when ready to merge, run all tests label Sep 28, 2026
@richardliaw

Copy link
Copy Markdown
Contributor Author

@dstrodtman i'm seeing a CI failure from docs build - can you help advise on how to fix?

@dstrodtman

Copy link
Copy Markdown
Contributor

@richardliaw The Read the Docs build is passing. The red check is premerge's doc: check API doc consistency job (log):

Documented APIs that resolve to deprecated / private objects:
	ray.data.dataset.Dataset.write_clickhouse
	ray.data.read_api.read_clickhouse

Switching to @Deprecated makes these non-public, but they're still in the autosummary blocks. The checker requires every documented API to be public. The simplest fix is to add both names to the data team's tracked_doc_debt in ci/ray_ci/doc/cmd_check_api_discrepancy.py, next to the existing "Deprecated but still documented" entries (read_unity_catalog, iter_tf_batches):

            "ray.data.read_api.read_unity_catalog",
            "ray.data.dataset.Dataset.write_clickhouse",
            "ray.data.read_api.read_clickhouse",

You could also drop the ClickHouse sections from loading_data.rst and saving_data.rst altogether, since the new community-connector entry already points to ray-clickhouse. I'd keep them documented while the functions still ship, though.

One more thing that doesn't fail CI: .. deprecated:: needs a version argument. Without it, Sphinx reads your first sentence as the version, and the preview shows "Deprecated since version read_clickhouse: is deprecated..." In both files, put the Ray release this deprecation lands in on the directive line (replace X.Y below):

.. deprecated:: X.Y
   ``read_clickhouse`` is deprecated. Use the `ray-clickhouse <https://github.com/jiangxt2/ray-clickhouse>`_ package instead.

dstrodtman added a commit that referenced this pull request Sep 30, 2026
#66612)

## Why

The [API
policy](https://docs.ray.io/en/latest/ray-contribute/api-policy.html)
says deprecated APIs must be documented. The docs-side half of `doc:
check API doc consistency`, added in #64420, did the opposite: it failed
any documented autosummary or autoclass entry that resolved to a
`@Deprecated` object. That's what blocked #66308, which deprecates
`read_clickhouse` and `write_clickhouse` and leaves them documented with
a deprecation notice, which is what the policy asks for.

Teams have been working around the rule instead. Ray Data kept its
deprecated APIs in `tracked_doc_debt` under a comment asking for them to
be removed from the docs.

## What

- `API.split_resolvable_and_broken_doc_apis` no longer flags deprecated
objects. It still fails documented names that don't resolve and
documented names that resolve to private objects (`_foo` or
`._internal.`), with the existing override-hook and `__all__` re-export
exemptions unchanged.
- It returns `(unresolved, private)` instead of `(unresolved,
non_public)`, and the error output says "private" instead of "deprecated
/ private."
- `API.introspect_annotation_type` is removed. The deprecated check was
its only caller. The inherited-annotation behavior it tested is still
covered through `Module` in `test_module.py`.
- The four Ray Data `tracked_doc_debt` entries for deprecated APIs are
removed: `AggregateFn`, `Dataset.iter_tf_batches`,
`Dataset.to_random_access_dataset`, and `read_unity_catalog`. All four
are `@Deprecated` in source, so the entries only existed to get around
this rule.

Out of scope: the policy also implies the code-side check should
*require* deprecated APIs to be documented. Today that check skips them.
There are about 90 `@Deprecated` decorators under `python/ray`, many on
undocumented methods, so turning that on is a per-team burndown and
belongs in a follow-up.

## Duplicate check

No open PR touches this rule. I searched open PRs for
`api_policy_check`, `cmd_check_api_discrepancy`, and "API doc
consistency" together with deprecation. #66308 is the PR this unblocks,
not a duplicate.

## Testing

```
python -m pytest ci/ray_ci/doc/test_api.py ci/ray_ci/doc/test_cmd_check_api_discrepancy.py ci/ray_ci/doc/test_module.py
40 passed
pre-commit run --files <changed files>   # ruff, black, docstyle, import order: all passed
```

I didn't run the checker end to end against a real Ray install. This
PR's `doc: check API doc consistency` step does that, and should pass
with the four Data exemptions removed.

This PR was written with AI assistance (Claude Code). I reviewed the
change.

🤖 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#66612)

## Why

The [API
policy](https://docs.ray.io/en/latest/ray-contribute/api-policy.html)
says deprecated APIs must be documented. The docs-side half of `doc:
check API doc consistency`, added in ray-project#64420, did the opposite: it failed
any documented autosummary or autoclass entry that resolved to a
`@Deprecated` object. That's what blocked ray-project#66308, which deprecates
`read_clickhouse` and `write_clickhouse` and leaves them documented with
a deprecation notice, which is what the policy asks for.

Teams have been working around the rule instead. Ray Data kept its
deprecated APIs in `tracked_doc_debt` under a comment asking for them to
be removed from the docs.

## What

- `API.split_resolvable_and_broken_doc_apis` no longer flags deprecated
objects. It still fails documented names that don't resolve and
documented names that resolve to private objects (`_foo` or
`._internal.`), with the existing override-hook and `__all__` re-export
exemptions unchanged.
- It returns `(unresolved, private)` instead of `(unresolved,
non_public)`, and the error output says "private" instead of "deprecated
/ private."
- `API.introspect_annotation_type` is removed. The deprecated check was
its only caller. The inherited-annotation behavior it tested is still
covered through `Module` in `test_module.py`.
- The four Ray Data `tracked_doc_debt` entries for deprecated APIs are
removed: `AggregateFn`, `Dataset.iter_tf_batches`,
`Dataset.to_random_access_dataset`, and `read_unity_catalog`. All four
are `@Deprecated` in source, so the entries only existed to get around
this rule.

Out of scope: the policy also implies the code-side check should
*require* deprecated APIs to be documented. Today that check skips them.
There are about 90 `@Deprecated` decorators under `python/ray`, many on
undocumented methods, so turning that on is a per-team burndown and
belongs in a follow-up.

## Duplicate check

No open PR touches this rule. I searched open PRs for
`api_policy_check`, `cmd_check_api_discrepancy`, and "API doc
consistency" together with deprecation. ray-project#66308 is the PR this unblocks,
not a duplicate.

## Testing

```
python -m pytest ci/ray_ci/doc/test_api.py ci/ray_ci/doc/test_cmd_check_api_discrepancy.py ci/ray_ci/doc/test_module.py
40 passed
pre-commit run --files <changed files>   # ruff, black, docstyle, import order: all passed
```

I didn't run the checker end to end against a real Ray install. This
PR's `doc: check API doc consistency` step does that, and should pass
with the four Data exemptions removed.

This PR was written with AI assistance (Claude Code). I reviewed the
change.

🤖 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 15, 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

data Ray Data-related issues deprecation Scheduled for deprecation docs An issue or change related to documentation go add ONLY when ready to merge, run all tests 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