Skip to content

Commit 1deae1a

Browse files
committed
Fix tests
1 parent 109d004 commit 1deae1a

File tree

6 files changed

+8
-36
lines changed

6 files changed

+8
-36
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/FullTextFunction.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private static void checkFullTextQueryFunctions(LogicalPlan plan, Failures failu
187187
checkCommandsBeforeExpression(
188188
plan,
189189
condition,
190-
Match.class,
190+
AbstractMatchFullTextFunction.class,
191191
lp -> (lp instanceof Limit == false) && (lp instanceof Aggregate == false),
192192
m -> "[" + m.functionName() + "] " + m.functionType(),
193193
failures
@@ -265,26 +265,6 @@ private static boolean onlyFullTextFunctionsInExpression(Expression expression)
265265
return false;
266266
}
267267

268-
/**
269-
* Checks whether an expression contains a full text function as part of it
270-
*
271-
* @param expression expression to check
272-
* @return true if the expression or any of its children is a full text function, false otherwise
273-
*/
274-
private static boolean anyFullTextFunctionsInExpression(Expression expression) {
275-
if (expression instanceof FullTextFunction) {
276-
return true;
277-
}
278-
279-
for (Expression child : expression.children()) {
280-
if (anyFullTextFunctionsInExpression(child)) {
281-
return true;
282-
}
283-
}
284-
285-
return false;
286-
}
287-
288268
/**
289269
* Checks all commands that exist before a specific type satisfy conditions.
290270
*

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MatchOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public MatchOperator(
6565
this(source, field, matchQuery, null);
6666
}
6767

68-
public MatchOperator(Source source, Expression field, Expression matchQuery, QueryBuilder queryBuilder) {
68+
private MatchOperator(Source source, Expression field, Expression matchQuery, QueryBuilder queryBuilder) {
6969
super(source, matchQuery, List.of(field, matchQuery), queryBuilder, field);
7070
}
7171

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import org.elasticsearch.xpack.esql.expression.function.aggregate.Count;
3636
import org.elasticsearch.xpack.esql.expression.function.aggregate.Max;
3737
import org.elasticsearch.xpack.esql.expression.function.aggregate.Min;
38-
import org.elasticsearch.xpack.esql.expression.function.fulltext.Match;
38+
import org.elasticsearch.xpack.esql.expression.function.fulltext.MatchOperator;
3939
import org.elasticsearch.xpack.esql.expression.function.scalar.map.LogWithBaseInMap;
4040
import org.elasticsearch.xpack.esql.index.EsIndex;
4141
import org.elasticsearch.xpack.esql.index.IndexResolution;
@@ -2577,7 +2577,7 @@ public void testFromEnrichAndMatchColonUsage() {
25772577
""", "mapping-default.json");
25782578
var limit = as(plan, Limit.class);
25792579
var filter = as(limit.child(), Filter.class);
2580-
var match = as(filter.condition(), Match.class);
2580+
var match = as(filter.condition(), MatchOperator.class);
25812581
var enrich = as(filter.child(), Enrich.class);
25822582
assertEquals(enrich.mode(), Enrich.Mode.ANY);
25832583
assertEquals(enrich.policy().getMatchField(), "language_code");

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MatchOperatorErrorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected List<TestCaseSupplier> cases() {
3232

3333
@Override
3434
protected Expression build(Source source, List<Expression> args) {
35-
return new MatchOperator(source, args.get(0), args.get(1), null);
35+
return new MatchOperator(source, args.get(0), args.get(1));
3636
}
3737

3838
@Override

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LocalPhysicalPlanOptimizerTests.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,6 @@ public void testCountAllWithEval() {
202202
assertThat(stat.query(), is(nullValue()));
203203
}
204204

205-
public void test() {
206-
var plan = plannerOptimizer.plan("""
207-
from test | eval s = emp_no + 2""");
208-
var stat = queryStatsFor(plan);
209-
assertThat(stat.type(), is(StatsType.COUNT));
210-
assertThat(stat.query(), is(nullValue()));
211-
}
212-
213205
/**
214206
* Expects
215207
* LimitExec[1000[INTEGER]]

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.elasticsearch.xpack.esql.expression.UnresolvedNamePattern;
2929
import org.elasticsearch.xpack.esql.expression.function.UnresolvedFunction;
3030
import org.elasticsearch.xpack.esql.expression.function.aggregate.FilteredExpression;
31-
import org.elasticsearch.xpack.esql.expression.function.fulltext.Match;
31+
import org.elasticsearch.xpack.esql.expression.function.fulltext.MatchOperator;
3232
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToInteger;
3333
import org.elasticsearch.xpack.esql.expression.function.scalar.string.RLike;
3434
import org.elasticsearch.xpack.esql.expression.function.scalar.string.WildcardLike;
@@ -2303,7 +2303,7 @@ public void testMetricWithGroupKeyAsAgg() {
23032303
public void testMatchOperatorConstantQueryString() {
23042304
var plan = statement("FROM test | WHERE field:\"value\"");
23052305
var filter = as(plan, Filter.class);
2306-
var match = (Match) filter.condition();
2306+
var match = (MatchOperator) filter.condition();
23072307
var matchField = (UnresolvedAttribute) match.field();
23082308
assertThat(matchField.name(), equalTo("field"));
23092309
assertThat(match.query().fold(FoldContext.small()), equalTo("value"));
@@ -2347,7 +2347,7 @@ public void testMatchFunctionFieldCasting() {
23472347
public void testMatchOperatorFieldCasting() {
23482348
var plan = statement("FROM test | WHERE field::int : \"value\"");
23492349
var filter = as(plan, Filter.class);
2350-
var match = (Match) filter.condition();
2350+
var match = (MatchOperator) filter.condition();
23512351
var toInteger = (ToInteger) match.field();
23522352
var matchField = (UnresolvedAttribute) toInteger.field();
23532353
assertThat(matchField.name(), equalTo("field"));

0 commit comments

Comments
 (0)