Skip to content

Conversation

@iamjustinhsu
Copy link
Contributor

Description

A Logical Optimizer rule to combine consecutive repartitions. If 2 repartitions are consecutive, take the last one. If one of them performs an all gather shuffle, then the fused one should also shuffle too.

Related issues

None

Additional information

None

Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
@iamjustinhsu iamjustinhsu requested a review from a team as a code owner December 3, 2025 19:38
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 introduces a new logical optimization rule, CombineRepartitions, which effectively merges consecutive Repartition or StreamingRepartition operators into a single one. This is a valuable optimization that can simplify the logical plan and potentially improve performance by reducing overhead from redundant repartitioning steps. The logic correctly handles the shuffle parameter for Repartition and target_num_rows_per_block for StreamingRepartition when fusing operators. The integration into the _LOGICAL_RULESET is also correctly done.

if transformed_dag is original_dag:
return plan

# TODO replace w/ Plan.copy
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The TODO comment here indicates a known area for improvement. Implementing a Plan.copy method would provide a more robust and idiomatic way to create a new LogicalPlan instance after transformations, ensuring all relevant attributes are correctly propagated and maintaining the immutability pattern consistently across the plan hierarchy. This is a good future enhancement.

Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
Signed-off-by: iamjustinhsu <jhsu@anyscale.com>
@alexeykudinkin alexeykudinkin added the go add ONLY when ready to merge, run all tests label Dec 3, 2025
@alexeykudinkin alexeykudinkin enabled auto-merge (squash) December 3, 2025 23:57
@alexeykudinkin alexeykudinkin merged commit 6715f9b into ray-project:master Dec 4, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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