Skip to content

[Data] Fix AliasExpr structural equality to respect rename flag#60711

Merged
alexeykudinkin merged 7 commits into
ray-project:masterfrom
slfan1989:fix/aliasexpr-structural-eq-rename
Feb 6, 2026
Merged

[Data] Fix AliasExpr structural equality to respect rename flag#60711
alexeykudinkin merged 7 commits into
ray-project:masterfrom
slfan1989:fix/aliasexpr-structural-eq-rename

Conversation

@slfan1989

@slfan1989 slfan1989 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes a bug in AliasExpr.structurally_equals where the rename marker was always treated as equal, causing incorrect structural equality results. This could affect logical optimization rules that rely on accurate expression equivalence (e.g., projection pushdown).

Main changes:
Correct comparison of _is_rename against other._is_rename

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.

Cursor Bugbot is reviewing your changes for commit 9a399ac
This PR fixes a bug in AliasExpr.structurally_equals where the rename marker was always treated as equal, causing incorrect structural equality results.
This could affect logical optimization rules that rely on accurate expression equivalence (e.g., projection pushdown).

Main changes:
Correct comparison of _is_rename against other._is_rename

Signed-off-by: slfan1989 <slfan1989@apache.org>
@slfan1989 slfan1989 requested a review from a team as a code owner February 3, 2026 15:04

@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 correctly fixes a bug in AliasExpr.structurally_equals where the _is_rename flag was compared against itself instead of the other expression's flag. This ensures that structural equality checks for AliasExpr are accurate, which is important for logical optimizations. The change is correct and addresses the issue effectively.

To prevent future regressions, I recommend adding a unit test to cover this specific case. A test comparing an AliasExpr created with alias() (_is_rename=False) and one created with _rename() (_is_rename=True) would have caught this bug and will help safeguard the fix.

@ray-gardener ray-gardener Bot added data Ray Data-related issues community-contribution Contributed by the community labels Feb 3, 2026
@goutamvenkat-anyscale

Copy link
Copy Markdown
Contributor

Thanks. Can you please add a unit test?

@slfan1989

Copy link
Copy Markdown
Contributor Author

Thanks. Can you please add a unit test?

Thanks for your message — I’ll add unit tests.

This PR fixes a bug in AliasExpr.structurally_equals where the rename marker was always treated as equal, causing incorrect structural equality results.
This could affect logical optimization rules that rely on accurate expression equivalence (e.g., projection pushdown).

Main changes:
Correct comparison of _is_rename against other._is_rename

Signed-off-by: slfan1989 <slfan1989@apache.org>
@slfan1989

Copy link
Copy Markdown
Contributor Author

@goutamvenkat-anyscale @bveeramani I've added the new unit test. Could you please take another look at the PR when you have a moment? Thank you so much!

from ray.data.expressions import col


def test_alias_structurally_equals_respects_rename_flag():

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.

You can actually move this into python/ray/data/tests/unit/expressions/test_core.py . There's already a class for AliasExpr

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for reviewing the code — I’ve made the changes based on your suggestions.

This PR fixes a bug in AliasExpr.structurally_equals where the rename marker was always treated as equal, causing incorrect structural equality results.
This could affect logical optimization rules that rely on accurate expression equivalence (e.g., projection pushdown).

Main changes:
Correct comparison of _is_rename against other._is_rename

Signed-off-by: slfan1989 <slfan1989@apache.org>

@goutamvenkat-anyscale goutamvenkat-anyscale 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.

lgtm!

@goutamvenkat-anyscale goutamvenkat-anyscale added the go add ONLY when ready to merge, run all tests label Feb 4, 2026
@slfan1989

Copy link
Copy Markdown
Contributor Author

@goutamvenkat-anyscale Thanks so much for reviewing the code!

@alexeykudinkin alexeykudinkin merged commit aec74f0 into ray-project:master Feb 6, 2026
6 checks passed
@slfan1989

Copy link
Copy Markdown
Contributor Author

@goutamvenkat-anyscale @alexeykudinkin Thanks a lot for helping review the code!

tiennguyentony pushed a commit to tiennguyentony/ray that referenced this pull request Feb 7, 2026
…project#60711)


## Description

This PR fixes a bug in AliasExpr.structurally_equals where the rename
marker was always treated as equal, causing incorrect structural
equality results. This could affect logical optimization rules that rely
on accurate expression equivalence (e.g., projection pushdown).

Main changes:
Correct comparison of _is_rename against other._is_rename

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

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a> is
reviewing your changes for commit <u>9a399ac</u></sup><!--
/BUGBOT_STATUS -->

---------

Signed-off-by: slfan1989 <slfan1989@apache.org>
Co-authored-by: Goutam <goutam@anyscale.com>
Signed-off-by: tiennguyentony <46289799+tiennguyentony@users.noreply.github.com>
tiennguyentony pushed a commit to tiennguyentony/ray that referenced this pull request Feb 7, 2026
…project#60711)


## Description

This PR fixes a bug in AliasExpr.structurally_equals where the rename
marker was always treated as equal, causing incorrect structural
equality results. This could affect logical optimization rules that rely
on accurate expression equivalence (e.g., projection pushdown).


Main changes:
Correct comparison of _is_rename against other._is_rename


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

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a> is
reviewing your changes for commit <u>9a399ac</u></sup><!--
/BUGBOT_STATUS -->

---------

Signed-off-by: slfan1989 <slfan1989@apache.org>
Co-authored-by: Goutam <goutam@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Feb 9, 2026
## Description

This PR fixes a bug in AliasExpr.structurally_equals where the rename
marker was always treated as equal, causing incorrect structural
equality results. This could affect logical optimization rules that rely
on accurate expression equivalence (e.g., projection pushdown).


Main changes:
Correct comparison of _is_rename against other._is_rename


## 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.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a> is
reviewing your changes for commit <u>9a399ac</u></sup><!--
/BUGBOT_STATUS -->

---------

Signed-off-by: slfan1989 <slfan1989@apache.org>
Co-authored-by: Goutam <goutam@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Feb 9, 2026
## Description

This PR fixes a bug in AliasExpr.structurally_equals where the rename
marker was always treated as equal, causing incorrect structural
equality results. This could affect logical optimization rules that rely
on accurate expression equivalence (e.g., projection pushdown).


Main changes:
Correct comparison of _is_rename against other._is_rename


## 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.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a> is
reviewing your changes for commit <u>9a399ac</u></sup><!--
/BUGBOT_STATUS -->

---------

Signed-off-by: slfan1989 <slfan1989@apache.org>
Co-authored-by: Goutam <goutam@anyscale.com>
ans9868 pushed a commit to ans9868/ray that referenced this pull request Feb 18, 2026
…project#60711)

## Description

This PR fixes a bug in AliasExpr.structurally_equals where the rename
marker was always treated as equal, causing incorrect structural
equality results. This could affect logical optimization rules that rely
on accurate expression equivalence (e.g., projection pushdown).

Main changes:
Correct comparison of _is_rename against other._is_rename

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

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a> is
reviewing your changes for commit <u>9a399ac</u></sup><!--
/BUGBOT_STATUS -->

---------

Signed-off-by: slfan1989 <slfan1989@apache.org>
Co-authored-by: Goutam <goutam@anyscale.com>
Signed-off-by: Adel Nour <ans9868@nyu.edu>
Aydin-ab pushed a commit to kunling-anyscale/ray that referenced this pull request Feb 20, 2026
…project#60711)

## Description

This PR fixes a bug in AliasExpr.structurally_equals where the rename
marker was always treated as equal, causing incorrect structural
equality results. This could affect logical optimization rules that rely
on accurate expression equivalence (e.g., projection pushdown).


Main changes:
Correct comparison of _is_rename against other._is_rename


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

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

<!-- BUGBOT_STATUS --><sup><a
href="https://cursor.com/dashboard?tab=bugbot">Cursor Bugbot</a> is
reviewing your changes for commit <u>9a399ac</u></sup><!--
/BUGBOT_STATUS -->

---------

Signed-off-by: slfan1989 <slfan1989@apache.org>
Co-authored-by: Goutam <goutam@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community data Ray Data-related issues go add ONLY when ready to merge, run all tests

4 participants