Skip to content

Commit a867127

Browse files
authored
ESQL: extend TranslationAware to all pushable expressions (#120192)
This expands the `TranslationAware` interface for expressions that support translations to Lucene query and moves the implementations of these translations from a centralised place (ExpressionTranslators) to the respective expression classes. `TranslationAware` has now a subinterface, `SingleValueTranslationAware`, for expressions that need to implement the single-value logic (`null` out on MVs). So the `SingleValueQuery` wrapping no longer needs to be performed explicitly by the implementer. `TranslationAware` is now part of the `org.elasticsearch.xpack.esql.capabilities` package, together with the other interfaces that extensions needs to implement to be used by the core services (verifier and optimizer). To allow this, some logical nodes have been moved from core in the ESQL proper (where also `LucenePushdownPredicates` resides, used by `TranslationAware`).
1 parent cbb7c24 commit a867127

File tree

91 files changed

+1178
-1282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1178
-1282
lines changed

docs/changelog/120192.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 120192
2+
summary: Extend `TranslationAware` to all pushable expressions
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/TranslationAware.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/logical/BinaryLogic.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/planner/ExpressionTranslator.java

Lines changed: 0 additions & 48 deletions
This file was deleted.

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/planner/ExpressionTranslators.java

Lines changed: 0 additions & 163 deletions
This file was deleted.

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/planner/TranslatorHandler.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

x-pack/plugin/esql-core/src/test/java/org/elasticsearch/xpack/esql/core/util/TestUtils.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77

88
package org.elasticsearch.xpack.esql.core.util;
99

10-
import org.elasticsearch.xpack.esql.core.expression.Expression;
1110
import org.elasticsearch.xpack.esql.core.expression.FieldAttribute;
1211
import org.elasticsearch.xpack.esql.core.expression.Literal;
13-
import org.elasticsearch.xpack.esql.core.expression.predicate.Range;
1412
import org.elasticsearch.xpack.esql.core.tree.Source;
1513
import org.elasticsearch.xpack.esql.core.type.DataType;
1614
import org.elasticsearch.xpack.esql.core.type.EsField;
@@ -21,7 +19,6 @@
2119
import static org.elasticsearch.test.ESTestCase.randomAlphaOfLength;
2220
import static org.elasticsearch.test.ESTestCase.randomBoolean;
2321
import static org.elasticsearch.test.ESTestCase.randomFrom;
24-
import static org.elasticsearch.test.ESTestCase.randomZone;
2522
import static org.elasticsearch.xpack.esql.core.tree.Source.EMPTY;
2623
import static org.elasticsearch.xpack.esql.core.type.DataType.INTEGER;
2724

@@ -44,10 +41,6 @@ public static Literal of(Source source, Object value) {
4441
return new Literal(source, value, DataType.fromJava(value));
4542
}
4643

47-
public static Range rangeOf(Expression value, Expression lower, boolean includeLower, Expression upper, boolean includeUpper) {
48-
return new Range(EMPTY, value, lower, includeLower, upper, includeUpper, randomZone());
49-
}
50-
5144
public static FieldAttribute fieldAttribute() {
5245
return fieldAttribute(randomAlphaOfLength(10), randomFrom(DataType.types()));
5346
}

x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/EsqlTestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import org.elasticsearch.xpack.esql.core.expression.FoldContext;
4545
import org.elasticsearch.xpack.esql.core.expression.Literal;
4646
import org.elasticsearch.xpack.esql.core.expression.ReferenceAttribute;
47-
import org.elasticsearch.xpack.esql.core.expression.predicate.Range;
4847
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePattern;
4948
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.WildcardPattern;
5049
import org.elasticsearch.xpack.esql.core.tree.Source;
@@ -55,6 +54,7 @@
5554
import org.elasticsearch.xpack.esql.expression.function.EsqlFunctionRegistry;
5655
import org.elasticsearch.xpack.esql.expression.function.scalar.string.RLike;
5756
import org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLike;
57+
import org.elasticsearch.xpack.esql.expression.predicate.Range;
5858
import org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.Equals;
5959
import org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.GreaterThan;
6060
import org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.GreaterThanOrEqual;

0 commit comments

Comments
 (0)