Skip to content
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

ESQL: Rename SHOW FUNCTIONS to META FUNCTIONS #106362

Merged
merged 3 commits into from
Mar 19, 2024
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
11 changes: 5 additions & 6 deletions docs/reference/esql/source-commands/show.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,23 @@ SHOW item
*Parameters*

`item`::
Can be `INFO` or experimental:[] `FUNCTIONS`.
Can only be `INFO`.

*Description*

The `SHOW` source command returns information about the deployment and
its capabilities:

* Use `SHOW INFO` to return the deployment's version, build date and hash.
* Use experimental:[] `SHOW FUNCTIONS` to return a list of all supported functions and a
synopsis of each function.

*Examples*

[source.merge.styled,esql]
[source,esql]
----
include::{esql-specs}/show.csv-spec[tag=showFunctionsFiltered]
SHOW INFO
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/show.csv-spec[tag=showFunctionsFiltered-result]
version | date | hash
8.13.0 |2024-02-23T10:04:18.123117961Z|04ba8c8db2507501c88f215e475de7b0798cb3b3
|===
3 changes: 2 additions & 1 deletion docs/reference/rest-api/usage.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ GET /_xpack/usage
"keep" : 0,
"enrich" : 0,
"from" : 0,
"row" : 0
"row" : 0,
"meta" : 0
},
"queries" : {
"rest" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public record QueryExecuted(String query, int depth, List<Column> outputSchema,
public static String sourceCommand(List<String> availabeIndices) {
return switch (randomIntBetween(0, 2)) {
case 0 -> from(availabeIndices);
case 1 -> showFunctions();
case 1 -> metaFunctions();
default -> row();
};

Expand Down Expand Up @@ -361,8 +361,8 @@ private static String from(List<String> availabeIndices) {
return result.toString();
}

private static String showFunctions() {
return "show functions";
private static String metaFunctions() {
return "metadata functions";
}

private static String indexPattern(String indexName) {
Expand Down
223 changes: 223 additions & 0 deletions x-pack/plugin/esql/qa/testFixtures/src/main/resources/meta.csv-spec

Large diffs are not rendered by default.

228 changes: 0 additions & 228 deletions x-pack/plugin/esql/qa/testFixtures/src/main/resources/show.csv-spec

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,8 @@ public void testShowInfo() {
}
}

public void testShowFunctions() {
try (EsqlQueryResponse results = run("show functions")) {
public void testMetaFunctions() {
try (EsqlQueryResponse results = run("meta functions")) {
assertThat(
results.columns(),
equalTo(
Expand Down
24 changes: 22 additions & 2 deletions x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ GROK : 'grok' -> pushMode(EXPRESSION_MODE);
INLINESTATS : 'inlinestats' -> pushMode(EXPRESSION_MODE);
KEEP : 'keep' -> pushMode(PROJECT_MODE);
LIMIT : 'limit' -> pushMode(EXPRESSION_MODE);
META : 'meta' -> pushMode(META_MODE);
MV_EXPAND : 'mv_expand' -> pushMode(MVEXPAND_MODE);
RENAME : 'rename' -> pushMode(RENAME_MODE);
ROW : 'row' -> pushMode(EXPRESSION_MODE);
Expand Down Expand Up @@ -364,13 +365,12 @@ MVEXPAND_WS
;

//
// SHOW INFO
// SHOW commands
//
mode SHOW_MODE;
SHOW_PIPE : PIPE -> type(PIPE), popMode;

INFO : 'info';
FUNCTIONS : 'functions';

SHOW_LINE_COMMENT
: LINE_COMMENT -> channel(HIDDEN)
Expand All @@ -384,6 +384,26 @@ SHOW_WS
: WS -> channel(HIDDEN)
;

//
// META commands
//
mode META_MODE;
META_PIPE : PIPE -> type(PIPE), popMode;

FUNCTIONS : 'functions';

META_LINE_COMMENT
: LINE_COMMENT -> channel(HIDDEN)
;

META_MULTILINE_COMMENT
: MULTILINE_COMMENT -> channel(HIDDEN)
;

META_WS
: WS -> channel(HIDDEN)
;

mode SETTING_MODE;
SETTING_CLOSING_BRACKET : CLOSING_BRACKET -> type(CLOSING_BRACKET), popMode;

Expand Down
Loading