Skip to content

[Data] Update docs for hash shuffle v2 - #65372

Merged
richardliaw merged 8 commits into
ray-project:masterfrom
owenowenisme:owenowenisme/Update-users-doc-for-shuffle-v2
Aug 15, 2026
Merged

richardliaw merged 8 commits into
ray-project:masterfrom
owenowenisme:owenowenisme/Update-users-doc-for-shuffle-v2

Conversation

@owenowenisme

@owenowenisme owenowenisme commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

Description

Update the part of shuffle v2 including:

  • Joins
  • Agg
  • Data internals
  • User knobs and new shuffle strategy

Related issues

Link related issues: "Fixes #1234", "Closes #1234", or "Related to #1234".

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

Signed-off-by: You-Cheng Lin <[email protected]>
@owenowenisme
owenowenisme requested review from a team as code owners August 11, 2026 15:13

@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 updates the Ray Data documentation to introduce and recommend the new Hash-shuffle v2 (ShuffleStrategy.HASH_SHUFFLE_V2) strategy, detailing its benefits, configuration, and tuning parameters. It also marks several older configurations and parameters as deprecated, such as partition_size_hint and use_push_based_shuffle. Feedback on the changes highlights an issue in doc/source/data/saving-data.rst where the code snippet still uses the older HASH_SHUFFLE strategy despite a comment recommending v2, and incorrectly assigns the strategy directly to the DataContext class instead of using DataContext.get_current().

Comment thread doc/source/data/saving-data.rst Outdated
Comment on lines +196 to +197
# Key-based repartitioning requires a hash-shuffle strategy.
# Prefer ShuffleStrategy.HASH_SHUFFLE_V2 for better performance.

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

The added comment recommends preferring ShuffleStrategy.HASH_SHUFFLE_V2 for better performance, but the code immediately following it on line 198 still uses ShuffleStrategy.HASH_SHUFFLE.\n\nAdditionally, assigning directly to the class attribute DataContext.shuffle_strategy is incorrect in Python because it overwrites the property descriptor on the class itself, breaking it for all instances. It should be set on the active context instance instead.\n\nPlease update the code on line 198 to use DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE_V2.

@dstrodtman dstrodtman 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.

Style and grammar review, Anyscale docs team

Run by Douglas Strodtman (@dstrodtman) on the Anyscale documentation team. Claude Code assisted in gathering context and drafting these comments; I read every one and stand behind each individually, per this repo's AGENTS.md disclosure requirement.

Scope: style, grammar, and Ray docs conventions only, measured against doc/source/ray-contribute/writing-style.md. I don't own Ray Data, so every claim about what hash-shuffle v2 actually does is yours to confirm. Where a suggestion touched a verifiable detail I checked it against source first and said so inline. Happy to give this a docs-side approval once the content questions below settle. Not requesting changes.

What I verified against source

So you don't have to re-derive it while reading the comments:

Claim in the PR Verdict
HASH_SHUFFLE is the default strategy Correct. DEFAULT_SHUFFLE_STRATEGY in python/ray/data/context.py:97
RAY_DATA_DEFAULT_SHUFFLE_STRATEGY=hash_shuffle_v2 Correct. Variable and enum value both match
shuffle_input_batch_bytes / RAY_DATA_SHUFFLE_INPUT_BATCH_BYTES, 1 GiB, v2-only, 0 disables All correct per context.py:117 and the DataContext docstring
max_direct_call_object_size default "100 KB" Units off. ray_config_def.h:245 is 100 * 1024, so 100 KiB. Same for 8192 as "8 KB"
v2 "supports the same operations as" v1 Correct. plan_all_to_all_op.py and grouped_data.py branch on v2 everywhere they branch on v1
partition_size_hint deprecated and ignored Correct per dataset.py:3181 and :3294
use_push_based_shuffle and RAY_DATA_PUSH_BASED_SHUFFLE deprecated Correct, both emit warnings

Vale runs on this path (.pre-commit-config.yaml scopes it to ^doc/source/data/.*\.(md|rst)$), and it's clean on the new content apart from the Google.WordList hit I flagged at line 135. Note that Google.Headings is disabled repo-wide, so heading case is a human check only.

Open questions for maintainers

  1. Should hash-shuffle v2 carry a version note? Hash-shuffling has one ("available in Ray 2.46"), and v2 has none, so a reader on an older release has no way to know whether the strategy exists for them. git tag --contains puts the HASH_SHUFFLE_V2 enum member's introducing commit (#64538, July 10) in ray-2.57.0 and no earlier tag. I'm deliberately not proposing that text as a suggestion, because when the feature became usable is a judgment only you can make.
  2. Fifth-level heading. "Tuning hash-shuffle v2" sits at ^^^, one level past the guide's limit. Details in the inline comment. Pre-existing structure, so declining is reasonable.
  3. Range-partitioning selection is now undocumented. Deleting the old note was right, since its "is a default" claim was stale. But it was also the only place telling readers how to request SORT_SHUFFLE_PULL_BASED. Worth a corrected one-liner.
  4. Admonition level on the push-based deprecation. note versus caution, plus its placement ahead of the section's own definition. Inline comment on shuffling-data.rst.

The larger ask: data-internals.rst wants a full pass, not a section-scoped one

The new hash-shuffle v2 section is cleaner prose than most of the page it lands in, which makes the surrounding text read worse by contrast. I'd suggest a follow-up PR doing a whole-file pass rather than growing this one, so the shuffle v2 content can merge on its own timeline. Deliberately out of scope here, and I'm happy to open that PR myself if you'd rather not spend the cycles.

What a full pass would cover:

  • Title-case headings. "Ray Data Internals" (line 7), "Shuffle Algorithms" (99), "Memory Model" (373). The guide requires sentence case throughout, and Google.Headings = No means nothing catches these.
  • Mixed Unicode and straight punctuation. 14 lines carry curly apostrophes and quotes (can’t, doesn’t, “what”), while the new content in this PR uses straight quotes. One file, two conventions.
  • Filler and informality in the shuffle sections. "(used in hash-tables and pretty much everywhere)" on line 116, "randomly sampled for (10) rows" on 215, "Range-partitioning based shuffle also is a classical algorithm" on 212.
  • Passive voice with a nameable actor. Vale reports 14 Google.Passive hits; several have an obvious subject, such as "rows with the same key-values are being placed into the same partition" (121).
  • "tradeoff" versus "trade-off." Line 66 uses one, the new content uses the other.
  • Trailing whitespace on eight lines (391, 404, 405, 413, 414, 418, 419, plus 153 in this PR's new text).
  • "Below is a summary" on line 350, which the guide replaces with "The following."

Separately, and bigger than a style pass: the guide says new pages should be MyST Markdown and that a lint check rejects newly added .rst. Converting this page would unlock the myst_heading_anchors and soft-wrap conventions the rest of the guide assumes. That's a real project rather than a review comment, so I mention it only as context for how much a style pass on the .rst can actually fix.

Comment thread doc/source/data/data-internals.rst Outdated
Comment on lines +123 to +127
.. note:: Hash-shuffle (``ShuffleStrategy.HASH_SHUFFLE``) is the default shuffle strategy for
key-based operations: aggregations, group-bys, key-based repartitioning, and joins. To set it
explicitly, specify
``ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE`` before
creating a ``Dataset``.

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.

Two small wording fixes in the reworked note. "group-bys" reads awkwardly as a plural, and line 120 already says "group-by operations," so matching it keeps the page consistent. Separately, "To set it explicitly, specify" doubles up on the verb.

I confirmed the substance: DEFAULT_SHUFFLE_STRATEGY in python/ray/data/context.py resolves to ShuffleStrategy.HASH_SHUFFLE, so "is the default" is correct.

Suggested change
.. note:: Hash-shuffle (``ShuffleStrategy.HASH_SHUFFLE``) is the default shuffle strategy for
key-based operations: aggregations, group-bys, key-based repartitioning, and joins. To set it
explicitly, specify
``ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE`` before
creating a ``Dataset``.
.. note:: Hash-shuffle (``ShuffleStrategy.HASH_SHUFFLE``) is the default shuffle strategy for
key-based operations: aggregations, group-by operations, key-based repartitioning, and joins.
To select it explicitly, set
``ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE`` before
creating a ``Dataset``.

Outside the diff, so no suggestion to click: line 105 still reads "Ray Data implements two main shuffle algorithms," but this PR adds a third ~~~ sibling under Shuffle Algorithms. The style guide asks you to state the count when you name a fixed set, so that line now undercounts. Either bump it to three or drop the number.

Comment thread doc/source/data/data-internals.rst Outdated
~~~~~~~~~~~~~~~

Hash-shuffle v2 (``ShuffleStrategy.HASH_SHUFFLE_V2``) is a task-based reimplementation of
hash-shuffling. Unlike the aggregator-actor model described above, hash-shuffle v2 doesn't push

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.

Vale flags this one (Google.WordList): "above" is a layout direction rather than a document relation, and it breaks in single-column renderings. "Preceding" or "earlier" is the Google-style replacement.

Suggested change
hash-shuffling. Unlike the aggregator-actor model described above, hash-shuffle v2 doesn't push
hash-shuffling. Unlike the preceding aggregator-actor model, hash-shuffle v2 doesn't push

Comment thread doc/source/data/data-internals.rst Outdated
Comment on lines +152 to +154
Hash-shuffle v2 is the recommended hash-shuffle strategy. It supports the same operations as the
default hash-shuffle strategy and generally performs better, with the largest gains on large, skewed,
or memory-intensive workloads.

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.

The style guide's "turn hedging into direct advice" rule wants a recommendation stated as one: "is the recommended X" softens what's actually a directive. Also fixes the trailing whitespace at the end of line 153 and drops one repetition of "hash-shuffle strategy."

Suggested change
Hash-shuffle v2 is the recommended hash-shuffle strategy. It supports the same operations as the
default hash-shuffle strategy and generally performs better, with the largest gains on large, skewed,
or memory-intensive workloads.
Use hash-shuffle v2 rather than the default hash-shuffle strategy. It supports the same operations
and generally performs better, with the largest gains on large, skewed, or memory-intensive
workloads.

Separate note, no fix proposed: "generally performs better" is the kind of vague comparison the guide asks you to make precise ("state what's better and by what measure"). I'm not going to invent a number. aggregating-data.rst already links the Anyscale hash-shuffle benchmark post, so pointing at a measurement here would be one option, but whether that data covers v2 is your call, not mine.

Comment thread doc/source/data/data-internals.rst Outdated
Comment on lines +156 to +161
To enable hash-shuffle v2 for the whole cluster, set the environment variable before starting your
application:

.. code-block:: bash

RAY_DATA_DEFAULT_SHUFFLE_STRATEGY=hash_shuffle_v2

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.

Two things. The lead-in says "set the environment variable" without naming it, so the reader has to look ahead to the block to find out which one. And a bare VAR=value line in a bash block sets the variable only for that shell, not for a process the reader launches afterward, which is exactly the case the sentence describes. export makes the snippet do what the prose promises.

I verified the variable and value: context.py reads RAY_DATA_DEFAULT_SHUFFLE_STRATEGY via os.environ.get, and ShuffleStrategy.HASH_SHUFFLE_V2 is the string "hash_shuffle_v2".

Suggested change
To enable hash-shuffle v2 for the whole cluster, set the environment variable before starting your
application:
.. code-block:: bash
RAY_DATA_DEFAULT_SHUFFLE_STRATEGY=hash_shuffle_v2
To make hash-shuffle v2 the cluster-wide default, set ``RAY_DATA_DEFAULT_SHUFFLE_STRATEGY`` before
starting your application:
.. code-block:: bash
export RAY_DATA_DEFAULT_SHUFFLE_STRATEGY=hash_shuffle_v2

Comment thread doc/source/data/data-internals.rst Outdated

.. _tuning-hash-shuffle-v2:

Tuning hash-shuffle v2

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.

Heading-depth flag, no suggestion because the fix is a structural call I'd rather leave to you.

This heading uses ^^^, which on this page is the fifth level: === (page title) > === Key concepts > --- Shuffle Algorithms > ~~~ Hash-shuffle v2 > ^^^ Tuning hash-shuffle v2. The style guide says to avoid nesting past the fourth level and treats reaching it as a signal to split the page.

You're inheriting that depth from the existing structure rather than creating it, so it's arguably pre-existing. If you'd rather not touch it here, that's reasonable. The lighter option is to fold the tuning content into the parent section as a bold definition list and keep the _tuning-hash-shuffle-v2 label on that block, which preserves every incoming :ref: in this PR.

Comment thread doc/source/data/joining-data.rst Outdated
Comment on lines +43 to +47
Internally joins are currently powered by the :ref:`hash-shuffle backend <hash-shuffle>`. Prefer
:ref:`hash-shuffle v2 <hash-shuffle-v2>` by setting the shuffle strategy before creating a
``Dataset``:
``ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE_V2``. See
:ref:`Tuning hash-shuffle v2 <tuning-hash-shuffle-v2>` for memory-related knobs.

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.

Three edits here:

  • "currently" is on the guide's avoid-time-relative-words list. It goes stale, and the sentence is true without it.
  • "are powered by" is passive with a nameable actor. "Joins use the hash-shuffle backend" is shorter and active.
  • "Prefer" to "Use," and "knobs" to "settings," matching the other pages.
Suggested change
Internally joins are currently powered by the :ref:`hash-shuffle backend <hash-shuffle>`. Prefer
:ref:`hash-shuffle v2 <hash-shuffle-v2>` by setting the shuffle strategy before creating a
``Dataset``:
``ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE_V2``. See
:ref:`Tuning hash-shuffle v2 <tuning-hash-shuffle-v2>` for memory-related knobs.
Internally, joins use the :ref:`hash-shuffle backend <hash-shuffle>`. Use
:ref:`hash-shuffle v2 <hash-shuffle-v2>` by setting the shuffle strategy before creating a
``Dataset``:
``ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE_V2``. See
:ref:`Tuning hash-shuffle v2 <tuning-hash-shuffle-v2>` for the memory-related settings.

Comment thread doc/source/data/joining-data.rst Outdated
- `partition_size_hint`: (optional) Hint to joining operator about the estimated avg expected size of the individual partition (in bytes). If not specified, defaults to DataContext.target_max_block_size (128Mb by default).
- Note that, `num_partitions * partition_size_hint` should ideally be approximating actual dataset size, ie `partition_size_hint` could be estimated as dataset size divided by `num_partitions` (assuming relatively evenly sized partitions)
- However, in cases when dataset partitioning is expected to be heavily skewed `partition_size_hint` should approximate largest partition to prevent Out-of-Memory (OOM) errors
- `partition_size_hint`: (**deprecated**) Hint to the joining operator about the estimated avg expected size of the individual partition (in bytes). This parameter is deprecated and ignored (the hash-shuffle v2 join path sizes reduce-task memory from observed partition sizes), and it will be removed in a future release.

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.

This bullet packs a nested parenthetical inside a sentence that's already carrying three clauses, and "avg" is an abbreviation the guide would spell out. Splitting it into three short sentences makes the deprecation the first thing the reader sees.

The substance checks out against python/ray/data/dataset.py:3181 and :3294, which document it as deprecated and ignored and warn on use.

Suggested change
- `partition_size_hint`: (**deprecated**) Hint to the joining operator about the estimated avg expected size of the individual partition (in bytes). This parameter is deprecated and ignored (the hash-shuffle v2 join path sizes reduce-task memory from observed partition sizes), and it will be removed in a future release.
- `partition_size_hint`: (**deprecated**) Hint to the joining operator about the estimated average size of an individual partition, in bytes. Ray Data ignores this parameter, and a future release removes it. The hash-shuffle v2 join path sizes reduce-task memory from observed partition sizes instead.

Comment thread doc/source/data/saving-data.rst Outdated
Comment on lines 196 to 198
# Key-based repartitioning requires a hash-shuffle strategy.
# Prefer ShuffleStrategy.HASH_SHUFFLE_V2 for better performance.
DataContext.shuffle_strategy=ShuffleStrategy.HASH_SHUFFLE

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.

Agreeing with the point @gemini-code-assist already raised on these lines rather than filing it fresh, and I checked it against source before signing on.

The bot is right on both counts. DataContext.shuffle_strategy is a property with a setter (python/ray/data/context.py:1210, :1222), so assigning to it on the class object replaces the descriptor itself and breaks the attribute for every instance. And a comment that recommends v2 sitting directly above a line that sets v1 leaves the reader guessing which one to copy. Since the snippet is a tested testcode block, better to just set what the docs recommend and drop the second comment.

DataContext and ShuffleStrategy are both already imported at the top of this block, so this needs no import change.

Suggested change
# Key-based repartitioning requires a hash-shuffle strategy.
# Prefer ShuffleStrategy.HASH_SHUFFLE_V2 for better performance.
DataContext.shuffle_strategy=ShuffleStrategy.HASH_SHUFFLE
# Key-based repartitioning requires a hash-shuffle strategy.
DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE_V2

Comment thread doc/source/data/shuffling-data.rst Outdated
Comment on lines +234 to +244
Prefer :ref:`hash-shuffle v2 <hash-shuffle-v2>` (``ShuffleStrategy.HASH_SHUFFLE_V2``), an
improved hash-shuffle implementation that generally performs better than the default
hash-shuffle strategy:

.. code-block:: python

from ray.data.context import DataContext, ShuffleStrategy

DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE_V2

See :ref:`Tuning hash-shuffle v2 <tuning-hash-shuffle-v2>` for the available knobs.

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.

Same "Prefer" to "Use" and "knobs" to "settings" edits as the other pages. Splitting the appositive into its own sentence also keeps the lead-in short, which the guide prefers over stacking clauses.

Suggested change
Prefer :ref:`hash-shuffle v2 <hash-shuffle-v2>` (``ShuffleStrategy.HASH_SHUFFLE_V2``), an
improved hash-shuffle implementation that generally performs better than the default
hash-shuffle strategy:
.. code-block:: python
from ray.data.context import DataContext, ShuffleStrategy
DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE_V2
See :ref:`Tuning hash-shuffle v2 <tuning-hash-shuffle-v2>` for the available knobs.
Use :ref:`hash-shuffle v2 <hash-shuffle-v2>` (``ShuffleStrategy.HASH_SHUFFLE_V2``) instead. It's an
improved hash-shuffle implementation that generally performs better than the default
hash-shuffle strategy:
.. code-block:: python
from ray.data.context import DataContext, ShuffleStrategy
DataContext.get_current().shuffle_strategy = ShuffleStrategy.HASH_SHUFFLE_V2
See :ref:`Tuning hash-shuffle v2 <tuning-hash-shuffle-v2>` for the available settings.

Comment on lines +278 to +280
.. note:: ``DataContext.use_push_based_shuffle`` and the ``RAY_DATA_PUSH_BASED_SHUFFLE`` environment
variable are deprecated. Configure the shuffle strategy through ``DataContext.shuffle_strategy``
(for example, ``ShuffleStrategy.SORT_SHUFFLE_PUSH_BASED``) instead.

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.

Placement rather than wording, so no suggestion: the fix runs past the end of the diff hunk and I can't anchor it cleanly.

This note lands between the heading and the prose that defines what push-based shuffle is. A reader who arrives at Enabling push-based shuffle from the TOC hits a deprecation of two settings before learning what the section covers. Moving it to just after the paragraph that ends on line 286 keeps the same information and reads in order.

Worth also settling the admonition level. The guide maps note to supporting information and caution to something that needs care. A deprecation with a named replacement is arguably caution, since acting on the current text sends readers to an API that emits a DeprecationWarning. Your call, but flagging it since the whole section documents the deprecated path.

The content itself is accurate: context.py:1082 warns that use_push_based_shuffle is deprecated in favor of shuffle_strategy, and _deduce_default_shuffle_algorithm warns that RAY_DATA_PUSH_BASED_SHUFFLE is deprecated in favor of RAY_DATA_DEFAULT_SHUFFLE_STRATEGY.

@owenowenisme
owenowenisme marked this pull request as draft August 11, 2026 15:43
@dstrodtman

Copy link
Copy Markdown
Contributor

Correcting one claim from my review above before anyone acts on it. I found this while doing the follow-up cleanup, not from anyone's feedback.

I wrote that Vale runs on this path "because .pre-commit-config.yaml scopes it to ^doc/source/data/.*\.(md|rst)$." The conclusion is right, the mechanism I named is wrong, and the difference is actionable.

The pre-commit Vale hook never runs on these files. .pre-commit-config.yaml has a top-level exclude that covers doc/source/, and pre-commit applies the global exclude on top of each hook's own files: pattern. Since the Vale hook's pattern lives entirely inside doc/source/data/, the two can't both be satisfied and the hook matches zero files. pre-commit run vale --all-files reports "no files to check", and so does a commit touching only data-internals.rst.

Vale does still gate these pages, from CI. The lint: documentation_style step in .buildkite/lint.rayci.yml calls ci/lint/check-documentation-style.sh, which runs vale doc/source/data doc/source/ray-overview/examples against Vale pinned at v3.4.1.

Two practical consequences for this PR:

  • Running pre-commit locally tells you nothing about Vale. Run vale doc/source/data/<file> directly instead.
  • My alert counts came from Vale 3.12.0 locally, which is newer than CI's pinned 3.4.1. Treat them as indicative rather than exact.

Nothing else in the review depends on this. The Google.WordList hit I flagged at line 135 came from running Vale directly, so it stands, as does everything I verified against source.

Separately, since it's adjacent: the dead pre-commit hook looks like a genuine (and pre-existing) configuration bug rather than intent, given that someone deliberately wrote a doc/source/data/ scope for it. Happy to file it or send a fix as its own PR if that's useful, but it's well outside this PR and entirely your call.

@owenowenisme owenowenisme added docs An issue or change related to documentation data Ray Data-related issues go add ONLY when ready to merge, run all tests labels Aug 14, 2026
@owenowenisme
owenowenisme marked this pull request as ready for review August 14, 2026 08:33

@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 updates the Ray Data documentation to introduce and recommend 'hash-shuffle v2' as the preferred shuffle strategy for aggregations, joins, and repartitioning operations. It also marks the 'partition_size_hint' parameter as deprecated and clarifies the deprecation of push-based shuffle configuration. The review feedback identified potential 'NameError' issues in documentation code snippets due to missing imports and suggested using string literals for better usability. Additionally, a correction was requested for the 'saving-data.rst' file to ensure the shuffle strategy is set on the active 'DataContext' instance rather than the class itself.

Comment thread doc/source/data/aggregating-data.rst Outdated
Comment on lines +169 to +170
Prefer :ref:`hash-shuffle v2 <hash-shuffle-v2>` for aggregations. Set the shuffle strategy before creating a ``Dataset``:
``ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.SHUFFLE_V2``. See :ref:`Tuning hash-shuffle v2 <tuning-hash-shuffle-v2>` for the available knobs.

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

The inline code snippet uses ShuffleStrategy.SHUFFLE_V2 directly, which will raise a NameError if copy-pasted because ShuffleStrategy is not imported or available in the global namespace. Since DataContext.shuffle_strategy accepts string values, using the string "shuffle_v2" is more self-contained and user-friendly for inline documentation.

Suggested change
Prefer :ref:`hash-shuffle v2 <hash-shuffle-v2>` for aggregations. Set the shuffle strategy before creating a ``Dataset``:
``ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.SHUFFLE_V2``. See :ref:`Tuning hash-shuffle v2 <tuning-hash-shuffle-v2>` for the available knobs.
Prefer :ref:`hash-shuffle v2 <hash-shuffle-v2>` for aggregations. Set the shuffle strategy before creating a ``Dataset``:
``ray.data.DataContext.get_current().shuffle_strategy = "shuffle_v2"``. See :ref:`Tuning hash-shuffle v2 <tuning-hash-shuffle-v2>` for the available knobs.

Internally joins are currently powered by the :ref:`hash-shuffle backend <hash-shuffle>`. Prefer
:ref:`hash-shuffle v2 <hash-shuffle-v2>` by setting the shuffle strategy before creating a
``Dataset``:
``ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.SHUFFLE_V2``. See

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

Using ShuffleStrategy.SHUFFLE_V2 directly in inline code will cause a NameError for users copy-pasting the snippet. Using the string "shuffle_v2" is self-contained and avoids this issue.

Suggested change
``ray.data.DataContext.get_current().shuffle_strategy = ShuffleStrategy.SHUFFLE_V2``. See
``ray.data.DataContext.get_current().shuffle_strategy = "shuffle_v2"``. See

Comment thread doc/source/data/saving-data.rst Outdated
Comment on lines 199 to 201
# Key-based repartitioning requires a hash-shuffle strategy.
# Prefer ShuffleStrategy.SHUFFLE_V2 for better performance.
DataContext.shuffle_strategy=ShuffleStrategy.HASH_SHUFFLE

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

Assigning DataContext.shuffle_strategy = ... directly on the class overwrites the property descriptor instead of calling the setter on the active context instance. It must be set on DataContext.get_current(). Additionally, since the comment recommends SHUFFLE_V2, we should update the code to actually use ShuffleStrategy.SHUFFLE_V2.

Suggested change
# Key-based repartitioning requires a hash-shuffle strategy.
# Prefer ShuffleStrategy.SHUFFLE_V2 for better performance.
DataContext.shuffle_strategy=ShuffleStrategy.HASH_SHUFFLE
# Key-based repartitioning requires a hash-shuffle strategy.
# Prefer ShuffleStrategy.SHUFFLE_V2 for better performance.
from ray.data.context import DataContext, ShuffleStrategy
DataContext.get_current().shuffle_strategy = ShuffleStrategy.SHUFFLE_V2

Signed-off-by: You-Cheng Lin <[email protected]>
dstrodtman added a commit that referenced this pull request Aug 14, 2026
…65375)

## Description

Two related fixes to the Vale setup.

### 1. The `vale` pre-commit hook has never run

The top-level `exclude` in `.pre-commit-config.yaml` lists
`doc/source/`, and pre-commit ANDs that global `exclude` with each
hook's own `files` pattern. The Vale hook's pattern,
`^doc/source/data/.*\.(md|rst)$`, lives entirely inside `doc/source/`,
so the two can never both be satisfied and the hook matches zero files:

```
$ pre-commit run vale --all-files
vale.................................................(no files to check)Skipped
```

Committing a change under `doc/source/data` skips it silently too. Vale
still ran in CI through `ci/lint/check-documentation-style.sh`, so the
gate existed, but contributors got no local signal, and a green
pre-commit run said nothing at all about Vale.

This narrows the `doc/source/` entry to
`doc/source/(?!data/.*[.](md|rst)$)`, so it keeps excluding the tree
except the prose the hook targets.

Narrowing it also exposes those 48 files to hooks that had never seen
them. Three needed exemptions, all recorded in the config with comments:

* `trailing-whitespace` and `end-of-file-fixer` would rewrite 17
unrelated files. I've exempted those two hooks from `doc/source/data` so
that enabling Vale stays a config-only change. **The whitespace cleanup
is worth doing, and I'm happy to send it as its own PR** rather than
bury it here, partly because three of those 17 files are also touched by
the open #65372. * `semgrep` would fail. Caught by Cursor Bugbot, and it
was right. `semgrep.yml`'s `code-block-python` rule lists
`doc/source/data/**/*.rst` in its `paths.include` at `severity: ERROR`,
there are 8 pre-existing violations across 5 files, and
`ci/lint/lint.sh` runs `pre-commit run semgrep --all-files` as the
`semgrep_lint` step. Converting those code blocks to `testcode` is real
work that belongs in its own PR, not in a Vale change.

The two rST hooks that also become eligible pass as-is. If you'd rather
just take the whitespace churn here, say so and I'll fold it in.

**A bigger finding, which I'm raising rather than fixing here.** That
`semgrep` exemption is a second instance of the same bug, not a new one.
Because the top-level `exclude` has covered `doc/source/`, the
`code-block-python` rule has never run on **any** of the five doc paths
it targets: 31 occurrences across 16 files in `doc/source/data`,
`ray-core`, `ray-observability`, and `train`. Every one is an untested
documentation snippet the rule was written to catch. Happy to take that
on as a follow-up, but converting snippets means they start executing in
CI, so it wants a maintainer opinion on scope and on whether the rule is
still wanted for docs at all.

### 2. Vale was pinned to 3.4.1, from June 2024

This upgrades both the hook `rev` and the CI script to 3.17.1. The bump
isn't inert, so three supporting changes come with it.

`Vale.Spelling` produces **no alerts at all** under 3.4.1, but 11
error-severity alerts under 3.17.1, because the newer engine
word-boundary-anchors vocabulary patterns. Existing entries such as
`[Bb]ackpressure`, `dtype`, and `namespace` therefore stopped covering
`backpressured`, `dtypes`, and `namespaces`. This widens those three and
adds terms that were never listed at all: `Databricks`, `Datasink`,
`Multimodality`, `preprocess`, `resample`, `vCPU`, `Vectorizer`.

Two Google rules also became error-severity on content where they're
wrong, so they're set to `warning` rather than editing correct prose:

* `Google.HeadingPunctuation` reads the period in a numbered heading
such as `### 1. Label your worker nodes` as a heading-ending period. The
match it reports is literally `1.`.
* `Google.OxfordComma` fires on "X, A and B" where A and B modify X
rather than continuing a list, as in "resources used by all operators,
active and requested".

Both follow the existing precedent of tuning Google rules in `.vale.ini`
alongside `Google.Colons` and `Google.Headings`, and both preserve
3.4.1's effective behavior, where neither rule blocked.

## Related issues

None. Cross-referencing two of my own open PRs that touch adjacent
surfaces, neither of which shares a file with this one:

* #65368 removes the banned-words lint in favor of Vale. That increases
how much Ray leans on Vale, which makes a dead local hook and a
two-year-old pin more worth fixing. Touches
`ci/lint/check-banned-words.sh`, `ci/lint/lint.sh`, and
`.buildkite/lint.rayci.yml`.
* #65342 makes the docs-go scope guard count Vale configuration as
documentation content. Worth noting that after it merges, a
Vale-config-only PR like this one would classify as documentation.
Touches `ci/lint/validate_docs_go_scope.sh`.

## Additional information

**AI assistance was used.** I used Claude Code to investigate and draft
this. I reviewed every changed line, ran the measurements below myself,
and can defend the change end to end.

**Not a duplicate.** `gh pr list --repo ray-project/ray --state open
--search "vale in:title"` and the same for `pre-commit` return only
#65368 and #65342 above, which change different files and have different
goals.

**Measurements**, on the exact set
`ci/lint/check-documentation-style.sh` lints (`doc/source/data` and
`doc/source/ray-overview/examples`):

| Vale | Total alerts | Error-severity | Exit code | Lint step |
|---|---|---|---|---|
| 3.4.1 (current pin) | 162 | 0 | 0 | green |
| 3.17.1, bump alone | 208 | 14 | 1 | **red** |
| 3.17.1, with this PR | 196 | 0 | 0 | green |

That middle row is the reason the vocabulary and `.vale.ini` changes are
in the same PR as the version bump: without them the bump turns `lint:
documentation_style` red.

**Checks run locally:**

```
# the CI script's exact target set, both versions
vale doc/source/data doc/source/ray-overview/examples   # 3.4.1 -> exit 0; 3.17.1 pre-fix -> exit 1; post-fix -> exit 0

# the hook now actually matches files and passes
pre-commit run vale --files doc/source/data/data-internals.rst
#   vale.....................................................................Passed

# and genuinely fails, rather than passing vacuously: appended a line
# containing "This sentance has a deliberate spelling mistake."
pre-commit run vale --files doc/source/data/data-internals.rst
#   349:6  error  Did you really mean 'sentance'?  Vale.Spelling
#   1 error, 0 warnings and 17 suggestions in 1 file.

# the two hooks I exempted stay exempt, so no file churn
pre-commit run trailing-whitespace --files $(git ls-files 'doc/source/data' | grep -E '\.(md|rst)$')
pre-commit run end-of-file-fixer   --files $(git ls-files 'doc/source/data' | grep -E '\.(md|rst)$')
#   both: (no files to check)Skipped

# the two rST hooks that newly become eligible
pre-commit run rst-directive-colons      --files ...   # Passed
pre-commit run rst-inline-touching-normal --files ...   # Passed
```

I also confirmed the 3.17.1 release publishes the two asset filenames
the CI script downloads, `vale_3.17.1_Linux_64-bit.tar.gz` and
`vale_3.17.1_macOS_arm64.tar.gz`.

**Net effect:** contributors get Vale locally, CI runs a Vale two years
newer, and `Vale.Spelling` becomes an enforced check instead of a silent
one.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Comment thread doc/source/data/data-internals.rst Resolved
Comment thread doc/source/data/saving-data.rst Resolved
coarse-grained.
- Set the threshold to ``0`` to disable batching and partition each input bundle individually.

**Inline object threshold** (``max_direct_call_object_size``, environment variable

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.

should we just be changing the default for all of ray data?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I guess this can slightly regress in certain use cases e.g. small scale, we can discuss this some where else

Comment thread doc/source/data/data-internals.rst Resolved
Comment thread doc/source/data/data-internals.rst Resolved
Comment thread doc/source/data/aggregating-data.rst Resolved
Comment thread doc/source/data/data-internals.rst Resolved
Comment thread doc/source/data/data-internals.rst Resolved
Comment thread doc/source/data/data-internals.rst Resolved
Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: You-Cheng Lin <[email protected]>
Comment thread doc/source/data/data-internals.rst Resolved
Comment thread doc/source/data/data-internals.rst Resolved
Comment thread doc/source/data/joining-data.rst Outdated

- `num_partitions`: (required) specifies number of partitions both incoming datasets will be hash-partitioned into. Check out :ref:`configuring number of partitions <joins_configuring_num_partitions>` section for guidance on how to tune this up.
- `partition_size_hint`: (optional) Hint to joining operator about the estimated avg expected size of the individual partition (in bytes). If not specified, defaults to DataContext.target_max_block_size (128Mb by default).
- `partition_size_hint`: (optional) Hint to joining operator about the estimated avg expected size of the individual partition (in bytes). If not specified, defaults to DataContext.target_max_block_size (128Mb by default). **Deprecated:** a future release removes this parameter.

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.

Suggested change
- `partition_size_hint`: (optional) Hint to joining operator about the estimated avg expected size of the individual partition (in bytes). If not specified, defaults to DataContext.target_max_block_size (128Mb by default). **Deprecated:** a future release removes this parameter.
- `partition_size_hint`: (optional) Hint to joining operator about the estimated avg expected size of the individual partition (in bytes). If not specified, defaults to DataContext.target_max_block_size (128Mb by default). **Deprecated:** this parameter will be removed in a future release

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Vale will error on "will"

owenowenisme and others added 2 commits August 14, 2026 20:06
Co-authored-by: Richard Liaw <[email protected]>
Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: You-Cheng Lin <[email protected]>
@richardliaw
richardliaw merged commit fd223b6 into ray-project:master Aug 15, 2026
6 checks passed
dstrodtman added a commit to dstrodtman/ray that referenced this pull request Aug 17, 2026
…ct#65372

Lowercase the alpha stage name per the style guide, drop the time-relative
'currently', correct 100 KB and 8 KB to KiB against the actual 100 * 1024 and
8192 values, turn the two bold-as-heading settings into definition-list form,
name the environment variable in the lead-in and export it so the snippet
matches what the prose promises, and align 'group-bys' and 'knobs' with the
wording used elsewhere on the page.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Aug 17, 2026
## Summary

Three claims on the Ray Data join and save pages don't match the code.
This PR corrects only those claims, deliberately leaving the surrounding
prose alone so the diff is small enough to review as a technical
question rather than a wording one.

Each correction is cited below. I don't own Ray Data, so please check
the reasoning rather than the phrasing.

## 1. `saving-data.rst` sets the shuffle strategy on the class, not the
context

```python
DataContext.shuffle_strategy=ShuffleStrategy.SHUFFLE_V2   # before
DataContext.get_current().shuffle_strategy = ShuffleStrategy.SHUFFLE_V2   # after
```

`shuffle_strategy` is a `property` with a setter
(`python/ray/data/context.py`, the `@property` at ~L1246 and
`@shuffle_strategy.setter` at ~L1258). Assigning to it on the class
object rebinds the class attribute over the descriptor instead of
invoking the setter. Two consequences: the example never actually
selects the strategy it says it's selecting, and `shuffle_strategy`
stops working for every `DataContext` instance in that process.

This is a `testcode` block, so it runs in CI. Note that because the
assignment never took effect, the block has so far only ever exercised
the default `HASH_SHUFFLE`. With the fix it genuinely runs `SHUFFLE_V2`
for the first time. I don't have a Ray build locally, so **please
confirm that job passes** rather than taking my word for it. If
`SHUFFLE_V2` isn't ready to be load-bearing in a doctest, setting
`HASH_SHUFFLE` on `get_current()` would fix the descriptor bug without
that exposure.

@gemini-code-assist flagged this on two separate passes (#65372); the
value got updated to `SHUFFLE_V2` but the receiver didn't.

## 2. `partition_size_hint` is documented as a live tuning parameter

The page described it as `(optional)`, gave it a default of
`DataContext.target_max_block_size`, and offered two bullets on how to
size it for skew. But `Dataset.join` documents it as "**Deprecated** and
ignored ... This parameter has no effect and will be removed in a future
release" (`python/ray/data/dataset.py` ~L3601), and passing a value
emits a `DeprecationWarning` (~L3712).

So the guidance told readers how to tune something inert. I removed the
sizing advice rather than rewriting it, since there's nothing to tune.

The page also said "Expect this parameter to be deprecated in 2.58."
That deprecation has already landed, so the sentence was predicting the
past.

## 3. The aggregator pool doesn't default to 64

The page said "Defaults to 64 or `num_partitions` (in cases when there
are less than 64 partitions)."

From `_derive_max_shuffle_aggregators` and its caller in
`python/ray/data/_internal/execution/operators/hash_shuffle.py` (~L485
and ~L591):

```
num_aggregators = min(target_num_partitions, max_shuffle_aggregators)
max_shuffle_aggregators = min(ceil(total_cluster_cpu),
                              max_hash_shuffle_aggregators or DEFAULT_MAX_HASH_SHUFFLE_AGGREGATORS)
```

`DEFAULT_MAX_HASH_SHUFFLE_AGGREGATORS` is 128 (`context.py` ~L128). So
the cap is 128 rather than 64, and there's a cluster-CPU bound the page
never mentioned.

**One thing worth a maintainer's eye:** the comment on the
`max_hash_shuffle_aggregators` field (`context.py` ~L886) says the unset
default is the smaller of "Total # of CPUs available in the cluster * 2"
and 128. The code has no `* 2`. I documented the code, not the comment,
but one of the two is stale and I can't tell which is intended.

## Out of scope

These pages have wider style and prose issues, plus a genuine RST
rendering bug in the join-type lists. Those are handled separately in
#65374 so this PR stays reviewable as a technical correction. #65374
touches the same region of `joining-data.rst`, so whichever merges
second needs a trivial rebase.

Signed-off-by: Douglas Strodtman <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…ay-project#65375)

## Description

Two related fixes to the Vale setup.

### 1. The `vale` pre-commit hook has never run

The top-level `exclude` in `.pre-commit-config.yaml` lists
`doc/source/`, and pre-commit ANDs that global `exclude` with each
hook's own `files` pattern. The Vale hook's pattern,
`^doc/source/data/.*\.(md|rst)$`, lives entirely inside `doc/source/`,
so the two can never both be satisfied and the hook matches zero files:

```
$ pre-commit run vale --all-files
vale.................................................(no files to check)Skipped
```

Committing a change under `doc/source/data` skips it silently too. Vale
still ran in CI through `ci/lint/check-documentation-style.sh`, so the
gate existed, but contributors got no local signal, and a green
pre-commit run said nothing at all about Vale.

This narrows the `doc/source/` entry to
`doc/source/(?!data/.*[.](md|rst)$)`, so it keeps excluding the tree
except the prose the hook targets.

Narrowing it also exposes those 48 files to hooks that had never seen
them. Three needed exemptions, all recorded in the config with comments:

* `trailing-whitespace` and `end-of-file-fixer` would rewrite 17
unrelated files. I've exempted those two hooks from `doc/source/data` so
that enabling Vale stays a config-only change. **The whitespace cleanup
is worth doing, and I'm happy to send it as its own PR** rather than
bury it here, partly because three of those 17 files are also touched by
the open ray-project#65372. * `semgrep` would fail. Caught by Cursor Bugbot, and it
was right. `semgrep.yml`'s `code-block-python` rule lists
`doc/source/data/**/*.rst` in its `paths.include` at `severity: ERROR`,
there are 8 pre-existing violations across 5 files, and
`ci/lint/lint.sh` runs `pre-commit run semgrep --all-files` as the
`semgrep_lint` step. Converting those code blocks to `testcode` is real
work that belongs in its own PR, not in a Vale change.

The two rST hooks that also become eligible pass as-is. If you'd rather
just take the whitespace churn here, say so and I'll fold it in.

**A bigger finding, which I'm raising rather than fixing here.** That
`semgrep` exemption is a second instance of the same bug, not a new one.
Because the top-level `exclude` has covered `doc/source/`, the
`code-block-python` rule has never run on **any** of the five doc paths
it targets: 31 occurrences across 16 files in `doc/source/data`,
`ray-core`, `ray-observability`, and `train`. Every one is an untested
documentation snippet the rule was written to catch. Happy to take that
on as a follow-up, but converting snippets means they start executing in
CI, so it wants a maintainer opinion on scope and on whether the rule is
still wanted for docs at all.

### 2. Vale was pinned to 3.4.1, from June 2024

This upgrades both the hook `rev` and the CI script to 3.17.1. The bump
isn't inert, so three supporting changes come with it.

`Vale.Spelling` produces **no alerts at all** under 3.4.1, but 11
error-severity alerts under 3.17.1, because the newer engine
word-boundary-anchors vocabulary patterns. Existing entries such as
`[Bb]ackpressure`, `dtype`, and `namespace` therefore stopped covering
`backpressured`, `dtypes`, and `namespaces`. This widens those three and
adds terms that were never listed at all: `Databricks`, `Datasink`,
`Multimodality`, `preprocess`, `resample`, `vCPU`, `Vectorizer`.

Two Google rules also became error-severity on content where they're
wrong, so they're set to `warning` rather than editing correct prose:

* `Google.HeadingPunctuation` reads the period in a numbered heading
such as `### 1. Label your worker nodes` as a heading-ending period. The
match it reports is literally `1.`.
* `Google.OxfordComma` fires on "X, A and B" where A and B modify X
rather than continuing a list, as in "resources used by all operators,
active and requested".

Both follow the existing precedent of tuning Google rules in `.vale.ini`
alongside `Google.Colons` and `Google.Headings`, and both preserve
3.4.1's effective behavior, where neither rule blocked.

## Related issues

None. Cross-referencing two of my own open PRs that touch adjacent
surfaces, neither of which shares a file with this one:

* ray-project#65368 removes the banned-words lint in favor of Vale. That increases
how much Ray leans on Vale, which makes a dead local hook and a
two-year-old pin more worth fixing. Touches
`ci/lint/check-banned-words.sh`, `ci/lint/lint.sh`, and
`.buildkite/lint.rayci.yml`.
* ray-project#65342 makes the docs-go scope guard count Vale configuration as
documentation content. Worth noting that after it merges, a
Vale-config-only PR like this one would classify as documentation.
Touches `ci/lint/validate_docs_go_scope.sh`.

## Additional information

**AI assistance was used.** I used Claude Code to investigate and draft
this. I reviewed every changed line, ran the measurements below myself,
and can defend the change end to end.

**Not a duplicate.** `gh pr list --repo ray-project/ray --state open
--search "vale in:title"` and the same for `pre-commit` return only
ray-project#65368 and ray-project#65342 above, which change different files and have different
goals.

**Measurements**, on the exact set
`ci/lint/check-documentation-style.sh` lints (`doc/source/data` and
`doc/source/ray-overview/examples`):

| Vale | Total alerts | Error-severity | Exit code | Lint step |
|---|---|---|---|---|
| 3.4.1 (current pin) | 162 | 0 | 0 | green |
| 3.17.1, bump alone | 208 | 14 | 1 | **red** |
| 3.17.1, with this PR | 196 | 0 | 0 | green |

That middle row is the reason the vocabulary and `.vale.ini` changes are
in the same PR as the version bump: without them the bump turns `lint:
documentation_style` red.

**Checks run locally:**

```
# the CI script's exact target set, both versions
vale doc/source/data doc/source/ray-overview/examples   # 3.4.1 -> exit 0; 3.17.1 pre-fix -> exit 1; post-fix -> exit 0

# the hook now actually matches files and passes
pre-commit run vale --files doc/source/data/data-internals.rst
#   vale.....................................................................Passed

# and genuinely fails, rather than passing vacuously: appended a line
# containing "This sentance has a deliberate spelling mistake."
pre-commit run vale --files doc/source/data/data-internals.rst
#   349:6  error  Did you really mean 'sentance'?  Vale.Spelling
#   1 error, 0 warnings and 17 suggestions in 1 file.

# the two hooks I exempted stay exempt, so no file churn
pre-commit run trailing-whitespace --files $(git ls-files 'doc/source/data' | grep -E '\.(md|rst)$')
pre-commit run end-of-file-fixer   --files $(git ls-files 'doc/source/data' | grep -E '\.(md|rst)$')
#   both: (no files to check)Skipped

# the two rST hooks that newly become eligible
pre-commit run rst-directive-colons      --files ...   # Passed
pre-commit run rst-inline-touching-normal --files ...   # Passed
```

I also confirmed the 3.17.1 release publishes the two asset filenames
the CI script downloads, `vale_3.17.1_Linux_64-bit.tar.gz` and
`vale_3.17.1_macOS_arm64.tar.gz`.

**Net effect:** contributors get Vale locally, CI runs a Vale two years
newer, and `Vale.Spelling` becomes an enforced check instead of a silent
one.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…ject#65525)

## Summary

Three claims on the Ray Data join and save pages don't match the code.
This PR corrects only those claims, deliberately leaving the surrounding
prose alone so the diff is small enough to review as a technical
question rather than a wording one.

Each correction is cited below. I don't own Ray Data, so please check
the reasoning rather than the phrasing.

## 1. `saving-data.rst` sets the shuffle strategy on the class, not the
context

```python
DataContext.shuffle_strategy=ShuffleStrategy.SHUFFLE_V2   # before
DataContext.get_current().shuffle_strategy = ShuffleStrategy.SHUFFLE_V2   # after
```

`shuffle_strategy` is a `property` with a setter
(`python/ray/data/context.py`, the `@property` at ~L1246 and
`@shuffle_strategy.setter` at ~L1258). Assigning to it on the class
object rebinds the class attribute over the descriptor instead of
invoking the setter. Two consequences: the example never actually
selects the strategy it says it's selecting, and `shuffle_strategy`
stops working for every `DataContext` instance in that process.

This is a `testcode` block, so it runs in CI. Note that because the
assignment never took effect, the block has so far only ever exercised
the default `HASH_SHUFFLE`. With the fix it genuinely runs `SHUFFLE_V2`
for the first time. I don't have a Ray build locally, so **please
confirm that job passes** rather than taking my word for it. If
`SHUFFLE_V2` isn't ready to be load-bearing in a doctest, setting
`HASH_SHUFFLE` on `get_current()` would fix the descriptor bug without
that exposure.

@gemini-code-assist flagged this on two separate passes (ray-project#65372); the
value got updated to `SHUFFLE_V2` but the receiver didn't.

## 2. `partition_size_hint` is documented as a live tuning parameter

The page described it as `(optional)`, gave it a default of
`DataContext.target_max_block_size`, and offered two bullets on how to
size it for skew. But `Dataset.join` documents it as "**Deprecated** and
ignored ... This parameter has no effect and will be removed in a future
release" (`python/ray/data/dataset.py` ~L3601), and passing a value
emits a `DeprecationWarning` (~L3712).

So the guidance told readers how to tune something inert. I removed the
sizing advice rather than rewriting it, since there's nothing to tune.

The page also said "Expect this parameter to be deprecated in 2.58."
That deprecation has already landed, so the sentence was predicting the
past.

## 3. The aggregator pool doesn't default to 64

The page said "Defaults to 64 or `num_partitions` (in cases when there
are less than 64 partitions)."

From `_derive_max_shuffle_aggregators` and its caller in
`python/ray/data/_internal/execution/operators/hash_shuffle.py` (~L485
and ~L591):

```
num_aggregators = min(target_num_partitions, max_shuffle_aggregators)
max_shuffle_aggregators = min(ceil(total_cluster_cpu),
                              max_hash_shuffle_aggregators or DEFAULT_MAX_HASH_SHUFFLE_AGGREGATORS)
```

`DEFAULT_MAX_HASH_SHUFFLE_AGGREGATORS` is 128 (`context.py` ~L128). So
the cap is 128 rather than 64, and there's a cluster-CPU bound the page
never mentioned.

**One thing worth a maintainer's eye:** the comment on the
`max_hash_shuffle_aggregators` field (`context.py` ~L886) says the unset
default is the smaller of "Total # of CPUs available in the cluster * 2"
and 128. The code has no `* 2`. I documented the code, not the comment,
but one of the two is stale and I can't tell which is intended.

## Out of scope

These pages have wider style and prose issues, plus a genuine RST
rendering bug in the join-type lists. Those are handled separately in
ray-project#65374 so this PR stays reviewable as a technical correction. ray-project#65374
touches the same region of `joining-data.rst`, so whichever merges
second needs a trivial rebase.

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[email protected]>
owenowenisme added a commit that referenced this pull request Aug 20, 2026
(cherry picked from commit fd223b6)
Signed-off-by: You-Cheng Lin <[email protected]>
owenowenisme pushed a commit that referenced this pull request Aug 20, 2026
## Summary

Three claims on the Ray Data join and save pages don't match the code.
This PR corrects only those claims, deliberately leaving the surrounding
prose alone so the diff is small enough to review as a technical
question rather than a wording one.

Each correction is cited below. I don't own Ray Data, so please check
the reasoning rather than the phrasing.

## 1. `saving-data.rst` sets the shuffle strategy on the class, not the
context

```python
DataContext.shuffle_strategy=ShuffleStrategy.SHUFFLE_V2   # before
DataContext.get_current().shuffle_strategy = ShuffleStrategy.SHUFFLE_V2   # after
```

`shuffle_strategy` is a `property` with a setter
(`python/ray/data/context.py`, the `@property` at ~L1246 and
`@shuffle_strategy.setter` at ~L1258). Assigning to it on the class
object rebinds the class attribute over the descriptor instead of
invoking the setter. Two consequences: the example never actually
selects the strategy it says it's selecting, and `shuffle_strategy`
stops working for every `DataContext` instance in that process.

This is a `testcode` block, so it runs in CI. Note that because the
assignment never took effect, the block has so far only ever exercised
the default `HASH_SHUFFLE`. With the fix it genuinely runs `SHUFFLE_V2`
for the first time. I don't have a Ray build locally, so **please
confirm that job passes** rather than taking my word for it. If
`SHUFFLE_V2` isn't ready to be load-bearing in a doctest, setting
`HASH_SHUFFLE` on `get_current()` would fix the descriptor bug without
that exposure.

@gemini-code-assist flagged this on two separate passes (#65372); the
value got updated to `SHUFFLE_V2` but the receiver didn't.

## 2. `partition_size_hint` is documented as a live tuning parameter

The page described it as `(optional)`, gave it a default of
`DataContext.target_max_block_size`, and offered two bullets on how to
size it for skew. But `Dataset.join` documents it as "**Deprecated** and
ignored ... This parameter has no effect and will be removed in a future
release" (`python/ray/data/dataset.py` ~L3601), and passing a value
emits a `DeprecationWarning` (~L3712).

So the guidance told readers how to tune something inert. I removed the
sizing advice rather than rewriting it, since there's nothing to tune.

The page also said "Expect this parameter to be deprecated in 2.58."
That deprecation has already landed, so the sentence was predicting the
past.

## 3. The aggregator pool doesn't default to 64

The page said "Defaults to 64 or `num_partitions` (in cases when there
are less than 64 partitions)."

From `_derive_max_shuffle_aggregators` and its caller in
`python/ray/data/_internal/execution/operators/hash_shuffle.py` (~L485
and ~L591):

```
num_aggregators = min(target_num_partitions, max_shuffle_aggregators)
max_shuffle_aggregators = min(ceil(total_cluster_cpu),
                              max_hash_shuffle_aggregators or DEFAULT_MAX_HASH_SHUFFLE_AGGREGATORS)
```

`DEFAULT_MAX_HASH_SHUFFLE_AGGREGATORS` is 128 (`context.py` ~L128). So
the cap is 128 rather than 64, and there's a cluster-CPU bound the page
never mentioned.

**One thing worth a maintainer's eye:** the comment on the
`max_hash_shuffle_aggregators` field (`context.py` ~L886) says the unset
default is the smaller of "Total # of CPUs available in the cluster * 2"
and 128. The code has no `* 2`. I documented the code, not the comment,
but one of the two is stale and I can't tell which is intended.

## Out of scope

These pages have wider style and prose issues, plus a genuine RST
rendering bug in the join-type lists. Those are handled separately in
#65374 so this PR stays reviewable as a technical correction. #65374
touches the same region of `joining-data.rst`, so whichever merges
second needs a trivial rebase.

Signed-off-by: Douglas Strodtman <[email protected]>
(cherry picked from commit a74234c)
Signed-off-by: You-Cheng Lin <[email protected]>
elliot-barn added a commit that referenced this pull request Aug 24, 2026
…in release 2.58 (#65612)

## Description
Backfill the doc of shuffle v2 into release 2.58 and use the name of
`hash_shuffle_v2` because the name`shuffle_v2` only exist on 2.58

This is a doc only changes so it's not blocking the PyPI release

## Related issues
> Link related issues: "Fixes #1234", "Closes #1234", or "Related to
#1234".

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.
(cherry picked from commit fd223b6)

---------

Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Douglas Strodtman <[email protected]>
Co-authored-by: Sai Miduthuri <[email protected]>
Co-authored-by: Elliot Barnwell <[email protected]>
dstrodtman added a commit that referenced this pull request Aug 27, 2026
## Summary

Style and grammar pass across the Ray Data shuffle pages, measured
against `doc/source/ray-contribute/writing-style.md`. Originally scoped
to `data-internals.rst`; extended after #65372 merged so the shuffle v2
content it introduced gets the same treatment as the rest of the page,
along with the sibling pages that reference it.

No behavior claims are changed. Where a wording fix would have restated
a technical claim I couldn't verify, I left the original text alone.

## Rendering fix

`joining-data.rst` had three join-type lists written as:

```rst
**Semi Joins:**
- Left Semi, Right Semi (returns all rows ...
```

RST needs a blank line before a bullet list, so all three rendered as
run-together paragraphs with literal `-` characters rather than lists.
Confirmed with docutils before and after.

## Style fixes

- **Sentence-case headings** throughout. Nothing catches these:
`Google.Headings` is disabled repo-wide.
- **Feature-stage casing.** "currently in Alpha" to "in alpha", per the
guide's rule that Ray-owned stages are lowercase.
- **Time-relative words.** Dropped "currently"; replaced the "this is a
new feature released in Ray 2.46" note, since 2.46 is no longer new.
- **Units.** "100 KB" to 100 KiB and "8 KB" to 8 KiB in
`data-internals.rst`, matching the actual `100 * 1024` and `8192`
values. The same section already said 1 GiB correctly.
- **Bold-as-heading** to definition-list form for the two shuffle v2
tuning settings.
- **`export`** added to the `RAY_DATA_DEFAULT_SHUFFLE_STRATEGY` snippet,
and the variable named in the lead-in, so the snippet does what the
prose describes.
- **Wording.** "knobs" to "settings", "only applies" to "applies only",
"group-bys" to "group-by operations", one spelling of "trade-off".
- **Mechanical.** Unicode quotes and apostrophes, trailing whitespace,
comma splices, missing terminal periods, and single backticks where
surrounding text uses double.

## Note for reviewers

Sentence-casing headings changes their generated HTML anchors, so any
external deep link to, for example, `#basic-aggregations` still resolves
but `#Custom-Aggregations`-style links to the old casing would not.
`autosectionlabel` isn't enabled and every `:ref:` on these pages uses
an explicit label, so no in-tree cross-reference breaks. Happy to revert
the heading changes if the anchor churn isn't worth it.

## Follow-up status

The factual corrections these pages needed shipped separately in #65525,
which is merged. That covered the `DataContext.shuffle_strategy`
assignment in `saving-data.rst`, the `partition_size_hint` deprecation,
and the aggregator-count default in `joining-data.rst`. This branch is
merged up with master and carries those corrections, with the
`partition_size_hint` bullet's inline literals normalized to double
backticks to match the rest of the page. Nothing factual is outstanding.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
dstrodtman added a commit that referenced this pull request Sep 30, 2026
)

## Why are these changes needed?

The Ray Data style pass (#66413, #66418, #66419, #66420, #66422, #66423)
kept the scope of every technical claim. That round flagged statements
that disagree with the current source, or with other statements on the
same page. This PR fixes the ones the source settles. Each edit below
names the source it follows and, where one exists, the PR that caused
the drift.

Ray Data reviewers: please confirm each item. LLM owners: please check
the `working-with-llms.md` edits.

### Performance, monitoring, and configuration

- `performance-tips.md`: The default object store limit is 0.5, not 1/4.
`ResourceManager.DEFAULT_OBJECT_STORE_MEMORY_LIMIT_FRACTION` is 0.5 when
the resource allocator is on, and `op_resource_reservation_enabled`
defaults to `True`. Docs lag since #43171 (2.10).
- `performance-tips.md`: `select_columns` after `read_parquet` prunes at
read time. `ProjectionPushdown` is in `_LOGICAL_RULESET`, and
`ParquetDatasource.supports_projection_pushdown` returns true. Docs lag
since #56500 (2.50). The page now recommends the pattern its own example
uses.
- `performance-tips.md`: The "following procedure" lead-in introduced
bullets that don't describe a procedure. It now introduces them as
rules.
- `monitoring-your-workload.md`: Dropped `RAY_DATA_TRACE_SCHEDULING`,
which nothing under `python/` references anymore. It was removed in
#44399 (2.11).
- `monitoring-your-workload.md`: Dropped the
`ray.data._internal.progress_bar.ProgressBar.MAX_NAME_LENGTH` knob. The
module moved to `_internal/progress/progress_bar.py`, and the tqdm,
logging, and rich progress implementations read a separate copy in
`base_progress.py` (#59629, 2.54). The documented public setting,
`enable_progress_bar_name_truncation`, stays.
- `monitoring-your-workload.md`: The lead-in no longer says all three
settings reduce output. `use_ray_tqdm = False` changes the
implementation, not the amount of output.
- `execution-configurations.md`: Documents `retried_io_errors` in place
of `write_file_retry_on_errors`. `DataContext.__setattr__` warns that
the old option is deprecated. It was deprecated in #46685 (2.33). The
substring-then-regex matching comes from the `retried_io_errors`
docstring.
- `execution-configurations.md`: The example set `verbose_progress =
True`, which is already the default (#43360). It now sets
`preserve_order = True`.
- `how-to-avoid-ooms.md`: "Eliminates kernel OOMs" contradicted the
page's own later statement that kernel OOMs can still happen with
isolation enabled. It now uses the conditional wording of the page's
summary. For "older versions", the object store proportion warning was
removed in #62387, first released in 2.56. The node-death line no longer
cites a version.

### Shuffle, aggregation, joins, and mixing

- `internals.md`: The range-partitioning sampler takes `num_reducers *
10 / len(blocks)` samples per block (`SortTaskSpec.sample_boundaries`),
not 10. The docs were wrong from the start, #52987.
- `internals.md`: `random_shuffle` builds on `ShuffleTaskSpec`, with the
push-based scheduler under `SORT_SHUFFLE_PUSH_BASED` and the pull-based
scheduler otherwise (`planner/random_shuffle.py`). It doesn't use the
range-partitioning shuffle. The docs were wrong from the start, #65372.
- **Note:** #64875 now plans `sort()` on shuffle v2 by default. This PR
removes the stale "shuffle v2 doesn't support sort" claim from the
sentence it edits. It leaves documenting sort on shuffle v2, including
the "doesn't yet replace the range-partitioning shuffle" sentence, to
the Ray Data docs update for that change.
- `shuffling-data.md`: The push-based shuffle section now uses
`DataContext.shuffle_strategy` and `RAY_DATA_DEFAULT_SHUFFLE_STRATEGY`
instead of the deprecated `use_push_based_shuffle` and
`RAY_DATA_PUSH_BASED_SHUFFLE` (#50215, 2.43). The section also drops the
2022 log output: the "Using experimental push-based shuffle" line now
logs at debug level.
- `shuffling-data.md` and `joining-data.md`: Key-based repartitioning
and joins no longer link "hash-shuffle" to the legacy `HASH_SHUFFLE`
section. Shuffle v2 is the default for both.
- `shuffling-data.md`: Dropped "in increasing order of resource
consumption and runtime". The page's own benchmark shows `map_batches`
shuffle keeping more throughput than local buffer shuffle.
- `aggregating-data.md`: `AggregateFnV2` has two abstract methods,
`aggregate_block` and `combine`. `finalize` is optional and defaults to
returning the accumulator. The docs were wrong from the start, reworded
in #59311.
- `joining-data.md`: `_derive_max_shuffle_aggregators` caps the
aggregator count at the CPU count. One partition per aggregator also
needs at least `num_partitions` CPUs.
- `joining-data.md`: The lead-in offered `partition_size_hint` as a
tuning parameter, but the page says Ray Data ignores it.
- `mixing-data.md`: `MixOperator` interleaves whole blocks, but batches
can span blocks, as the page's note says. "Each local batch drawn from a
single dataset" now holds only when block sizes match the batch size.
- `saving-data.md`: `to_pandas()` builds the DataFrame in the calling
process by iterating batches. It doesn't build it on the head node.

### Overview, loading, and modality pages

- `key-concepts.md`: `get_execution_plan` runs the logical optimizer,
then the planner, then the physical optimizer. `FuseOperators` is a
physical rule. The paragraph no longer puts both passes "during this
translation".
- `key-concepts.md`: `Read` plans to `InputDataBuffer` plus a map
operator (`plan_read_op.py`), matching line 74 and `internals.md`. The
example also switches from `read_parquet` to `read_csv`, because
`read_parquet` goes through `ListFiles` and `ReadFiles` when
`use_datasource_v2` is on. That's the default since #64821 (2.57).
- `custom-datasource-example.md`: "Unstable internal APIs" is now
"developer APIs". `FileBasedDatasource` and `RowBasedFileDatasink` are
`@DeveloperAPI`, and `Datasource` is `@PublicAPI`.
- `loading-data.md`: `read_kafka` also accepts per-partition offsets.
`"earliest"` is valid only as a start offset and `"latest"` only as an
end offset (`kafka_datasource.py` raises otherwise).
- `working-with-llms.md`: Hosted OpenAI-compatible endpoints use
`HttpRequestProcessorConfig`, and `ServeDeploymentProcessorConfig`
addresses Ray Serve deployments. The intro was wrong from the start,
#59214.
- `working-with-llms.md`: `size` is a whole-input budget. For video,
Qwen3-VL's `smart_resize` compares `t * h * w` against it. The docs were
wrong from the start, #63593.
- `working-with-tensors.md`: `map_batches` raises `ValueError` for
`batch_size="auto"` when `num_gpus` is set (#62648).

## Duplicate check

This isn't duplicating an existing PR. I searched open `ray-project/ray`
PRs for Ray Data docs and shuffle docs work, and none edits these
statements. The one related open item is a planned Ray Data docs update
for #64875. This PR deliberately leaves that change's sort-on-shuffle-v2
content alone.

## Testing

- Ran the changed `testcode` snippets from `execution-configurations.md`
and `shuffling-data.md` against a Ray nightly wheel. `random_shuffle`
under `SORT_SHUFFLE_PUSH_BASED` returned all 1,000 rows, and
`RAY_DATA_DEFAULT_SHUFFLE_STRATEGY=sort_shuffle_push_based` resolves to
that strategy.
- `vale` on the 15 changed files shows no new findings compared to
`master`.
- `pre-commit` hooks passed on commit.
- I didn't run a local Sphinx build. The new cross-references target
existing API entries, and the Read the Docs preview covers the build.

## AI assistance

I used AI assistance (Claude Code) to trace each claim to the source and
draft the 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
…ay-project#65375)

## Description

Two related fixes to the Vale setup.

### 1. The `vale` pre-commit hook has never run

The top-level `exclude` in `.pre-commit-config.yaml` lists
`doc/source/`, and pre-commit ANDs that global `exclude` with each
hook's own `files` pattern. The Vale hook's pattern,
`^doc/source/data/.*\.(md|rst)$`, lives entirely inside `doc/source/`,
so the two can never both be satisfied and the hook matches zero files:

```
$ pre-commit run vale --all-files
vale.................................................(no files to check)Skipped
```

Committing a change under `doc/source/data` skips it silently too. Vale
still ran in CI through `ci/lint/check-documentation-style.sh`, so the
gate existed, but contributors got no local signal, and a green
pre-commit run said nothing at all about Vale.

This narrows the `doc/source/` entry to
`doc/source/(?!data/.*[.](md|rst)$)`, so it keeps excluding the tree
except the prose the hook targets.

Narrowing it also exposes those 48 files to hooks that had never seen
them. Three needed exemptions, all recorded in the config with comments:

* `trailing-whitespace` and `end-of-file-fixer` would rewrite 17
unrelated files. I've exempted those two hooks from `doc/source/data` so
that enabling Vale stays a config-only change. **The whitespace cleanup
is worth doing, and I'm happy to send it as its own PR** rather than
bury it here, partly because three of those 17 files are also touched by
the open ray-project#65372. * `semgrep` would fail. Caught by Cursor Bugbot, and it
was right. `semgrep.yml`'s `code-block-python` rule lists
`doc/source/data/**/*.rst` in its `paths.include` at `severity: ERROR`,
there are 8 pre-existing violations across 5 files, and
`ci/lint/lint.sh` runs `pre-commit run semgrep --all-files` as the
`semgrep_lint` step. Converting those code blocks to `testcode` is real
work that belongs in its own PR, not in a Vale change.

The two rST hooks that also become eligible pass as-is. If you'd rather
just take the whitespace churn here, say so and I'll fold it in.

**A bigger finding, which I'm raising rather than fixing here.** That
`semgrep` exemption is a second instance of the same bug, not a new one.
Because the top-level `exclude` has covered `doc/source/`, the
`code-block-python` rule has never run on **any** of the five doc paths
it targets: 31 occurrences across 16 files in `doc/source/data`,
`ray-core`, `ray-observability`, and `train`. Every one is an untested
documentation snippet the rule was written to catch. Happy to take that
on as a follow-up, but converting snippets means they start executing in
CI, so it wants a maintainer opinion on scope and on whether the rule is
still wanted for docs at all.

### 2. Vale was pinned to 3.4.1, from June 2024

This upgrades both the hook `rev` and the CI script to 3.17.1. The bump
isn't inert, so three supporting changes come with it.

`Vale.Spelling` produces **no alerts at all** under 3.4.1, but 11
error-severity alerts under 3.17.1, because the newer engine
word-boundary-anchors vocabulary patterns. Existing entries such as
`[Bb]ackpressure`, `dtype`, and `namespace` therefore stopped covering
`backpressured`, `dtypes`, and `namespaces`. This widens those three and
adds terms that were never listed at all: `Databricks`, `Datasink`,
`Multimodality`, `preprocess`, `resample`, `vCPU`, `Vectorizer`.

Two Google rules also became error-severity on content where they're
wrong, so they're set to `warning` rather than editing correct prose:

* `Google.HeadingPunctuation` reads the period in a numbered heading
such as `### 1. Label your worker nodes` as a heading-ending period. The
match it reports is literally `1.`.
* `Google.OxfordComma` fires on "X, A and B" where A and B modify X
rather than continuing a list, as in "resources used by all operators,
active and requested".

Both follow the existing precedent of tuning Google rules in `.vale.ini`
alongside `Google.Colons` and `Google.Headings`, and both preserve
3.4.1's effective behavior, where neither rule blocked.

## Related issues

None. Cross-referencing two of my own open PRs that touch adjacent
surfaces, neither of which shares a file with this one:

* ray-project#65368 removes the banned-words lint in favor of Vale. That increases
how much Ray leans on Vale, which makes a dead local hook and a
two-year-old pin more worth fixing. Touches
`ci/lint/check-banned-words.sh`, `ci/lint/lint.sh`, and
`.buildkite/lint.rayci.yml`.
* ray-project#65342 makes the docs-go scope guard count Vale configuration as
documentation content. Worth noting that after it merges, a
Vale-config-only PR like this one would classify as documentation.
Touches `ci/lint/validate_docs_go_scope.sh`.

## Additional information

**AI assistance was used.** I used Claude Code to investigate and draft
this. I reviewed every changed line, ran the measurements below myself,
and can defend the change end to end.

**Not a duplicate.** `gh pr list --repo ray-project/ray --state open
--search "vale in:title"` and the same for `pre-commit` return only
ray-project#65368 and ray-project#65342 above, which change different files and have different
goals.

**Measurements**, on the exact set
`ci/lint/check-documentation-style.sh` lints (`doc/source/data` and
`doc/source/ray-overview/examples`):

| Vale | Total alerts | Error-severity | Exit code | Lint step |
|---|---|---|---|---|
| 3.4.1 (current pin) | 162 | 0 | 0 | green |
| 3.17.1, bump alone | 208 | 14 | 1 | **red** |
| 3.17.1, with this PR | 196 | 0 | 0 | green |

That middle row is the reason the vocabulary and `.vale.ini` changes are
in the same PR as the version bump: without them the bump turns `lint:
documentation_style` red.

**Checks run locally:**

```
# the CI script's exact target set, both versions
vale doc/source/data doc/source/ray-overview/examples   # 3.4.1 -> exit 0; 3.17.1 pre-fix -> exit 1; post-fix -> exit 0

# the hook now actually matches files and passes
pre-commit run vale --files doc/source/data/data-internals.rst
#   vale.....................................................................Passed

# and genuinely fails, rather than passing vacuously: appended a line
# containing "This sentance has a deliberate spelling mistake."
pre-commit run vale --files doc/source/data/data-internals.rst
#   349:6  error  Did you really mean 'sentance'?  Vale.Spelling
#   1 error, 0 warnings and 17 suggestions in 1 file.

# the two hooks I exempted stay exempt, so no file churn
pre-commit run trailing-whitespace --files $(git ls-files 'doc/source/data' | grep -E '\.(md|rst)$')
pre-commit run end-of-file-fixer   --files $(git ls-files 'doc/source/data' | grep -E '\.(md|rst)$')
#   both: (no files to check)Skipped

# the two rST hooks that newly become eligible
pre-commit run rst-directive-colons      --files ...   # Passed
pre-commit run rst-inline-touching-normal --files ...   # Passed
```

I also confirmed the 3.17.1 release publishes the two asset filenames
the CI script downloads, `vale_3.17.1_Linux_64-bit.tar.gz` and
`vale_3.17.1_macOS_arm64.tar.gz`.

**Net effect:** contributors get Vale locally, CI runs a Vale two years
newer, and `Vale.Spelling` becomes an enforced check instead of a silent
one.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ject#65525)

## Summary

Three claims on the Ray Data join and save pages don't match the code.
This PR corrects only those claims, deliberately leaving the surrounding
prose alone so the diff is small enough to review as a technical
question rather than a wording one.

Each correction is cited below. I don't own Ray Data, so please check
the reasoning rather than the phrasing.

## 1. `saving-data.rst` sets the shuffle strategy on the class, not the
context

```python
DataContext.shuffle_strategy=ShuffleStrategy.SHUFFLE_V2   # before
DataContext.get_current().shuffle_strategy = ShuffleStrategy.SHUFFLE_V2   # after
```

`shuffle_strategy` is a `property` with a setter
(`python/ray/data/context.py`, the `@property` at ~L1246 and
`@shuffle_strategy.setter` at ~L1258). Assigning to it on the class
object rebinds the class attribute over the descriptor instead of
invoking the setter. Two consequences: the example never actually
selects the strategy it says it's selecting, and `shuffle_strategy`
stops working for every `DataContext` instance in that process.

This is a `testcode` block, so it runs in CI. Note that because the
assignment never took effect, the block has so far only ever exercised
the default `HASH_SHUFFLE`. With the fix it genuinely runs `SHUFFLE_V2`
for the first time. I don't have a Ray build locally, so **please
confirm that job passes** rather than taking my word for it. If
`SHUFFLE_V2` isn't ready to be load-bearing in a doctest, setting
`HASH_SHUFFLE` on `get_current()` would fix the descriptor bug without
that exposure.

@gemini-code-assist flagged this on two separate passes (ray-project#65372); the
value got updated to `SHUFFLE_V2` but the receiver didn't.

## 2. `partition_size_hint` is documented as a live tuning parameter

The page described it as `(optional)`, gave it a default of
`DataContext.target_max_block_size`, and offered two bullets on how to
size it for skew. But `Dataset.join` documents it as "**Deprecated** and
ignored ... This parameter has no effect and will be removed in a future
release" (`python/ray/data/dataset.py` ~L3601), and passing a value
emits a `DeprecationWarning` (~L3712).

So the guidance told readers how to tune something inert. I removed the
sizing advice rather than rewriting it, since there's nothing to tune.

The page also said "Expect this parameter to be deprecated in 2.58."
That deprecation has already landed, so the sentence was predicting the
past.

## 3. The aggregator pool doesn't default to 64

The page said "Defaults to 64 or `num_partitions` (in cases when there
are less than 64 partitions)."

From `_derive_max_shuffle_aggregators` and its caller in
`python/ray/data/_internal/execution/operators/hash_shuffle.py` (~L485
and ~L591):

```
num_aggregators = min(target_num_partitions, max_shuffle_aggregators)
max_shuffle_aggregators = min(ceil(total_cluster_cpu),
                              max_hash_shuffle_aggregators or DEFAULT_MAX_HASH_SHUFFLE_AGGREGATORS)
```

`DEFAULT_MAX_HASH_SHUFFLE_AGGREGATORS` is 128 (`context.py` ~L128). So
the cap is 128 rather than 64, and there's a cluster-CPU bound the page
never mentioned.

**One thing worth a maintainer's eye:** the comment on the
`max_hash_shuffle_aggregators` field (`context.py` ~L886) says the unset
default is the smaller of "Total # of CPUs available in the cluster * 2"
and 128. The code has no `* 2`. I documented the code, not the comment,
but one of the two is stale and I can't tell which is intended.

## Out of scope

These pages have wider style and prose issues, plus a genuine RST
rendering bug in the join-type lists. Those are handled separately in
ray-project#65374 so this PR stays reviewable as a technical correction. ray-project#65374
touches the same region of `joining-data.rst`, so whichever merges
second needs a trivial rebase.

Signed-off-by: Douglas Strodtman <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ect#65374)

## Summary

Style and grammar pass across the Ray Data shuffle pages, measured
against `doc/source/ray-contribute/writing-style.md`. Originally scoped
to `data-internals.rst`; extended after ray-project#65372 merged so the shuffle v2
content it introduced gets the same treatment as the rest of the page,
along with the sibling pages that reference it.

No behavior claims are changed. Where a wording fix would have restated
a technical claim I couldn't verify, I left the original text alone.

## Rendering fix

`joining-data.rst` had three join-type lists written as:

```rst
**Semi Joins:**
- Left Semi, Right Semi (returns all rows ...
```

RST needs a blank line before a bullet list, so all three rendered as
run-together paragraphs with literal `-` characters rather than lists.
Confirmed with docutils before and after.

## Style fixes

- **Sentence-case headings** throughout. Nothing catches these:
`Google.Headings` is disabled repo-wide.
- **Feature-stage casing.** "currently in Alpha" to "in alpha", per the
guide's rule that Ray-owned stages are lowercase.
- **Time-relative words.** Dropped "currently"; replaced the "this is a
new feature released in Ray 2.46" note, since 2.46 is no longer new.
- **Units.** "100 KB" to 100 KiB and "8 KB" to 8 KiB in
`data-internals.rst`, matching the actual `100 * 1024` and `8192`
values. The same section already said 1 GiB correctly.
- **Bold-as-heading** to definition-list form for the two shuffle v2
tuning settings.
- **`export`** added to the `RAY_DATA_DEFAULT_SHUFFLE_STRATEGY` snippet,
and the variable named in the lead-in, so the snippet does what the
prose describes.
- **Wording.** "knobs" to "settings", "only applies" to "applies only",
"group-bys" to "group-by operations", one spelling of "trade-off".
- **Mechanical.** Unicode quotes and apostrophes, trailing whitespace,
comma splices, missing terminal periods, and single backticks where
surrounding text uses double.

## Note for reviewers

Sentence-casing headings changes their generated HTML anchors, so any
external deep link to, for example, `#basic-aggregations` still resolves
but `#Custom-Aggregations`-style links to the old casing would not.
`autosectionlabel` isn't enabled and every `:ref:` on these pages uses
an explicit label, so no in-tree cross-reference breaks. Happy to revert
the heading changes if the anchor churn isn't worth it.

## Follow-up status

The factual corrections these pages needed shipped separately in ray-project#65525,
which is merged. That covered the `DataContext.shuffle_strategy`
assignment in `saving-data.rst`, the `partition_size_hint` deprecation,
and the aggregator-count default in `joining-data.rst`. This branch is
merged up with master and carries those corrections, with the
`partition_size_hint` bullet's inline literals normalized to double
backticks to match the rest of the page. Nothing factual is outstanding.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…-project#66614)

## Why are these changes needed?

The Ray Data style pass (ray-project#66413, ray-project#66418, ray-project#66419, ray-project#66420, ray-project#66422, ray-project#66423)
kept the scope of every technical claim. That round flagged statements
that disagree with the current source, or with other statements on the
same page. This PR fixes the ones the source settles. Each edit below
names the source it follows and, where one exists, the PR that caused
the drift.

Ray Data reviewers: please confirm each item. LLM owners: please check
the `working-with-llms.md` edits.

### Performance, monitoring, and configuration

- `performance-tips.md`: The default object store limit is 0.5, not 1/4.
`ResourceManager.DEFAULT_OBJECT_STORE_MEMORY_LIMIT_FRACTION` is 0.5 when
the resource allocator is on, and `op_resource_reservation_enabled`
defaults to `True`. Docs lag since ray-project#43171 (2.10).
- `performance-tips.md`: `select_columns` after `read_parquet` prunes at
read time. `ProjectionPushdown` is in `_LOGICAL_RULESET`, and
`ParquetDatasource.supports_projection_pushdown` returns true. Docs lag
since ray-project#56500 (2.50). The page now recommends the pattern its own example
uses.
- `performance-tips.md`: The "following procedure" lead-in introduced
bullets that don't describe a procedure. It now introduces them as
rules.
- `monitoring-your-workload.md`: Dropped `RAY_DATA_TRACE_SCHEDULING`,
which nothing under `python/` references anymore. It was removed in
ray-project#44399 (2.11).
- `monitoring-your-workload.md`: Dropped the
`ray.data._internal.progress_bar.ProgressBar.MAX_NAME_LENGTH` knob. The
module moved to `_internal/progress/progress_bar.py`, and the tqdm,
logging, and rich progress implementations read a separate copy in
`base_progress.py` (ray-project#59629, 2.54). The documented public setting,
`enable_progress_bar_name_truncation`, stays.
- `monitoring-your-workload.md`: The lead-in no longer says all three
settings reduce output. `use_ray_tqdm = False` changes the
implementation, not the amount of output.
- `execution-configurations.md`: Documents `retried_io_errors` in place
of `write_file_retry_on_errors`. `DataContext.__setattr__` warns that
the old option is deprecated. It was deprecated in ray-project#46685 (2.33). The
substring-then-regex matching comes from the `retried_io_errors`
docstring.
- `execution-configurations.md`: The example set `verbose_progress =
True`, which is already the default (ray-project#43360). It now sets
`preserve_order = True`.
- `how-to-avoid-ooms.md`: "Eliminates kernel OOMs" contradicted the
page's own later statement that kernel OOMs can still happen with
isolation enabled. It now uses the conditional wording of the page's
summary. For "older versions", the object store proportion warning was
removed in ray-project#62387, first released in 2.56. The node-death line no longer
cites a version.

### Shuffle, aggregation, joins, and mixing

- `internals.md`: The range-partitioning sampler takes `num_reducers *
10 / len(blocks)` samples per block (`SortTaskSpec.sample_boundaries`),
not 10. The docs were wrong from the start, ray-project#52987.
- `internals.md`: `random_shuffle` builds on `ShuffleTaskSpec`, with the
push-based scheduler under `SORT_SHUFFLE_PUSH_BASED` and the pull-based
scheduler otherwise (`planner/random_shuffle.py`). It doesn't use the
range-partitioning shuffle. The docs were wrong from the start, ray-project#65372.
- **Note:** ray-project#64875 now plans `sort()` on shuffle v2 by default. This PR
removes the stale "shuffle v2 doesn't support sort" claim from the
sentence it edits. It leaves documenting sort on shuffle v2, including
the "doesn't yet replace the range-partitioning shuffle" sentence, to
the Ray Data docs update for that change.
- `shuffling-data.md`: The push-based shuffle section now uses
`DataContext.shuffle_strategy` and `RAY_DATA_DEFAULT_SHUFFLE_STRATEGY`
instead of the deprecated `use_push_based_shuffle` and
`RAY_DATA_PUSH_BASED_SHUFFLE` (ray-project#50215, 2.43). The section also drops the
2022 log output: the "Using experimental push-based shuffle" line now
logs at debug level.
- `shuffling-data.md` and `joining-data.md`: Key-based repartitioning
and joins no longer link "hash-shuffle" to the legacy `HASH_SHUFFLE`
section. Shuffle v2 is the default for both.
- `shuffling-data.md`: Dropped "in increasing order of resource
consumption and runtime". The page's own benchmark shows `map_batches`
shuffle keeping more throughput than local buffer shuffle.
- `aggregating-data.md`: `AggregateFnV2` has two abstract methods,
`aggregate_block` and `combine`. `finalize` is optional and defaults to
returning the accumulator. The docs were wrong from the start, reworded
in ray-project#59311.
- `joining-data.md`: `_derive_max_shuffle_aggregators` caps the
aggregator count at the CPU count. One partition per aggregator also
needs at least `num_partitions` CPUs.
- `joining-data.md`: The lead-in offered `partition_size_hint` as a
tuning parameter, but the page says Ray Data ignores it.
- `mixing-data.md`: `MixOperator` interleaves whole blocks, but batches
can span blocks, as the page's note says. "Each local batch drawn from a
single dataset" now holds only when block sizes match the batch size.
- `saving-data.md`: `to_pandas()` builds the DataFrame in the calling
process by iterating batches. It doesn't build it on the head node.

### Overview, loading, and modality pages

- `key-concepts.md`: `get_execution_plan` runs the logical optimizer,
then the planner, then the physical optimizer. `FuseOperators` is a
physical rule. The paragraph no longer puts both passes "during this
translation".
- `key-concepts.md`: `Read` plans to `InputDataBuffer` plus a map
operator (`plan_read_op.py`), matching line 74 and `internals.md`. The
example also switches from `read_parquet` to `read_csv`, because
`read_parquet` goes through `ListFiles` and `ReadFiles` when
`use_datasource_v2` is on. That's the default since ray-project#64821 (2.57).
- `custom-datasource-example.md`: "Unstable internal APIs" is now
"developer APIs". `FileBasedDatasource` and `RowBasedFileDatasink` are
`@DeveloperAPI`, and `Datasource` is `@PublicAPI`.
- `loading-data.md`: `read_kafka` also accepts per-partition offsets.
`"earliest"` is valid only as a start offset and `"latest"` only as an
end offset (`kafka_datasource.py` raises otherwise).
- `working-with-llms.md`: Hosted OpenAI-compatible endpoints use
`HttpRequestProcessorConfig`, and `ServeDeploymentProcessorConfig`
addresses Ray Serve deployments. The intro was wrong from the start,
ray-project#59214.
- `working-with-llms.md`: `size` is a whole-input budget. For video,
Qwen3-VL's `smart_resize` compares `t * h * w` against it. The docs were
wrong from the start, ray-project#63593.
- `working-with-tensors.md`: `map_batches` raises `ValueError` for
`batch_size="auto"` when `num_gpus` is set (ray-project#62648).

## Duplicate check

This isn't duplicating an existing PR. I searched open `ray-project/ray`
PRs for Ray Data docs and shuffle docs work, and none edits these
statements. The one related open item is a planned Ray Data docs update
for ray-project#64875. This PR deliberately leaves that change's sort-on-shuffle-v2
content alone.

## Testing

- Ran the changed `testcode` snippets from `execution-configurations.md`
and `shuffling-data.md` against a Ray nightly wheel. `random_shuffle`
under `SORT_SHUFFLE_PUSH_BASED` returned all 1,000 rows, and
`RAY_DATA_DEFAULT_SHUFFLE_STRATEGY=sort_shuffle_push_based` resolves to
that strategy.
- `vale` on the 15 changed files shows no new findings compared to
`master`.
- `pre-commit` hooks passed on commit.
- I didn't run a local Sphinx build. The new cross-references target
existing API entries, and the Read the Docs preview covers the build.

## AI assistance

I used AI assistance (Claude Code) to trace each claim to the source and
draft the 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ray fails to serialize self-reference objects

4 participants