ray.data.expressions.Expr.is_idempotent#

Expr.is_idempotent() bool[source]#

Return whether this expression is safe to duplicate, reorder, or move.

Returns False for non-idempotent expressions (random, uuid, monotonically_increasing_id, and any composite containing them). Optimizer rules consult this before any rewrite that would change an expression’s evaluation count, row set, or position.

Returns:

Whether the expression tree contains no non-idempotent nodes.