Repository navigation
Conversation
22b3776 to
8b976a1
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces native support for reading HDF5 datasets into Ray Datasets by adding the read_hdf5 API and implementing HDF5Datasource. The implementation handles metadata inspection, parallel segment planning (aligning with HDF5 chunks and block sizes), and reading. A critical bug was identified in the read task generator where transient I/O retries via iterate_with_retry can cause silent data duplication by re-yielding already processed segments. A code suggestion has been provided to track completed segments and dynamically resume from the failed segment on retry.
|
@ArturNiederfahrenhorst @richardliaw can you help to take a look, thx. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 3819d45. Configure here.
Add a public read_hdf5 API backed by a chunk-aware FileBasedDatasource. Validate HDF5 schemas and unsafe storage modes, support Arrow-native string and variable-length values, and cover the integration with focused tests. Signed-off-by: biyan <[email protected]> Co-Authored-By: Codex <[email protected]> AI-Model: gpt-5.6-sol Signed-off-by: biyan <[email protected]> Co-Authored-By: Codex <[email protected]> Co-Authored-By: Codex <[email protected]> AI-Contributed/Feature: 654/654 AI-Contributed/UT: 811/811
Reject external links before dataset dereference, verify late-segment retries do not duplicate output, and add the required pytest entry point for semgrep. Co-Authored-By: Codex <[email protected]> AI-Model: gpt-5.6-sol Signed-off-by: biyan <[email protected]> Co-Authored-By: Codex <[email protected]> Co-Authored-By: Codex <[email protected]> AI-Contributed/Feature: 8/8 AI-Contributed/UT: 61/61
Inspect each dataset path component before dereferencing it, and reject external and soft links with focused regression coverage. Co-Authored-By: Codex <[email protected]> AI-Model: gpt-5.6-sol Signed-off-by: biyan <[email protected]> Co-Authored-By: Codex <[email protected]> Co-Authored-By: Codex <[email protected]> AI-Contributed/Feature: 40/40 AI-Contributed/UT: 39/39
3819d45 to
e52b068
Compare
|
This pull request has been automatically marked as stale because it has not had 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. |
## Description Style and grammar pass on Ray Data docs against Ray's [writing-style guide](https://docs.ray.io/en/master/ray-contribute/writing-style.html). Prose only: no code, `literalinclude` blocks, URLs, anchors, or role targets changed. Stacked on #66412, which is stacked on #66381, #66375, and #66352. Review and merge those first. This branch targets `doc-1524-data-vale-cleanup`. It combines this PR's original comparisons-page pass with the custom datasource pass first opened as #66416. ### `comparisons.md` - Renames the legacy "Datasets" product name to "Ray Data". The page already used "Ray Data" for the same subject in the same lists. Third-party "Torch datasets" and "TensorFlow datasets" are unchanged. - Fixes `SageMaker` and `BentoML` casing, which #66412 left as intentional alerts for this pass. - Uses contractions, active voice, second person, and "such as" for examples. - Removes "our blog post", "3rd", "e.g.", mid-sentence colons, and semicolons. - Fixes the grammar of the BentoML-and-Spark sentence and subject-verb agreement for "TensorFlow datasets". - Sentence-cases the dropdown titles and makes them parallel. - Adds a lead-in sentence to each comparison list and uses the `**Term**: explanation` definition-list form from the style guide. - Collapses runs of blank lines between dropdowns to one. ### `custom-datasource-example.md` This is the page whose `<!-- vale off -->` blocks #66412 removed so the future-tense prose they hid could be fixed. - Replaces the three "you'll" future-tense sentences with present tense. - Names Ray Data as the actor in "file types that aren't natively supported" and "Images are already supported". - Replaces "functionality" with "behavior", "Once you've implemented" with "After you implement", and the "(for example, `"png"`)" parenthetical with "such as". - Cuts the time-relative "in the future" from the write-interface note but keeps "is under active development and might change", which is the stability warning. - Corrects the block types. The page said blocks can be dictionaries of NumPy arrays, but `Block` in `block.py` is only a PyArrow table or a pandas DataFrame, including at the commit the page links to. NumPy dictionaries are a batch format. This is a factual correction. - Sentence-cases the title: "Advanced: Read and write custom file types". - Updates the one link in `loading-data.md` whose text quotes the old title. ## Why this isn't a duplicate No other open PR edits `comparisons.md`, `custom-datasource-example.md`, or `doc_code/custom_datasource_example.py`. #55038 adds an experimental SQL API and SQL docs but doesn't edit these pages. See the related question below. I also checked the open Data PRs that mention datasources, including #65760, #57239, and #55467. ## Questions for reviewers Apart from the block-types correction, this pass kept the scope of every claim. These existing claims might be stale, and a Ray Data maintainer is better placed to judge them: - **Third-party feature claims on `comparisons.md`:** Petastorm supports only Parquet, NVTabular supports only Parquet, CSV, and Avro, TensorFlow datasets support only file interleaving across worker shards, and Torch datasets have no I/O layer. - **SQL interface:** "Ray Data doesn't have a SQL interface" would go stale if #55038 lands. - **Comparisons with no measure:** "a streaming paradigm that's better suited to GPU workloads" and "can't effectively handle large datasets". The style guide's "Keep comparisons precise" section applies, but no source for a measure is on the page. - **Repeated comparison points:** the training-ingest dropdowns repeat three points almost word for word. A single comparison table might read better. That moves content, so it isn't in this PR. - **Duplicate headings:** `custom-datasource-example.md` has two H3s named "Implement the constructor", one under reading and one under writing. "Implement the datasource constructor" and "Implement the datasink constructor" would make the right-side TOC clearer. I left them as they are. ## Verification - `vale` with Vale 3.12, run from the repo root: 0 alerts on `comparisons.md`, down from 24, and 0 on `custom-datasource-example.md`, down from 6. `loading-data.md` has no alerts on the edited line. - `codespell`: no hits. - The pre-commit hooks passed on each commit. - A structural check against each pre-edit file confirmed the code-fence count, role targets, anchors, and URLs are unchanged. - For the reworded title, a grep for inbound links found the `{ref}` in `loading-data.md`, updated here, and a toctree entry in `user-guide.md`, which doesn't depend on the title. No links use the heading's implicit slug. - I didn't run a local Sphinx build. The Read the Docs preview covers rendering. ## AI assistance I made these edits with AI assistance (Claude Code) and reviewed the full diff by hand. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
|
This pull request has been automatically closed because there has been no more activity in the 14 days 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! |
## Description Style and grammar pass on Ray Data docs against Ray's [writing-style guide](https://docs.ray.io/en/master/ray-contribute/writing-style.html). Prose only: no code, `literalinclude` blocks, URLs, anchors, or role targets changed. Stacked on ray-project#66412, which is stacked on ray-project#66381, ray-project#66375, and ray-project#66352. Review and merge those first. This branch targets `doc-1524-data-vale-cleanup`. It combines this PR's original comparisons-page pass with the custom datasource pass first opened as ray-project#66416. ### `comparisons.md` - Renames the legacy "Datasets" product name to "Ray Data". The page already used "Ray Data" for the same subject in the same lists. Third-party "Torch datasets" and "TensorFlow datasets" are unchanged. - Fixes `SageMaker` and `BentoML` casing, which ray-project#66412 left as intentional alerts for this pass. - Uses contractions, active voice, second person, and "such as" for examples. - Removes "our blog post", "3rd", "e.g.", mid-sentence colons, and semicolons. - Fixes the grammar of the BentoML-and-Spark sentence and subject-verb agreement for "TensorFlow datasets". - Sentence-cases the dropdown titles and makes them parallel. - Adds a lead-in sentence to each comparison list and uses the `**Term**: explanation` definition-list form from the style guide. - Collapses runs of blank lines between dropdowns to one. ### `custom-datasource-example.md` This is the page whose `<!-- vale off -->` blocks ray-project#66412 removed so the future-tense prose they hid could be fixed. - Replaces the three "you'll" future-tense sentences with present tense. - Names Ray Data as the actor in "file types that aren't natively supported" and "Images are already supported". - Replaces "functionality" with "behavior", "Once you've implemented" with "After you implement", and the "(for example, `"png"`)" parenthetical with "such as". - Cuts the time-relative "in the future" from the write-interface note but keeps "is under active development and might change", which is the stability warning. - Corrects the block types. The page said blocks can be dictionaries of NumPy arrays, but `Block` in `block.py` is only a PyArrow table or a pandas DataFrame, including at the commit the page links to. NumPy dictionaries are a batch format. This is a factual correction. - Sentence-cases the title: "Advanced: Read and write custom file types". - Updates the one link in `loading-data.md` whose text quotes the old title. ## Why this isn't a duplicate No other open PR edits `comparisons.md`, `custom-datasource-example.md`, or `doc_code/custom_datasource_example.py`. ray-project#55038 adds an experimental SQL API and SQL docs but doesn't edit these pages. See the related question below. I also checked the open Data PRs that mention datasources, including ray-project#65760, ray-project#57239, and ray-project#55467. ## Questions for reviewers Apart from the block-types correction, this pass kept the scope of every claim. These existing claims might be stale, and a Ray Data maintainer is better placed to judge them: - **Third-party feature claims on `comparisons.md`:** Petastorm supports only Parquet, NVTabular supports only Parquet, CSV, and Avro, TensorFlow datasets support only file interleaving across worker shards, and Torch datasets have no I/O layer. - **SQL interface:** "Ray Data doesn't have a SQL interface" would go stale if ray-project#55038 lands. - **Comparisons with no measure:** "a streaming paradigm that's better suited to GPU workloads" and "can't effectively handle large datasets". The style guide's "Keep comparisons precise" section applies, but no source for a measure is on the page. - **Repeated comparison points:** the training-ingest dropdowns repeat three points almost word for word. A single comparison table might read better. That moves content, so it isn't in this PR. - **Duplicate headings:** `custom-datasource-example.md` has two H3s named "Implement the constructor", one under reading and one under writing. "Implement the datasource constructor" and "Implement the datasink constructor" would make the right-side TOC clearer. I left them as they are. ## Verification - `vale` with Vale 3.12, run from the repo root: 0 alerts on `comparisons.md`, down from 24, and 0 on `custom-datasource-example.md`, down from 6. `loading-data.md` has no alerts on the edited line. - `codespell`: no hits. - The pre-commit hooks passed on each commit. - A structural check against each pre-edit file confirmed the code-fence count, role targets, anchors, and URLs are unchanged. - For the reworded title, a grep for inbound links found the `{ref}` in `loading-data.md`, updated here, and a toctree entry in `user-guide.md`, which doesn't depend on the title. No links use the heading's implicit slug. - I didn't run a local Sphinx build. The Read the Docs preview covers rendering. ## AI assistance I made these edits with AI assistance (Claude Code) and reviewed the full diff by hand. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>

Closes #65759.
Why
Ray Data doesn't currently have a native HDF5 reader. Users working with scientific, robotics, and machine-learning datasets must load HDF5 files on the driver or maintain a custom datasource.
This is not duplicate work: before implementation, open Ray issues and PRs were searched for
HDF5,read_hdf5, and related Ray Data datasource terms, and no equivalent open implementation was found. The integration shape follows the mergedread_lerobotwork in #63821.What changed
ray.data.read_hdf5API and documentation.FileBasedDatasourcethat maps the selected HDF5 dataset's first axis to Ray Dataset rows.h5pyRay Data test dependency.Tests
python -m pytest -q python/ray/data/tests/datasource/test_hdf5.py python/ray/data/tests/datasource/test_numpy.py— 45 passed.ruff check python/ray/data/_internal/datasource/hdf5_datasource.py python/ray/data/tests/datasource/test_hdf5.py python/ray/data/read_api.py— passed.python -m compileall -q python/ray/data/_internal/datasource/hdf5_datasource.py python/ray/data/read_api.py python/ray/data/tests/datasource/test_hdf5.py— passed.git diff --check— passed.Bazel wasn't available in the local environment. The repository pre-commit runner couldn't provision
ruff-pre-commitbecause PyPI was unreachable; the equivalent local Ruff checks above passed.AI assistance
AI assistance was used for research, implementation, tests, documentation, and iterative code review. This PR is intentionally opened as a draft and should not request maintainer review until the human submitter has reviewed every changed line and can explain and defend the change end-to-end, as required by the repository contribution policy.