Skip to content

Commit bc7aae5

Browse files
authored
Remove esql-core ParsingException (#118789) (#118811)
* Remove esql-core ParsingException Move fulltext related classes: querydsl, predicate and tests
1 parent 49cd9c9 commit bc7aae5

File tree

25 files changed

+66
-124
lines changed

25 files changed

+66
-124
lines changed

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

Lines changed: 0 additions & 56 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 & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.elasticsearch.xpack.esql.core.expression.Expression;
1212
import org.elasticsearch.xpack.esql.core.expression.FieldAttribute;
1313
import org.elasticsearch.xpack.esql.core.expression.MetadataAttribute;
14-
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.MultiMatchQueryPredicate;
1514
import org.elasticsearch.xpack.esql.core.expression.predicate.logical.And;
1615
import org.elasticsearch.xpack.esql.core.expression.predicate.logical.Not;
1716
import org.elasticsearch.xpack.esql.core.expression.predicate.logical.Or;
@@ -22,7 +21,6 @@
2221
import org.elasticsearch.xpack.esql.core.expression.predicate.regex.WildcardLike;
2322
import org.elasticsearch.xpack.esql.core.querydsl.query.BoolQuery;
2423
import org.elasticsearch.xpack.esql.core.querydsl.query.ExistsQuery;
25-
import org.elasticsearch.xpack.esql.core.querydsl.query.MultiMatchQuery;
2624
import org.elasticsearch.xpack.esql.core.querydsl.query.NotQuery;
2725
import org.elasticsearch.xpack.esql.core.querydsl.query.Query;
2826
import org.elasticsearch.xpack.esql.core.querydsl.query.RegexQuery;
@@ -71,18 +69,6 @@ private static Query translateField(RegexMatch e, String targetFieldName) {
7169
}
7270
}
7371

74-
public static class MultiMatches extends ExpressionTranslator<MultiMatchQueryPredicate> {
75-
76-
@Override
77-
protected Query asQuery(MultiMatchQueryPredicate q, TranslatorHandler handler) {
78-
return doTranslate(q, handler);
79-
}
80-
81-
public static Query doTranslate(MultiMatchQueryPredicate q, TranslatorHandler handler) {
82-
return new MultiMatchQuery(q.source(), q.query(), q.fields(), q);
83-
}
84-
}
85-
8672
public static class BinaryLogic extends ExpressionTranslator<
8773
org.elasticsearch.xpack.esql.core.expression.predicate.logical.BinaryLogic> {
8874

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.elasticsearch.common.Strings;
1212
import org.elasticsearch.common.util.CollectionUtils;
1313
import org.elasticsearch.common.util.FeatureFlag;
14-
import org.elasticsearch.xpack.esql.core.ParsingException;
1514
import org.elasticsearch.xpack.esql.core.QlIllegalArgumentException;
1615
import org.elasticsearch.xpack.esql.core.expression.Expression;
1716
import org.elasticsearch.xpack.esql.core.expression.function.Function;
@@ -146,6 +145,7 @@
146145
import org.elasticsearch.xpack.esql.expression.function.scalar.string.ToUpper;
147146
import org.elasticsearch.xpack.esql.expression.function.scalar.string.Trim;
148147
import org.elasticsearch.xpack.esql.expression.function.scalar.util.Delay;
148+
import org.elasticsearch.xpack.esql.parser.ParsingException;
149149
import org.elasticsearch.xpack.esql.session.Configuration;
150150

151151
import java.lang.reflect.Constructor;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
1111
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
12-
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.MatchQueryPredicate;
13-
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.MultiMatchQueryPredicate;
12+
import org.elasticsearch.xpack.esql.expression.predicate.fulltext.MatchQueryPredicate;
13+
import org.elasticsearch.xpack.esql.expression.predicate.fulltext.MultiMatchQueryPredicate;
1414

1515
import java.util.ArrayList;
1616
import java.util.Collections;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* 2.0; you may not use this file except in compliance with the Elastic License
55
* 2.0.
66
*/
7-
package org.elasticsearch.xpack.esql.core.expression.predicate.fulltext;
7+
package org.elasticsearch.xpack.esql.expression.predicate.fulltext;
88

99
import org.elasticsearch.common.io.stream.StreamInput;
1010
import org.elasticsearch.common.io.stream.StreamOutput;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
* 2.0; you may not use this file except in compliance with the Elastic License
55
* 2.0.
66
*/
7-
package org.elasticsearch.xpack.esql.core.expression.predicate.fulltext;
7+
package org.elasticsearch.xpack.esql.expression.predicate.fulltext;
88

99
import org.elasticsearch.common.Strings;
1010
import org.elasticsearch.common.util.Maps;
11-
import org.elasticsearch.xpack.esql.core.ParsingException;
12-
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.FullTextPredicate.Operator;
1311
import org.elasticsearch.xpack.esql.core.tree.Source;
12+
import org.elasticsearch.xpack.esql.expression.predicate.fulltext.FullTextPredicate.Operator;
13+
import org.elasticsearch.xpack.esql.parser.ParsingException;
1414

1515
import java.util.LinkedHashMap;
1616
import java.util.Locale;
@@ -86,7 +86,7 @@ private static String[] splitInTwo(String string, String delimiter) {
8686
return split;
8787
}
8888

89-
static FullTextPredicate.Operator operator(Map<String, String> options, String key) {
89+
static Operator operator(Map<String, String> options, String key) {
9090
String value = options.get(key);
9191
return value != null ? Operator.valueOf(value.toUpperCase(Locale.ROOT)) : null;
9292
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* 2.0; you may not use this file except in compliance with the Elastic License
55
* 2.0.
66
*/
7-
package org.elasticsearch.xpack.esql.core.expression.predicate.fulltext;
7+
package org.elasticsearch.xpack.esql.expression.predicate.fulltext;
88

99
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
1010
import org.elasticsearch.common.io.stream.StreamInput;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* 2.0; you may not use this file except in compliance with the Elastic License
55
* 2.0.
66
*/
7-
package org.elasticsearch.xpack.esql.core.expression.predicate.fulltext;
7+
package org.elasticsearch.xpack.esql.expression.predicate.fulltext;
88

99
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
1010
import org.elasticsearch.common.io.stream.StreamInput;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlParser.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ private <T> T invokeParser(
7070
BiFunction<AstBuilder, ParserRuleContext, T> result
7171
) {
7272
if (query.length() > MAX_LENGTH) {
73-
throw new org.elasticsearch.xpack.esql.core.ParsingException(
74-
"ESQL statement is too large [{} characters > {}]",
75-
query.length(),
76-
MAX_LENGTH
77-
);
73+
throw new ParsingException("ESQL statement is too large [{} characters > {}]", query.length(), MAX_LENGTH);
7874
}
7975
try {
8076
EsqlBaseLexer lexer = new EsqlBaseLexer(CharStreams.fromString(query));

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/ParserUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
1515
import org.antlr.v4.runtime.tree.TerminalNode;
1616
import org.elasticsearch.common.util.Maps;
17-
import org.elasticsearch.xpack.esql.core.ParsingException;
1817
import org.elasticsearch.xpack.esql.core.tree.Location;
1918
import org.elasticsearch.xpack.esql.core.tree.Source;
2019
import org.elasticsearch.xpack.esql.core.util.Check;

0 commit comments

Comments
 (0)