Skip to content

Commit e98c20c

Browse files
[ES|QL] Take named parameters for identifier and pattern out of snapshot (elastic#121850)
1 parent 7e954bc commit e98c20c

File tree

13 files changed

+862
-985
lines changed

13 files changed

+862
-985
lines changed

docs/changelog/121850.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 121850
2+
summary: Take named parameters for identifier and pattern out of snapshot
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.elasticsearch.xcontent.XContentType;
3434
import org.elasticsearch.xpack.esql.AssertWarnings;
3535
import org.elasticsearch.xpack.esql.EsqlTestUtils;
36-
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
3736
import org.junit.After;
3837
import org.junit.Assert;
3938
import org.junit.Before;
@@ -660,10 +659,6 @@ public void testErrorMessageForArrayValuesInParams() throws IOException {
660659
}
661660

662661
public void testNamedParamsForIdentifierAndIdentifierPatterns() throws IOException {
663-
assumeTrue(
664-
"named parameters for identifiers and patterns require snapshot build",
665-
EsqlCapabilities.Cap.NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES_SIMPLIFIED_SYNTAX.isEnabled()
666-
);
667662
bulkLoadTestData(10);
668663
// positive
669664
var query = requestObjectBuilder().query(

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ mode PROJECT_MODE;
314314
PROJECT_PIPE : PIPE -> type(PIPE), popMode;
315315
PROJECT_DOT: DOT -> type(DOT);
316316
PROJECT_COMMA : COMMA -> type(COMMA);
317-
PROJECT_PARAM : {this.isDevVersion()}? PARAM -> type(PARAM);
318-
PROJECT_NAMED_OR_POSITIONAL_PARAM : {this.isDevVersion()}? NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
317+
PROJECT_PARAM : PARAM -> type(PARAM);
318+
PROJECT_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
319319
320320
fragment UNQUOTED_ID_BODY_WITH_PATTERN
321321
: (LETTER | DIGIT | UNDERSCORE | ASTERISK)
@@ -349,8 +349,8 @@ RENAME_PIPE : PIPE -> type(PIPE), popMode;
349349
RENAME_ASSIGN : ASSIGN -> type(ASSIGN);
350350
RENAME_COMMA : COMMA -> type(COMMA);
351351
RENAME_DOT: DOT -> type(DOT);
352-
RENAME_PARAM : {this.isDevVersion()}? PARAM -> type(PARAM);
353-
RENAME_NAMED_OR_POSITIONAL_PARAM : {this.isDevVersion()}? NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
352+
RENAME_PARAM : PARAM -> type(PARAM);
353+
RENAME_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
354354
355355
AS : 'as';
356356
@@ -422,8 +422,8 @@ ENRICH_FIELD_QUOTED_IDENTIFIER
422422
: QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER)
423423
;
424424

425-
ENRICH_FIELD_PARAM : {this.isDevVersion()}? PARAM -> type(PARAM);
426-
ENRICH_FIELD_NAMED_OR_POSITIONAL_PARAM : {this.isDevVersion()}? NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
425+
ENRICH_FIELD_PARAM : PARAM -> type(PARAM);
426+
ENRICH_FIELD_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
427427

428428
ENRICH_FIELD_LINE_COMMENT
429429
: LINE_COMMENT -> channel(HIDDEN)
@@ -440,8 +440,8 @@ ENRICH_FIELD_WS
440440
mode MVEXPAND_MODE;
441441
MVEXPAND_PIPE : PIPE -> type(PIPE), popMode;
442442
MVEXPAND_DOT: DOT -> type(DOT);
443-
MVEXPAND_PARAM : {this.isDevVersion()}? PARAM -> type(PARAM);
444-
MVEXPAND_NAMED_OR_POSITIONAL_PARAM : {this.isDevVersion()}? NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
443+
MVEXPAND_PARAM : PARAM -> type(PARAM);
444+
MVEXPAND_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
445445

446446
MVEXPAND_QUOTED_IDENTIFIER
447447
: QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ identifier
193193

194194
identifierPattern
195195
: ID_PATTERN
196-
| {this.isDevVersion()}? parameter
196+
| parameter
197197
;
198198

199199
constant
@@ -216,7 +216,7 @@ parameter
216216

217217
identifierOrParameter
218218
: identifier
219-
| {this.isDevVersion()}? parameter
219+
| parameter
220220
;
221221

222222
limitCommand

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ public enum Cap {
670670
/**
671671
* Support simplified syntax for named parameters for field and function names.
672672
*/
673-
NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES_SIMPLIFIED_SYNTAX(Build.current().isSnapshot()),
673+
NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES_SIMPLIFIED_SYNTAX(),
674674

675675
/**
676676
* Fix pushdown of LIMIT past MV_EXPAND

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ private static QueryParams parseParams(XContentParser p) throws IOException {
171171
String paramName = entry.getKey();
172172
checkParamNameValidity(paramName, errors, loc);
173173

174-
if (EsqlCapabilities.Cap.NAMED_PARAMETER_FOR_FIELD_AND_FUNCTION_NAMES_SIMPLIFIED_SYNTAX.isEnabled()
175-
&& entry.getValue() instanceof Map<?, ?> value) {// parameter specified as a key:value pair
174+
if (entry.getValue() instanceof Map<?, ?> value) {// parameter specified as a key:value pair
176175
checkParamValueSize(paramName, value, loc, errors);
177176
for (Object keyName : value.keySet()) {
178177
classification = getParamClassification(keyName.toString(), errors, loc);

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

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

0 commit comments

Comments
 (0)