[Data] Compute Expressions - Expr Arithmetic#59678
Merged
richardliaw merged 3 commits intoray-project:masterfrom Dec 30, 2025
Merged
[Data] Compute Expressions - Expr Arithmetic#59678richardliaw merged 3 commits intoray-project:masterfrom
richardliaw merged 3 commits intoray-project:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces several new arithmetic helper expressions (negate, sign, power, abs) to ray.data.expressions.Expr, along with corresponding unit tests. The implementation is clean and follows the existing pattern for PyArrow compute function wrappers. The tests are well-structured and cover the new functionality. I have a couple of suggestions to improve safety and code clarity.
0d2a188 to
cbb79e0
Compare
Completing the Expr Arithmetic operations: negate, sign, power, abs Signed-off-by: will <zzchun8@gmail.com>
cbb79e0 to
73ee7ff
Compare
goutamvenkat-anyscale
approved these changes
Dec 29, 2025
Contributor
Author
|
Hi @richardliaw , could you please review this PR when you have a moment? Thanks! |
AYou0207
pushed a commit
to AYou0207/ray
that referenced
this pull request
Jan 13, 2026
## Description
Completing the Expr Arithmetic operations: negate, sign, power, abs
```
import ray
from ray.data import from_items
from ray.data.expressions import col
ds = from_items([{"x": 5}, {"x": 2}, {"x": 0}])
for row in ds.iter_rows():
print(row)
x_expr = col("x")
ds = ds.with_column("x_negate", x_expr.negate())
ds = ds.with_column("x_sign", x_expr.sign())
ds = ds.with_column("x_power", x_expr.power(2))
ds = ds.with_column("x_abs", x_expr.abs())
for row in ds.iter_rows():
print(row)
```
## Related issues
Related to ray-project#58674
---------
Signed-off-by: will <zzchun8@gmail.com>
Co-authored-by: Goutam <goutam@anyscale.com>
Signed-off-by: jasonwrwang <jasonwrwang@tencent.com>
lee1258561
pushed a commit
to pinterest/ray
that referenced
this pull request
Feb 3, 2026
## Description
Completing the Expr Arithmetic operations: negate, sign, power, abs
```
import ray
from ray.data import from_items
from ray.data.expressions import col
ds = from_items([{"x": 5}, {"x": 2}, {"x": 0}])
for row in ds.iter_rows():
print(row)
x_expr = col("x")
ds = ds.with_column("x_negate", x_expr.negate())
ds = ds.with_column("x_sign", x_expr.sign())
ds = ds.with_column("x_power", x_expr.power(2))
ds = ds.with_column("x_abs", x_expr.abs())
for row in ds.iter_rows():
print(row)
```
## Related issues
Related to ray-project#58674
---------
Signed-off-by: will <zzchun8@gmail.com>
Co-authored-by: Goutam <goutam@anyscale.com>
peterxcli
pushed a commit
to peterxcli/ray
that referenced
this pull request
Feb 25, 2026
## Description
Completing the Expr Arithmetic operations: negate, sign, power, abs
```
import ray
from ray.data import from_items
from ray.data.expressions import col
ds = from_items([{"x": 5}, {"x": 2}, {"x": 0}])
for row in ds.iter_rows():
print(row)
x_expr = col("x")
ds = ds.with_column("x_negate", x_expr.negate())
ds = ds.with_column("x_sign", x_expr.sign())
ds = ds.with_column("x_power", x_expr.power(2))
ds = ds.with_column("x_abs", x_expr.abs())
for row in ds.iter_rows():
print(row)
```
## Related issues
Related to ray-project#58674
---------
Signed-off-by: will <zzchun8@gmail.com>
Co-authored-by: Goutam <goutam@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
peterxcli
pushed a commit
to peterxcli/ray
that referenced
this pull request
Feb 25, 2026
## Description
Completing the Expr Arithmetic operations: negate, sign, power, abs
```
import ray
from ray.data import from_items
from ray.data.expressions import col
ds = from_items([{"x": 5}, {"x": 2}, {"x": 0}])
for row in ds.iter_rows():
print(row)
x_expr = col("x")
ds = ds.with_column("x_negate", x_expr.negate())
ds = ds.with_column("x_sign", x_expr.sign())
ds = ds.with_column("x_power", x_expr.power(2))
ds = ds.with_column("x_abs", x_expr.abs())
for row in ds.iter_rows():
print(row)
```
## Related issues
Related to ray-project#58674
---------
Signed-off-by: will <zzchun8@gmail.com>
Co-authored-by: Goutam <goutam@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Completing the Expr Arithmetic operations: negate, sign, power, abs
Related issues
Related to #58674