-
Notifications
You must be signed in to change notification settings - Fork 7k
[Data] - Add human friendly repr for Expression Tree #58154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Data] - Add human friendly repr for Expression Tree #58154
Conversation
Signed-off-by: Goutam <goutam@anyscale.com>
There was a problem hiding this 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.
python/ray/data/_internal/planner/plan_expression/expression_visitors.py
Outdated
Show resolved
Hide resolved
python/ray/data/_internal/planner/plan_expression/expression_visitors.py
Outdated
Show resolved
Hide resolved
python/ray/data/_internal/planner/plan_expression/expression_visitors.py
Show resolved
Hide resolved
Signed-off-by: Goutam <goutam@anyscale.com>
| udf_expr.to_pyarrow() | ||
|
|
||
|
|
||
| class TestExpressionRepr: |
There was a problem hiding this comment.
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>
## 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>
## 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>
Description
As title states.
Example:
Related issues
Additional information