Skip to content

[Data] Fuse shuffle map with map op - #68433

Merged
sampan-s-nayak merged 2 commits into
ray-project:masterfrom
owenowenisme:owenowenisme/Fuse-shuffle-map
Nov 23, 2026
Merged

sampan-s-nayak merged 2 commits into
ray-project:masterfrom
owenowenisme:owenowenisme/Fuse-shuffle-map

Conversation

@owenowenisme

@owenowenisme owenowenisme commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Description

Lets the upstream read or map fuse into the disk-shuffle writer, so one task reads, maps, partitions and writes its shuffle file.
Also set polars max threads in task instead of runtime env so shuffle map can fuse with other map op (or it'll blocked by different runtime env )

Signed-off-by: You-Cheng Lin <[email protected]>
@owenowenisme
owenowenisme requested a review from a team as a code owner November 21, 2026 12:46

@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 enables operator fusion for disk-shuffle map operators by removing the runtime environment configuration for Polars thread capping and instead setting it directly within the tasks via cap_polars_threads(). It also updates the operator fusion rules to handle disk-shuffle writers as plain task-pool maps and adds corresponding tests. The review feedback highlights a critical bug in operator_fusion.py where a list of input dependencies is incorrectly passed to AbstractMap instead of a single logical operator, which would cause type mismatches. Additionally, minor typos in the docstring of cap_polars_threads should be corrected.

@owenowenisme owenowenisme added data Ray Data-related issues go add ONLY when ready to merge, run all tests labels Nov 21, 2026
def test_map_between_disk_shuffles_fuses_into_first_reduce(
ray_start_regular_shared_2_cpus, restore_data_context
):
"""Back-to-back disk shuffles with a map between collapse to two task

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.

just a thought I had no action required for now, when fusing two shuffles we can support optimisations like skipping partitioning (if keys are same) as the data would already be partitioned from previous shuffles map?

@sampan-s-nayak
sampan-s-nayak merged commit 1729626 into ray-project:master Nov 23, 2026
5 checks passed
elliot-barn added a commit that referenced this pull request Nov 23, 2026
…nto releases/2.61.0 (#68472)

## Description

Cherry-pick of #68433 (`1729626bbb`) onto `releases/2.61.0`. Lets the
upstream read or map fuse into the disk-shuffle writer, and sets the
polars thread limit inside the task rather than through the runtime env.

The pick applied without conflicts. Seven master commits that touch the
same files are not on the release branch (#67143, #68158, #68202 and its
revert #68383, #68319, #67570, #68118), so the picked files differ from
master in five places. Reviewers from Data, please confirm none of those
is a prerequisite.

## Testing

Ran locally against the `releases/2.61.0` wheel (`7c8ca5ea51`) with the
picked files overlaid: `test_hash_shuffle_v2.py`,
`test_operator_fusion.py` and `test_execution_optimizer_advanced.py`,
232 passed, 2 skipped.

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

Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: You-Cheng Lin <[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 go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants