Skip to content

Commit 80b420a

Browse files
committed
Remove snapshot build restriction for match and qstr functions (elastic#114482)
(cherry picked from commit 7ad1a0c) # Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java
1 parent e4a3fd6 commit 80b420a

File tree

21 files changed

+966
-1049
lines changed

21 files changed

+966
-1049
lines changed

docs/changelog/114482.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 114482
2+
summary: Remove snapshot build restriction for match and qstr functions
3+
area: ES|QL
4+
type: feature
5+
issues: []

docs/reference/esql/functions/kibana/definition/match.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/definition/qstr.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/plugin/QueryStringIT.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
import org.elasticsearch.xpack.esql.VerificationException;
1515
import org.elasticsearch.xpack.esql.action.AbstractEsqlIntegTestCase;
1616
import org.elasticsearch.xpack.esql.action.ColumnInfoImpl;
17-
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
18-
import org.elasticsearch.xpack.esql.action.EsqlQueryRequest;
19-
import org.elasticsearch.xpack.esql.action.EsqlQueryResponse;
2017
import org.elasticsearch.xpack.esql.core.type.DataType;
2118
import org.junit.Before;
2219

@@ -36,12 +33,6 @@ public void setupIndex() {
3633
createAndPopulateIndex();
3734
}
3835

39-
@Override
40-
protected EsqlQueryResponse run(EsqlQueryRequest request) {
41-
assumeTrue("qstr function available in snapshot builds only", EsqlCapabilities.Cap.QSTR_FUNCTION.isEnabled());
42-
return super.run(request);
43-
}
44-
4536
public void testSimpleQueryString() {
4637
var query = """
4738
FROM test

x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ ASTERISK : '*';
208208
SLASH : '/';
209209
PERCENT : '%';
210210

211-
DEV_MATCH : {this.isDevVersion()}? 'match';
211+
MATCH : 'match';
212212

213213
NAMED_OR_POSITIONAL_PARAM
214214
: PARAM (LETTER | UNDERSCORE) UNQUOTED_ID_BODY*

x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.tokens

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ regexBooleanExpression
7777
;
7878

7979
matchBooleanExpression
80-
: valueExpression DEV_MATCH queryString=string
80+
: valueExpression MATCH queryString=string
8181
;
8282

8383
valueExpression
@@ -106,7 +106,7 @@ functionExpression
106106

107107
functionName
108108
// Additional function identifiers that are already a reserved word in the language
109-
: {this.isDevVersion()}? DEV_MATCH
109+
: MATCH
110110
| identifierOrParameter
111111
;
112112

x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.tokens

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,12 @@ public enum Cap {
344344
/**
345345
* QSTR function
346346
*/
347-
QSTR_FUNCTION(true),
347+
QSTR_FUNCTION,
348348

349349
/**
350350
* MATCH function
351351
*/
352-
MATCH_FUNCTION(true),
352+
MATCH_FUNCTION,
353353

354354
/**
355355
* Don't optimize CASE IS NOT NULL function by not requiring the fields to be not null as well.

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,18 +386,17 @@ private FunctionDefinition[][] functions() {
386386
def(MvSlice.class, MvSlice::new, "mv_slice"),
387387
def(MvZip.class, MvZip::new, "mv_zip"),
388388
def(MvSum.class, MvSum::new, "mv_sum"),
389-
def(Split.class, Split::new, "split") } };
389+
def(Split.class, Split::new, "split") },
390+
// fulltext functions
391+
new FunctionDefinition[] { def(Match.class, Match::new, "match"), def(QueryString.class, QueryString::new, "qstr") } };
390392

391393
}
392394

393395
private static FunctionDefinition[][] snapshotFunctions() {
394396
return new FunctionDefinition[][] {
395397
new FunctionDefinition[] {
396-
def(Rate.class, Rate::withUnresolvedTimestamp, "rate"),
397398
def(Categorize.class, Categorize::new, "categorize"),
398-
// Full text functions
399-
def(QueryString.class, QueryString::new, "qstr"),
400-
def(Match.class, Match::new, "match") } };
399+
def(Rate.class, Rate::withUnresolvedTimestamp, "rate") } };
401400
}
402401

403402
public EsqlFunctionRegistry snapshotRegistry() {

0 commit comments

Comments
 (0)