Skip to content

Commit 904c60f

Browse files
authored
Move ES|QL sample command from snapshot to tech preview (#129540)
* Move ES|QL sample command from snapshot to tech preview * dev_sample -> sample * fix test * fix grammar
1 parent f096773 commit 904c60f

File tree

14 files changed

+2289
-2300
lines changed

14 files changed

+2289
-2300
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ public void testNamedParamsForIdentifierAndIdentifierPatterns() throws IOExcepti
794794
error = re.getMessage();
795795
assertThat(error, containsString("ParsingException"));
796796
assertThat(error, containsString("line 1:23: mismatched input '?cmd' expecting {"));
797-
assertThat(error, containsString("'dissect', 'eval', 'grok', 'limit', 'sort'"));
797+
assertThat(error, containsString("'dissect', 'eval', 'grok', 'limit', 'sample', 'sort'"));
798798
}
799799
}
800800

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

Lines changed: 10 additions & 9 deletions
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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ processingCommand
5757
| joinCommand
5858
| changePointCommand
5959
| completionCommand
60+
| sampleCommand
6061
// in development
6162
| {this.isDevVersion()}? inlinestatsCommand
6263
| {this.isDevVersion()}? lookupCommand
6364
| {this.isDevVersion()}? insistCommand
6465
| {this.isDevVersion()}? forkCommand
6566
| {this.isDevVersion()}? rerankCommand
6667
| {this.isDevVersion()}? rrfCommand
67-
| {this.isDevVersion()}? sampleCommand
6868
;
6969

7070
whereCommand
@@ -258,6 +258,10 @@ enrichWithClause
258258
: (newName=qualifiedNamePattern ASSIGN)? enrichField=qualifiedNamePattern
259259
;
260260

261+
sampleCommand
262+
: SAMPLE probability=constant
263+
;
264+
261265
//
262266
// In development
263267
//
@@ -309,7 +313,3 @@ rerankCommand
309313
completionCommand
310314
: COMPLETION (targetField=qualifiedName ASSIGN)? prompt=primaryExpression WITH inferenceId=identifierOrParameter
311315
;
312-
313-
sampleCommand
314-
: DEV_SAMPLE probability=constant
315-
;

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

Lines changed: 10 additions & 9 deletions
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/lexer/Expression.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ EVAL : 'eval' -> pushMode(EXPRESSION_MODE);
1515
GROK : 'grok' -> pushMode(EXPRESSION_MODE);
1616
LIMIT : 'limit' -> pushMode(EXPRESSION_MODE);
1717
ROW : 'row' -> pushMode(EXPRESSION_MODE);
18+
SAMPLE : 'sample' -> pushMode(EXPRESSION_MODE);
1819
SORT : 'sort' -> pushMode(EXPRESSION_MODE);
1920
STATS : 'stats' -> pushMode(EXPRESSION_MODE);
2021
WHERE : 'where' -> pushMode(EXPRESSION_MODE);
2122

2223
DEV_INLINESTATS : {this.isDevVersion()}? 'inlinestats' -> pushMode(EXPRESSION_MODE);
2324
DEV_RERANK : {this.isDevVersion()}? 'rerank' -> pushMode(EXPRESSION_MODE);
24-
DEV_SAMPLE : {this.isDevVersion()}? 'sample' -> pushMode(EXPRESSION_MODE);
2525

2626

2727
mode EXPRESSION_MODE;

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
@@ -1082,7 +1082,7 @@ public enum Cap {
10821082
/**
10831083
* Support for the SAMPLE command
10841084
*/
1085-
SAMPLE_V3(Build.current().isSnapshot()),
1085+
SAMPLE_V3,
10861086

10871087
/**
10881088
* The {@code _query} API now gives a cast recommendation if multiple types are found in certain instances.
@@ -1207,7 +1207,7 @@ public enum Cap {
12071207
/**
12081208
* Support parameters for SAMPLE command.
12091209
*/
1210-
PARAMETER_FOR_SAMPLE(Build.current().isSnapshot()),
1210+
PARAMETER_FOR_SAMPLE,
12111211

12121212
/**
12131213
* From now, Literal only accepts strings as BytesRefs.

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

Lines changed: 4 additions & 4 deletions
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/parser/EsqlBaseLexer.java

Lines changed: 1229 additions & 1238 deletions
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/parser/EsqlBaseParser.interp

Lines changed: 4 additions & 4 deletions
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/parser/EsqlBaseParser.java

Lines changed: 988 additions & 992 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)