Skip to content

Commit 8db3ee4

Browse files
ES|QL: Split JOIN yaml tests so that non-alias queries run also on bwc (#128884)
1 parent 36828e2 commit 8db3ee4

File tree

6 files changed

+215
-98
lines changed

6 files changed

+215
-98
lines changed

muted-tests.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -507,18 +507,6 @@ tests:
507507
- class: org.elasticsearch.index.store.DirectIOIT
508508
method: testDirectIOUsed
509509
issue: https://github.com/elastic/elasticsearch/issues/128829
510-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
511-
method: test {p0=esql/190_lookup_join/alias-repeated-index}
512-
issue: https://github.com/elastic/elasticsearch/issues/128849
513-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
514-
method: test {p0=esql/190_lookup_join/alias-repeated-alias}
515-
issue: https://github.com/elastic/elasticsearch/issues/128850
516-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
517-
method: test {p0=esql/190_lookup_join/alias-pattern-single}
518-
issue: https://github.com/elastic/elasticsearch/issues/128855
519-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
520-
method: test {p0=esql/191_lookup_join_on_datastreams/data streams supported in LOOKUP JOIN}
521-
issue: https://github.com/elastic/elasticsearch/issues/128856
522510
- class: org.elasticsearch.upgrades.IndexSortUpgradeIT
523511
method: testIndexSortForNumericTypes {upgradedNodes=3}
524512
issue: https://github.com/elastic/elasticsearch/issues/128861

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ public enum Cap {
11641164
/**
11651165
* Enable support for index aliases in lookup joins
11661166
*/
1167-
ENABLE_LOOKUP_JOIN_ON_ALIASES(JOIN_LOOKUP_V12.isEnabled());
1167+
ENABLE_LOOKUP_JOIN_ON_ALIASES;
11681168

11691169
private final boolean enabled;
11701170

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public void writeTo(StreamOutput out) throws IOException {
203203
|| out.getTransportVersion().isPatchFrom(TransportVersions.JOIN_ON_ALIASES_8_19)) {
204204
out.writeString(indexPattern);
205205
} else if (indexPattern.equals(shardId.getIndexName()) == false) {
206-
throw new EsqlIllegalArgumentException("Aliases and index patterns are not allowed for LOOKUP JOIN []", indexPattern);
206+
throw new EsqlIllegalArgumentException("Aliases and index patterns are not allowed for LOOKUP JOIN [{}]", indexPattern);
207207
}
208208

209209
out.writeString(inputDataType.typeName());

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/190_lookup_join.yml

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ setup:
66
- method: POST
77
path: /_query
88
parameters: []
9-
capabilities: [join_lookup_v12, enable_lookup_join_on_aliases]
9+
capabilities: [join_lookup_v12]
1010
reason: "uses LOOKUP JOIN"
1111
- do:
1212
indices.create:
@@ -80,19 +80,6 @@ setup:
8080
type: long
8181
color:
8282
type: keyword
83-
- do:
84-
indices.update_aliases:
85-
body:
86-
actions:
87-
- add:
88-
index: test-lookup-1
89-
alias: test-lookup-alias
90-
- add:
91-
index: test-lookup-*
92-
alias: test-lookup-alias-pattern-multiple
93-
- add:
94-
index: test-lookup-1*
95-
alias: test-lookup-alias-pattern-single
9683
- do:
9784
bulk:
9885
index: "test"
@@ -168,76 +155,6 @@ non-lookup index:
168155
- match: { error.type: "verification_exception" }
169156
- contains: { error.reason: "Found 1 problem\nline 1:45: invalid [test] resolution in lookup mode to an index in [standard] mode" }
170157

171-
---
172-
173-
"Alias as lookup index":
174-
- skip:
175-
awaits_fix: "LOOKUP JOIN does not support index aliases for now"
176-
- do:
177-
esql.query:
178-
body:
179-
query: 'FROM test | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'
180-
181-
- match: {columns.0.name: "key"}
182-
- match: {columns.0.type: "long"}
183-
- match: {columns.1.name: "color"}
184-
- match: {columns.1.type: "keyword"}
185-
- match: {values.0: [1, "cyan"]}
186-
- match: {values.1: [2, "yellow"]}
187-
188-
---
189-
alias-repeated-alias:
190-
- do:
191-
esql.query:
192-
body:
193-
query: 'FROM test-lookup-alias | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'
194-
195-
- match: {columns.0.name: "key"}
196-
- match: {columns.0.type: "long"}
197-
- match: {columns.1.name: "color"}
198-
- match: {columns.1.type: "keyword"}
199-
- match: {values.0: [1, "cyan"]}
200-
- match: {values.1: [2, "yellow"]}
201-
202-
---
203-
alias-repeated-index:
204-
- do:
205-
esql.query:
206-
body:
207-
query: 'FROM test-lookup-1 | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'
208-
209-
- match: {columns.0.name: "key"}
210-
- match: {columns.0.type: "long"}
211-
- match: {columns.1.name: "color"}
212-
- match: {columns.1.type: "keyword"}
213-
- match: {values.0: [1, "cyan"]}
214-
- match: {values.1: [2, "yellow"]}
215-
216-
---
217-
alias-pattern-multiple:
218-
- do:
219-
esql.query:
220-
body:
221-
query: 'FROM test-lookup-1 | LOOKUP JOIN test-lookup-alias-pattern-multiple ON key'
222-
catch: "bad_request"
223-
224-
- match: { error.type: "verification_exception" }
225-
- contains: { error.reason: "Found 1 problem\nline 1:34: invalid [test-lookup-alias-pattern-multiple] resolution in lookup mode to [4] indices" }
226-
227-
---
228-
alias-pattern-single:
229-
- do:
230-
esql.query:
231-
body:
232-
query: 'FROM test | SORT key | LOOKUP JOIN test-lookup-alias-pattern-single ON key | LIMIT 3'
233-
234-
- match: {columns.0.name: "key"}
235-
- match: {columns.0.type: "long"}
236-
- match: {columns.1.name: "color"}
237-
- match: {columns.1.type: "keyword"}
238-
- match: {values.0: [1, "cyan"]}
239-
- match: {values.1: [2, "yellow"]}
240-
241158
---
242159
pattern-multiple:
243160
- do:
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
---
2+
setup:
3+
- requires:
4+
test_runner_features: [capabilities, contains, allowed_warnings]
5+
capabilities:
6+
- method: POST
7+
path: /_query
8+
parameters: []
9+
capabilities: [enable_lookup_join_on_aliases]
10+
reason: "uses LOOKUP JOIN on aliases"
11+
- do:
12+
indices.create:
13+
index: test
14+
body:
15+
mappings:
16+
properties:
17+
key:
18+
type: long
19+
color:
20+
type: keyword
21+
- do:
22+
indices.create:
23+
index: test-mv
24+
body:
25+
mappings:
26+
properties:
27+
key:
28+
type: long
29+
color:
30+
type: keyword
31+
- do:
32+
indices.create:
33+
index: test-lookup-1
34+
body:
35+
settings:
36+
index:
37+
mode: lookup
38+
mappings:
39+
properties:
40+
key:
41+
type: long
42+
color:
43+
type: keyword
44+
- do:
45+
indices.create:
46+
index: test-lookup-2
47+
body:
48+
settings:
49+
index:
50+
mode: lookup
51+
mappings:
52+
properties:
53+
key:
54+
type: long
55+
color:
56+
type: keyword
57+
- do:
58+
indices.create:
59+
index: test-lookup-mv
60+
body:
61+
settings:
62+
index:
63+
mode: lookup
64+
mappings:
65+
properties:
66+
key:
67+
type: long
68+
color:
69+
type: keyword
70+
- do:
71+
indices.create:
72+
index: test-lookup-no-key
73+
body:
74+
settings:
75+
index:
76+
mode: lookup
77+
mappings:
78+
properties:
79+
no-key:
80+
type: long
81+
color:
82+
type: keyword
83+
- do:
84+
indices.update_aliases:
85+
body:
86+
actions:
87+
- add:
88+
index: test-lookup-1
89+
alias: test-lookup-alias
90+
- add:
91+
index: test-lookup-*
92+
alias: test-lookup-alias-pattern-multiple
93+
- add:
94+
index: test-lookup-1*
95+
alias: test-lookup-alias-pattern-single
96+
- do:
97+
bulk:
98+
index: "test"
99+
refresh: true
100+
body:
101+
- { "index": { } }
102+
- { "key": 1, "color": "red" }
103+
- { "index": { } }
104+
- { "key": 2, "color": "blue" }
105+
- do:
106+
bulk:
107+
index: "test-lookup-1"
108+
refresh: true
109+
body:
110+
- { "index": { } }
111+
- { "key": 1, "color": "cyan" }
112+
- { "index": { } }
113+
- { "key": 2, "color": "yellow" }
114+
- do:
115+
bulk:
116+
index: "test-mv"
117+
refresh: true
118+
body:
119+
- { "index": { } }
120+
- { "key": 1, "color": "red" }
121+
- { "index": { } }
122+
- { "key": 2, "color": "blue" }
123+
- { "index": { } }
124+
- { "key": [0, 1, 2], "color": null }
125+
- do:
126+
bulk:
127+
index: "test-lookup-mv"
128+
refresh: true
129+
body:
130+
- { "index": { } }
131+
- { "key": 1, "color": "cyan" }
132+
- { "index": { } }
133+
- { "key": 2, "color": "yellow" }
134+
- { "index": { } }
135+
- { "key": [0, 1, 2], "color": "green" }
136+
- do:
137+
bulk:
138+
index: "test-lookup-no-key"
139+
refresh: true
140+
body:
141+
- { "index": { } }
142+
- { "no-key": 1, "color": "cyan" }
143+
- { "index": { } }
144+
- { "no-key": 2, "color": "yellow" }
145+
146+
---
147+
alias-as-lookup-index:
148+
- do:
149+
esql.query:
150+
body:
151+
query: 'FROM test | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'
152+
153+
- match: {columns.0.name: "key"}
154+
- match: {columns.0.type: "long"}
155+
- match: {columns.1.name: "color"}
156+
- match: {columns.1.type: "keyword"}
157+
- match: {values.0: [1, "cyan"]}
158+
- match: {values.1: [2, "yellow"]}
159+
160+
---
161+
alias-repeated-alias:
162+
- do:
163+
esql.query:
164+
body:
165+
query: 'FROM test-lookup-alias | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'
166+
167+
- match: {columns.0.name: "key"}
168+
- match: {columns.0.type: "long"}
169+
- match: {columns.1.name: "color"}
170+
- match: {columns.1.type: "keyword"}
171+
- match: {values.0: [1, "cyan"]}
172+
- match: {values.1: [2, "yellow"]}
173+
174+
---
175+
alias-repeated-index:
176+
- do:
177+
esql.query:
178+
body:
179+
query: 'FROM test-lookup-1 | SORT key | LOOKUP JOIN test-lookup-alias ON key | LIMIT 3'
180+
181+
- match: {columns.0.name: "key"}
182+
- match: {columns.0.type: "long"}
183+
- match: {columns.1.name: "color"}
184+
- match: {columns.1.type: "keyword"}
185+
- match: {values.0: [1, "cyan"]}
186+
- match: {values.1: [2, "yellow"]}
187+
188+
---
189+
alias-pattern-multiple:
190+
- do:
191+
esql.query:
192+
body:
193+
query: 'FROM test-lookup-1 | LOOKUP JOIN test-lookup-alias-pattern-multiple ON key'
194+
catch: "bad_request"
195+
196+
- match: { error.type: "verification_exception" }
197+
- contains: { error.reason: "Found 1 problem\nline 1:34: invalid [test-lookup-alias-pattern-multiple] resolution in lookup mode to [4] indices" }
198+
199+
---
200+
alias-pattern-single:
201+
- do:
202+
esql.query:
203+
body:
204+
query: 'FROM test | SORT key | LOOKUP JOIN test-lookup-alias-pattern-single ON key | LIMIT 3'
205+
206+
- match: {columns.0.name: "key"}
207+
- match: {columns.0.type: "long"}
208+
- match: {columns.1.name: "color"}
209+
- match: {columns.1.type: "keyword"}
210+
- match: {values.0: [1, "cyan"]}
211+
- match: {values.1: [2, "yellow"]}

x-pack/qa/multi-project/xpack-rest-tests-with-multiple-projects/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ tasks.named("yamlRestTest").configure {
4646
'^esql/190_lookup_join/*',
4747
'^esql/191_lookup_join_on_datastreams/*',
4848
'^esql/191_lookup_join_text/*',
49+
'^esql/192_lookup_join_on_aliases/*',
4950
'^health/10_usage/*',
5051
'^ilm/10_basic/Test Undeletable Policy In Use',
5152
'^ilm/20_move_to_step/*',

0 commit comments

Comments
 (0)