Skip to content

Conversation

@goutamvenkat-anyscale
Copy link
Contributor

Description

As title states.

Example:

from ray.data.expressions import col, lit
expr = (col("x") + lit(5)) * col("y")
print(expr)
  MUL
  ├── left: ADD
  │   ├── left: COL('x')
  │   └── right: LIT(5)
  └── right: COL('y')

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: Goutam <goutam@anyscale.com>
@goutamvenkat-anyscale goutamvenkat-anyscale requested a review from a team as a code owner October 25, 2025 00:30
@goutamvenkat-anyscale goutamvenkat-anyscale added data Ray Data-related issues go add ONLY when ready to merge, run all tests labels Oct 25, 2025
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 human-friendly tree representation for Expression objects by implementing a __repr__ method. The implementation uses a _TreeReprVisitor to recursively build the string representation. The changes are well-tested. My feedback focuses on improving the readability of the generated tree and enhancing code maintainability by removing redundant code and magic numbers.

cursor[bot]

This comment was marked as outdated.

Signed-off-by: Goutam <goutam@anyscale.com>
udf_expr.to_pyarrow()


class TestExpressionRepr:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please trim this to a single most complicated test

Signed-off-by: Goutam <goutam@anyscale.com>
@alexeykudinkin alexeykudinkin merged commit 02559bb into ray-project:master Oct 27, 2025
6 checks passed
@goutamvenkat-anyscale goutamvenkat-anyscale deleted the goutam/expr_pretty_print branch October 27, 2025 18:29
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
## Description
As title states.

Example:

```
from ray.data.expressions import col, lit
expr = (col("x") + lit(5)) * col("y")
print(expr)
  MUL
  ├── left: ADD
  │   ├── left: COL('x')
  │   └── right: LIT(5)
  └── right: COL('y')
```

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

---------

Signed-off-by: Goutam <goutam@anyscale.com>
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Nov 19, 2025
## Description
As title states.

Example:

```
from ray.data.expressions import col, lit
expr = (col("x") + lit(5)) * col("y")
print(expr)
  MUL
  ├── left: ADD
  │   ├── left: COL('x')
  │   └── right: LIT(5)
  └── right: COL('y')
```

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

---------

Signed-off-by: Goutam <goutam@anyscale.com>
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
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.

Ray fails to serialize self-reference objects

2 participants