Skip to content

Commit 70b397c

Browse files
alex-spiesbpinteaelasticsearchmachinenik9000
authored
ESQL: Enable LOOKUP JOIN in non-snapshot builds (#121193)
This effectively releases LOOKUP JOIN into tech preview. Docs will follow in a separate PR. * Enable the lexing/grammar for LOOKUP JOIN in non-snapshot builds. * Remove the grammar for the unsupported | JOIN ... command (without LOOKUP as first keyword). The way the lexer modes work, otherwise we'd also have to enable | JOIN ... syntax on non-snapshot builds and would have to add additional validation to provide appropriate error messages. * Remove grammar for LOOKUP JOIN index AS ... because qualifiers are not yet supported. Otherwise we'd have to put in additional validation as well to prevent such queries. --------- Co-authored-by: Bogdan Pintea <[email protected]> Co-authored-by: elasticsearchmachine <[email protected]> Co-authored-by: Nik Everett <[email protected]>
1 parent 45c191e commit 70b397c

File tree

15 files changed

+2144
-2187
lines changed

15 files changed

+2144
-2187
lines changed

docs/changelog/121193.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
pr: 121193
2+
summary: Enable LOOKUP JOIN in non-snapshot builds
3+
area: ES|QL
4+
type: enhancement
5+
issues:
6+
- 121185
7+
highlight:
8+
title: Enable LOOKUP JOIN in non-snapshot builds
9+
body: |-
10+
This effectively releases LOOKUP JOIN into tech preview. Docs will
11+
follow in a separate PR.
12+
13+
- Enable the lexing/grammar for LOOKUP JOIN in non-snapshot builds.
14+
- Remove the grammar for the unsupported `| JOIN ...` command (without `LOOKUP` as first keyword). The way the lexer modes work, otherwise we'd also have to enable `| JOIN ...` syntax on non-snapshot builds and would have to add additional validation to provide appropriate error messages.
15+
- Remove grammar for `LOOKUP JOIN index AS ...` because qualifiers are not yet supported. Otherwise we'd have to put in additional validation as well to prevent such queries.
16+
17+
Also fix https://github.com/elastic/elasticsearch/issues/121185
18+
notable: true

muted-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,6 @@ tests:
314314
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
315315
method: testSetEnabled
316316
issue: https://github.com/elastic/elasticsearch/issues/121183
317-
- class: org.elasticsearch.xpack.esql.optimizer.LogicalPlanOptimizerTests
318-
issue: https://github.com/elastic/elasticsearch/issues/121185
319317
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
320318
method: test {yaml=cat.aliases/10_basic/Simple alias}
321319
issue: https://github.com/elastic/elasticsearch/issues/121186

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ protected boolean supportsIndexModeLookup() throws IOException {
232232
protected final void doTest() throws Throwable {
233233
RequestObjectBuilder builder = new RequestObjectBuilder(randomFrom(XContentType.values()));
234234

235-
if (testCase.query.toUpperCase(Locale.ROOT).contains("LOOKUP")) {
235+
if (testCase.query.toUpperCase(Locale.ROOT).contains("LOOKUP_\uD83D\uDC14")) {
236236
builder.tables(tables());
237237
}
238238

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,9 @@ public static Iterable<Object[]> parameters() {
142142
| EVAL y = to_str(host)
143143
| LOOKUP JOIN lookup_idx ON host
144144
""",
145-
Build.current().isSnapshot()
146-
? Map.ofEntries(Map.entry("FROM", 1), Map.entry("EVAL", 1), Map.entry("LOOKUP JOIN", 1))
147-
: Collections.emptyMap(),
148-
Build.current().isSnapshot() ? Map.ofEntries(Map.entry("TO_STRING", 1)) : Collections.emptyMap(),
149-
Build.current().isSnapshot()
145+
Map.ofEntries(Map.entry("FROM", 1), Map.entry("EVAL", 1), Map.entry("LOOKUP JOIN", 1)),
146+
Map.ofEntries(Map.entry("TO_STRING", 1)),
147+
true
150148
) },
151149
new Object[] {
152150
new Test(

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ SHOW : 'show' -> pushMode(SHOW_MODE);
7373
SORT : 'sort' -> pushMode(EXPRESSION_MODE);
7474
STATS : 'stats' -> pushMode(EXPRESSION_MODE);
7575
WHERE : 'where' -> pushMode(EXPRESSION_MODE);
76+
JOIN_LOOKUP : 'lookup' -> pushMode(JOIN_MODE);
7677
//
7778
// in development
7879
//
@@ -88,11 +89,9 @@ DEV_INLINESTATS : {this.isDevVersion()}? 'inlinestats' -> pushMode(EXPRESSION_
8889
DEV_LOOKUP : {this.isDevVersion()}? 'lookup_🐔' -> pushMode(LOOKUP_MODE);
8990
DEV_METRICS : {this.isDevVersion()}? 'metrics' -> pushMode(METRICS_MODE);
9091
// list of all JOIN commands
91-
DEV_JOIN : {this.isDevVersion()}? 'join' -> pushMode(JOIN_MODE);
9292
DEV_JOIN_FULL : {this.isDevVersion()}? 'full' -> pushMode(JOIN_MODE);
9393
DEV_JOIN_LEFT : {this.isDevVersion()}? 'left' -> pushMode(JOIN_MODE);
9494
DEV_JOIN_RIGHT : {this.isDevVersion()}? 'right' -> pushMode(JOIN_MODE);
95-
DEV_JOIN_LOOKUP : {this.isDevVersion()}? 'lookup' -> pushMode(JOIN_MODE);
9695

9796

9897
//
@@ -556,7 +555,7 @@ LOOKUP_FIELD_WS
556555
//
557556
mode JOIN_MODE;
558557
JOIN_PIPE : PIPE -> type(PIPE), popMode;
559-
JOIN_JOIN : DEV_JOIN -> type(DEV_JOIN);
558+
JOIN : 'join';
560559
JOIN_AS : AS -> type(AS);
561560
JOIN_ON : ON -> type(ON), popMode, pushMode(EXPRESSION_MODE);
562561
USING : 'USING' -> popMode, pushMode(EXPRESSION_MODE);

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

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

0 commit comments

Comments
 (0)