Skip to content

Move ES|QL sample command from snapshot to tech preview #129540

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 5 commits into from
Jun 18, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ public void testNamedParamsForIdentifierAndIdentifierPatterns() throws IOExcepti
error = re.getMessage();
assertThat(error, containsString("ParsingException"));
assertThat(error, containsString("line 1:23: mismatched input '?cmd' expecting {"));
assertThat(error, containsString("'dissect', 'eval', 'grok', 'limit', 'sort'"));
assertThat(error, containsString("'dissect', 'eval', 'grok', 'limit', 'sample', 'sort'"));
}
}

Expand Down
19 changes: 10 additions & 9 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.tokens

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ processingCommand
| joinCommand
| changePointCommand
| completionCommand
| sampleCommand
// in development
| {this.isDevVersion()}? inlinestatsCommand
| {this.isDevVersion()}? lookupCommand
| {this.isDevVersion()}? insistCommand
| {this.isDevVersion()}? forkCommand
| {this.isDevVersion()}? rerankCommand
| {this.isDevVersion()}? rrfCommand
| {this.isDevVersion()}? sampleCommand
;

whereCommand
Expand Down Expand Up @@ -258,6 +258,10 @@ enrichWithClause
: (newName=qualifiedNamePattern ASSIGN)? enrichField=qualifiedNamePattern
;

sampleCommand
: SAMPLE probability=constant
;

//
// In development
//
Expand Down Expand Up @@ -309,7 +313,3 @@ rerankCommand
completionCommand
: COMPLETION (targetField=qualifiedName ASSIGN)? prompt=primaryExpression WITH inferenceId=identifierOrParameter
;

sampleCommand
: DEV_SAMPLE probability=constant
;
19 changes: 10 additions & 9 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.tokens

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x-pack/plugin/esql/src/main/antlr/lexer/Expression.g4
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ EVAL : 'eval' -> pushMode(EXPRESSION_MODE);
GROK : 'grok' -> pushMode(EXPRESSION_MODE);
LIMIT : 'limit' -> pushMode(EXPRESSION_MODE);
ROW : 'row' -> pushMode(EXPRESSION_MODE);
SAMPLE : 'sample' -> pushMode(EXPRESSION_MODE);
SORT : 'sort' -> pushMode(EXPRESSION_MODE);
STATS : 'stats' -> pushMode(EXPRESSION_MODE);
WHERE : 'where' -> pushMode(EXPRESSION_MODE);

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


mode EXPRESSION_MODE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ public enum Cap {
/**
* Support for the SAMPLE command
*/
SAMPLE_V3(Build.current().isSnapshot()),
SAMPLE_V3,

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

/**
* From now, Literal only accepts strings as BytesRefs.
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.