Skip to content

[8.x] Remove match command (#113383) #113525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

9 changes: 0 additions & 9 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ processingCommand
// in development
| {this.isDevVersion()}? inlinestatsCommand
| {this.isDevVersion()}? lookupCommand
| {this.isDevVersion()}? matchCommand
;

whereCommand
Expand Down Expand Up @@ -312,11 +311,3 @@ lookupCommand
inlinestatsCommand
: DEV_INLINESTATS stats=fields (BY grouping=fields)?
;

matchCommand
: DEV_MATCH matchQuery
;

matchQuery
: QUOTED_STRING
;
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,6 @@ public enum Cap {
*/
COMBINE_BINARY_COMPARISONS,

/**
* MATCH command support
*/
MATCH_COMMAND(true),

/**
* Support for nanosecond dates as a data type
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.elasticsearch.xpack.esql.core.expression.TypeResolutions;
import org.elasticsearch.xpack.esql.core.expression.predicate.BinaryOperator;
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.MatchQueryPredicate;
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.StringQueryPredicate;
import org.elasticsearch.xpack.esql.core.expression.predicate.operator.comparison.BinaryComparison;
import org.elasticsearch.xpack.esql.core.type.DataType;
import org.elasticsearch.xpack.esql.core.util.Holder;
Expand Down Expand Up @@ -187,7 +186,6 @@ else if (p instanceof Lookup lookup) {
checkForSortOnSpatialTypes(p, failures);

checkFilterMatchConditions(p, failures);
checkMatchCommand(p, failures);
checkFullTextQueryFunctions(p, failures);
});
checkRemoteEnrich(plan, failures);
Expand Down Expand Up @@ -644,22 +642,6 @@ private static void checkFilterMatchConditions(LogicalPlan plan, Set<Failure> fa
}
}

private static void checkMatchCommand(LogicalPlan plan, Set<Failure> failures) {
if (plan instanceof Filter f) {
Expression condition = f.condition();
if (condition instanceof StringQueryPredicate) {
// Similar to cases present in org.elasticsearch.xpack.esql.optimizer.rules.PushDownAndCombineFilters -
// we can't check if it can be pushed down as we don't have yet information about the fields present in the
// StringQueryPredicate
plan.forEachDown(LogicalPlan.class, lp -> {
if ((lp instanceof Filter || lp instanceof OrderBy || lp instanceof EsRelation) == false) {
failures.add(fail(plan, "MATCH cannot be used after {}", lp.sourceText().split(" ")[0].toUpperCase(Locale.ROOT)));
}
});
}
}
}

private static void checkFullTextQueryFunctions(LogicalPlan plan, Set<Failure> failures) {
if (plan instanceof Filter f) {
Expression condition = f.condition();
Expand Down

Large diffs are not rendered by default.

Loading