Class ReplaceAliasingEvalWithProject

java.lang.Object
org.elasticsearch.xpack.esql.rule.Rule<LogicalPlan,LogicalPlan>
org.elasticsearch.xpack.esql.optimizer.rules.logical.ReplaceAliasingEvalWithProject

public final class ReplaceAliasingEvalWithProject extends Rule<LogicalPlan,LogicalPlan>
Replace aliasing evals (eval x=a) with a projection which can be further combined / simplified. The rule gets applied only if there's another project (Project/Stats) above it.

Needs to take into account shadowing of potentially intermediate fields: eval x = a + 1, y = x, z = y + 1, y = z, w = y + 1 The output should be eval x = a + 1, z = a + 1 + 1, w = a + 1 + 1 project x, z, z as y, w