Skip to content

Commit

Permalink
Remove match command (elastic#113383) (elastic#113525)
Browse files Browse the repository at this point in the history
* Remove match command

* Remove assertMatchCommand

* Remove unused import

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
ioanatia and elasticmachine authored Sep 26, 2024
1 parent 8539876 commit c64c1fb
Show file tree
Hide file tree
Showing 15 changed files with 681 additions and 1,108 deletions.

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

0 comments on commit c64c1fb

Please sign in to comment.