ray.data.expressions.Expr#
- class ray.data.expressions.Expr(data_type: DataType)[source]#
Bases:
ABCBase class for all expression nodes.
This is the abstract base class that all expression types inherit from. It provides operator overloads for building complex expressions using standard Python operators.
Expressions form a tree structure where each node represents an operation or value. The tree can be evaluated against data batches to compute results.
Example
>>> from ray.data.expressions import col, lit >>> # Create an expression tree: (col("x") + 5) * col("y") >>> expr = (col("x") + lit(5)) * col("y") >>> # This creates a BinaryExpr with operation=MUL >>> # left=BinaryExpr(op=ADD, left=ColumnExpr("x"), right=LiteralExpr(5)) >>> # right=ColumnExpr("y")
Note
This class should not be instantiated directly. Use the concrete subclasses like ColumnExpr, LiteralExpr, etc.
DeveloperAPI: This API may change across minor Ray releases.
Methods
Compute the absolute value of the expression.
Compute the arccosine (inverse cosine) of the expression, returning radians.
Rename the expression.
Compute the arcsine (inverse sine) of the expression, returning radians.
Compute the arctangent (inverse tangent) of the expression, returning radians.
Round values up to the nearest integer.
Compute the cosine of the expression (in radians).
Compute the natural exponential of the expression.
Round values down to the nearest integer.
Check if the expression value is in a list of values.
Check if the expression value is not null.
Check if the expression value is null.
Compute the natural logarithm of the expression.
Compute the base-10 logarithm of the expression.
Compute the base-2 logarithm of the expression.
Compute the negation of the expression.
Check if the expression value is not in a list of values.
Raise the expression to the given power.
Round values to the nearest integer using PyArrow semantics.
Compute the sign of the expression.
Compute the sine of the expression (in radians).
Compare two expression ASTs for structural equality.
Compute the tangent of the expression (in radians).
Convert this Ray Data expression to a PyArrow compute expression.
Truncate fractional values toward zero.
Attributes
Access array operations for this expression.
Access datetime operations for this expression.
Access list operations for this expression.
Get the name associated with this expression.
Access string operations for this expression.
Access struct operations for this expression.