Skip to content

Commit

Permalink
[ESQL] Migrate PropagateEquals optimization (elastic#106627)
Browse files Browse the repository at this point in the history
Relates to elastic#105217

This copies the PropagateEquals logical optimization into ESQL, following the pattern established in elastic#106499. I've copied the optimization rule into the ESQL version of OptimizerRules, and the tests into OpitmizerRulesTests, and changed the imports &c to point to the appropriate ESQL classes instead of their QL counterparts.

I expect to have several more PRs following this pattern, for the remaining logical optimizations that touch the binary comparison logic. I'm intending to make separate PRs for each, in the interest of making them easier to review.
  • Loading branch information
not-napoleon authored Mar 22, 2024
1 parent cbc4182 commit ecb4223
Show file tree
Hide file tree
Showing 3 changed files with 715 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
import static java.util.Collections.singleton;
import static org.elasticsearch.xpack.esql.expression.NamedExpressions.mergeOutputExpressions;
import static org.elasticsearch.xpack.ql.expression.Expressions.asAttributes;
import static org.elasticsearch.xpack.ql.optimizer.OptimizerRules.PropagateEquals;
import static org.elasticsearch.xpack.ql.optimizer.OptimizerRules.TransformDirection;
import static org.elasticsearch.xpack.ql.optimizer.OptimizerRules.TransformDirection.DOWN;

Expand Down Expand Up @@ -126,7 +125,7 @@ protected static Batch<LogicalPlan> operators() {
new BooleanSimplification(),
new LiteralsOnTheRight(),
// needs to occur before BinaryComparison combinations (see class)
new PropagateEquals(),
new org.elasticsearch.xpack.esql.optimizer.OptimizerRules.PropagateEquals(),
new PropagateNullable(),
new BooleanFunctionEqualsElimination(),
new org.elasticsearch.xpack.esql.optimizer.OptimizerRules.CombineDisjunctionsToIn(),
Expand Down
Loading

0 comments on commit ecb4223

Please sign in to comment.