ray.data.expressions.BinaryExpr.alias#

BinaryExpr.alias(name: str) Expr#

Rename the expression.

This method allows you to assign a new name to an expression result. This is particularly useful when you want to specify the output column name directly within the expression rather than as a separate parameter.

Parameters:

name – The new name for the expression

Returns:

An AliasExpr that wraps this expression with the specified name

Example

>>> from ray.data.expressions import col, lit
>>> # Create an expression with a new aliased name
>>> expr = (col("price") * col("quantity")).alias("total")
>>> # Can be used with Dataset operations that support named expressions