Skip to content

Commit 4a524c5

Browse files
authored
ESQL: take INLINE STATS out of snapshot (elastic#135403)
1 parent 0b876b8 commit 4a524c5

File tree

22 files changed

+2483
-2494
lines changed

22 files changed

+2483
-2494
lines changed

docs/changelog/135403.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
pr: 135403
2+
summary: Take INLINE STATS out of snapshot
3+
area: ES|QL
4+
type: enhancement
5+
issues: []
6+
highlight:
7+
title: Enable INLINE STATS in non-snapshot builds
8+
body: |-
9+
This effectively releases INLINE STATS into tech preview.
10+
- Enable the lexing/grammar for INLINE STATS in non-snapshot builds.
11+
- Enable more tests with FORK and INLINE STATS
12+
notable: true

x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/RestEsqlIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,6 @@ public void assertDriverData(Map<String, Object> driverMetadata, Map<String, Obj
479479

480480
@AwaitsFix(bugUrl = "disabled until JOIN infrastructrure properly lands")
481481
public void testInlineStatsProfile() throws IOException {
482-
assumeTrue("INLINE STATS only available on snapshots", Build.current().isSnapshot());
483482
indexTimestampData(1);
484483

485484
RequestObjectBuilder builder = requestObjectBuilder().query(fromIndex() + " | INLINE STATS AVG(value) | SORT value ASC");

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.apache.http.entity.ContentType;
1212
import org.apache.http.nio.entity.NByteArrayEntity;
1313
import org.apache.http.util.EntityUtils;
14-
import org.elasticsearch.Build;
1514
import org.elasticsearch.client.Request;
1615
import org.elasticsearch.client.RequestOptions;
1716
import org.elasticsearch.client.Response;
@@ -1221,7 +1220,7 @@ public void testComplexFieldNames() throws IOException {
12211220
* </p>
12221221
*/
12231222
public void testInlineStatsNow() throws IOException {
1224-
assumeTrue("INLINE STATS only available on snapshots", Build.current().isSnapshot());
1223+
assumeTrue("INLINE STATS only available on snapshots", EsqlCapabilities.Cap.INLINE_STATS.isEnabled());
12251224
indexTimestampData(1);
12261225

12271226
RequestObjectBuilder builder = requestObjectBuilder().query(

x-pack/plugin/esql/qa/testFixtures/src/main/resources/fork.csv-spec

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,7 @@ emp_no:integer | job_positions:keyword | _fork:keyword
688688
10087 | Junior Developer | fork2
689689
;
690690

691-
// INLINE STATS is under development, we enable this once it will be available
692-
forkBeforeInlineStats-Ignore
691+
forkBeforeInlineStats
693692
required_capability: fork_v9
694693
required_capability: inline_stats
695694

@@ -703,11 +702,13 @@ FROM employees
703702
;
704703

705704
emp_no:integer | languages:integer | _fork:keyword | max_lang:integer | gender:keyword
706-
1 | 2 | 3 | 4 | 5
705+
10048 |3 |fork1 |3 |M
706+
10081 |2 |fork1 |3 |M
707+
10081 |2 |fork2 |3 |M
708+
10087 |5 |fork2 |5 |F
707709
;
708710

709-
// INLINE STATS is under development, we enable this once it will be available
710-
forkBranchWithInlineStats-Ignore
711+
forkBranchWithInlineStats
711712
required_capability: fork_v9
712713
required_capability: inline_stats
713714

@@ -729,8 +730,7 @@ emp_no:integer | languages:integer | x:integer | gender:keyword | _fork:keyword
729730
10087 | 5 | 2 | F | fork2
730731
;
731732

732-
// INLINE STATS is under development, we enable this once it will be available
733-
forkAfterInlineStats-Ignore
733+
forkAfterInlineStats
734734
required_capability: fork_v9
735735
required_capability: inline_stats
736736

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import com.carrotsearch.randomizedtesting.annotations.Name;
1111
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
1212

13-
import org.elasticsearch.Build;
1413
import org.elasticsearch.action.ActionListener;
1514
import org.elasticsearch.cluster.metadata.IndexMetadata;
1615
import org.elasticsearch.cluster.node.DiscoveryNode;
@@ -184,11 +183,13 @@ public static Iterable<Object[]> parameters() {
184183
| EVAL ip = TO_IP(host), x = TO_STRING(host), y = TO_STRING(host)
185184
| INLINE STATS MAX(id)
186185
""",
187-
Build.current().isSnapshot() ? Map.of("FROM", 1, "EVAL", 1, "INLINE STATS", 1) : Collections.emptyMap(),
188-
Build.current().isSnapshot()
186+
EsqlCapabilities.Cap.INLINE_STATS.isEnabled()
187+
? Map.of("FROM", 1, "EVAL", 1, "INLINE STATS", 1)
188+
: Collections.emptyMap(),
189+
EsqlCapabilities.Cap.INLINE_STATS.isEnabled()
189190
? Map.ofEntries(Map.entry("MAX", 1), Map.entry("TO_IP", 1), Map.entry("TO_STRING", 2))
190191
: Collections.emptyMap(),
191-
Build.current().isSnapshot()
192+
EsqlCapabilities.Cap.INLINE_STATS.isEnabled()
192193
) }
193194
);
194195
}

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

Lines changed: 4 additions & 2 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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ processingCommand
6565
| sampleCommand
6666
| forkCommand
6767
| rerankCommand
68+
| inlineStatsCommand
6869
// in development
69-
| {this.isDevVersion()}? inlineStatsCommand
7070
| {this.isDevVersion()}? lookupCommand
7171
| {this.isDevVersion()}? insistCommand
7272
| {this.isDevVersion()}? fuseCommand
@@ -320,19 +320,19 @@ completionCommand
320320
: COMPLETION (targetField=qualifiedName ASSIGN)? prompt=primaryExpression commandNamedParameters
321321
;
322322

323+
inlineStatsCommand
324+
: INLINE INLINE_STATS stats=aggFields (BY grouping=fields)?
325+
// TODO: drop after next minor release
326+
| INLINESTATS stats=aggFields (BY grouping=fields)?
327+
;
328+
323329
//
324330
// In development
325331
//
326332
lookupCommand
327333
: DEV_LOOKUP tableName=indexPattern ON matchFields=qualifiedNamePatterns
328334
;
329335

330-
inlineStatsCommand
331-
: DEV_INLINE INLINE_STATS stats=aggFields (BY grouping=fields)?
332-
// TODO: drop after next minor release
333-
| DEV_INLINESTATS stats=aggFields (BY grouping=fields)?
334-
;
335-
336336
insistCommand
337337
: DEV_INSIST qualifiedNamePatterns
338338
;

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

Lines changed: 4 additions & 2 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/Inline.g4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
lexer grammar Inline;
99

10-
DEV_INLINE : {this.isDevVersion()}? 'inline' -> pushMode(INLINE_MODE);
11-
DEV_INLINESTATS : {this.isDevVersion()}? 'inlinestats' -> pushMode(EXPRESSION_MODE); // TODO: drop after next minor release
10+
INLINE : 'inline' -> pushMode(INLINE_MODE);
11+
INLINESTATS : 'inlinestats' -> pushMode(EXPRESSION_MODE); // TODO: drop after next minor release
1212

1313
mode INLINE_MODE;
1414

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.elasticsearch.rest.action.admin.cluster.RestNodesCapabilitiesAction;
1515
import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin;
1616
import org.elasticsearch.xpack.esql.plugin.EsqlFeatures;
17-
import org.elasticsearch.xpack.esql.plugin.EsqlPlugin;
1817

1918
import java.util.ArrayList;
2019
import java.util.List;
@@ -269,12 +268,12 @@ public enum Cap {
269268
/**
270269
* Support for the {@code INLINESTATS} syntax.
271270
*/
272-
INLINESTATS(EsqlPlugin.INLINE_STATS_FEATURE_FLAG),
271+
INLINESTATS(),
273272

274273
/**
275274
* Support for the expressions in grouping in {@code INLINESTATS} syntax.
276275
*/
277-
INLINESTATS_V2(EsqlPlugin.INLINE_STATS_FEATURE_FLAG),
276+
INLINESTATS_V2(),
278277

279278
/**
280279
* Support for aggregation function {@code TOP}.
@@ -993,12 +992,12 @@ public enum Cap {
993992
* Fixes a series of issues with inlinestats which had an incomplete implementation after lookup and inlinestats
994993
* were refactored.
995994
*/
996-
INLINESTATS_V11(EsqlPlugin.INLINE_STATS_FEATURE_FLAG),
995+
INLINESTATS_V11,
997996

998997
/**
999998
* Renamed `INLINESTATS` to `INLINE STATS`.
1000999
*/
1001-
INLINE_STATS(EsqlPlugin.INLINE_STATS_FEATURE_FLAG),
1000+
INLINE_STATS,
10021001

10031002
/**
10041003
* Support partial_results

0 commit comments

Comments
 (0)