Skip to content

Commit f71620c

Browse files
committed
Fix tests
1 parent 9b9c150 commit f71620c

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void testMultipleMatchPhrase() {
7171
try (var resp = run(query)) {
7272
assertColumnNames(resp.columns(), List.of("id"));
7373
assertColumnTypes(resp.columns(), List.of("integer"));
74-
assertValues(resp.values(), List.of(List.of(1), List.of(6)));
74+
assertValues(resp.values(), List.of(List.of(6)));
7575
}
7676
}
7777

@@ -87,7 +87,7 @@ public void testMultipleWhereMatchPhrase() {
8787
""";
8888

8989
var error = expectThrows(ElasticsearchException.class, () -> run(query));
90-
assertThat(error.getMessage(), containsString("[MATCH_PHRASE] function cannot be used after LIMIT"));
90+
assertThat(error.getMessage(), containsString("[MatchPhrase] function cannot be used after LIMIT"));
9191
}
9292

9393
public void testNotWhereMatchPhrase() {
@@ -101,7 +101,7 @@ public void testNotWhereMatchPhrase() {
101101
try (var resp = run(query)) {
102102
assertColumnNames(resp.columns(), List.of("id"));
103103
assertColumnTypes(resp.columns(), List.of("integer"));
104-
assertValues(resp.values(), List.of(List.of(5)));
104+
assertValues(resp.values(), List.of(List.of(2), List.of(3), List.of(4), List.of(5)));
105105
}
106106
}
107107

@@ -117,7 +117,7 @@ public void testWhereMatchPhraseWithScoring() {
117117
try (var resp = run(query)) {
118118
assertColumnNames(resp.columns(), List.of("id", "_score"));
119119
assertColumnTypes(resp.columns(), List.of("integer", "double"));
120-
assertValues(resp.values(), List.of(List.of(1, 1.156558871269226), List.of(6, 0.9114001989364624)));
120+
assertValues(resp.values(), List.of(List.of(1, 1.4274532794952393), List.of(6, 1.1248723268508911)));
121121
}
122122
}
123123

@@ -134,7 +134,7 @@ public void testWhereMatchPhraseWithScoringDifferentSort() {
134134
try (var resp = run(query)) {
135135
assertColumnNames(resp.columns(), List.of("id", "_score"));
136136
assertColumnTypes(resp.columns(), List.of("integer", "double"));
137-
assertValues(resp.values(), List.of(List.of(6, 0.9114001989364624), List.of(1, 1.156558871269226)));
137+
assertValues(resp.values(), List.of(List.of(6, 1.1248723268508911), List.of(1, 1.4274532794952393)));
138138
}
139139
}
140140

@@ -150,7 +150,7 @@ public void testWhereMatchPhraseWithScoringSortScore() {
150150
try (var resp = run(query)) {
151151
assertColumnNames(resp.columns(), List.of("id", "_score"));
152152
assertColumnTypes(resp.columns(), List.of("integer", "double"));
153-
assertValues(resp.values(), List.of(List.of(1, 1.156558871269226), List.of(6, 0.9114001989364624)));
153+
assertValues(resp.values(), List.of(List.of(1, 1.4274532794952393), List.of(6, 1.1248723268508911)));
154154
}
155155
}
156156

@@ -165,7 +165,7 @@ public void testWhereMatchPhraseWithScoringNoSort() {
165165
try (var resp = run(query)) {
166166
assertColumnNames(resp.columns(), List.of("id", "_score"));
167167
assertColumnTypes(resp.columns(), List.of("integer", "double"));
168-
assertValuesInAnyOrder(resp.values(), List.of(List.of(1, 1.156558871269226), List.of(6, 0.9114001989364624)));
168+
assertValuesInAnyOrder(resp.values(), List.of(List.of(1, 1.4274532794952393), List.of(6, 1.1248723268508911)));
169169
}
170170
}
171171

@@ -190,7 +190,7 @@ public void testWhereMatchPhraseEvalColumn() {
190190
var error = expectThrows(VerificationException.class, () -> run(query));
191191
assertThat(
192192
error.getMessage(),
193-
containsString("[MATCH_PHRASE] function cannot operate on [upper_content], which is not a field from an index mapping")
193+
containsString("[MatchPhrase] function cannot operate on [upper_content], which is not a field from an index mapping")
194194
);
195195
}
196196

@@ -205,7 +205,7 @@ public void testWhereMatchPhraseOverWrittenColumn() {
205205
var error = expectThrows(VerificationException.class, () -> run(query));
206206
assertThat(
207207
error.getMessage(),
208-
containsString("[MATCH_PHRASE] function cannot operate on [content], which is not a field from an index mapping")
208+
containsString("[MatchPhrase] function cannot operate on [content], which is not a field from an index mapping")
209209
);
210210
}
211211

@@ -223,7 +223,7 @@ public void testWhereMatchPhraseAfterStats() {
223223
public void testWhereMatchPhraseNotPushedDown() {
224224
var query = """
225225
FROM test
226-
| WHERE match(content, "brown fox") OR length(content) < 20
226+
| WHERE match_phrase(content, "brown fox") OR length(content) < 20
227227
| KEEP id
228228
| SORT id
229229
""";
@@ -238,24 +238,24 @@ public void testWhereMatchPhraseNotPushedDown() {
238238
public void testWhereMatchPhraseWithRow() {
239239
var query = """
240240
ROW content = "a brown fox"
241-
| WHERE match(content, "brown fox")
241+
| WHERE match_phrase(content, "brown fox")
242242
""";
243243

244244
var error = expectThrows(ElasticsearchException.class, () -> run(query));
245245
assertThat(
246246
error.getMessage(),
247-
containsString("line 2:15: [MATCH_PHRASE] function cannot operate on [content], which is not a field from an index mapping")
247+
containsString("line 2:22: [MatchPhrase] function cannot operate on [content], which is not a field from an index mapping")
248248
);
249249
}
250250

251-
public void testMatchPhraseithStats() {
251+
public void testMatchPhraseWithStats() {
252252
var errorQuery = """
253253
FROM test
254254
| STATS c = count(*) BY match_phrase(content, "brown fox")
255255
""";
256256

257257
var error = expectThrows(ElasticsearchException.class, () -> run(errorQuery));
258-
assertThat(error.getMessage(), containsString("[MATCH_PHRASE] function is only supported in WHERE and STATS commands"));
258+
assertThat(error.getMessage(), containsString("[MatchPhrase] function is only supported in WHERE and STATS commands"));
259259

260260
var query = """
261261
FROM test
@@ -265,7 +265,7 @@ public void testMatchPhraseithStats() {
265265
try (var resp = run(query)) {
266266
assertColumnNames(resp.columns(), List.of("c", "d"));
267267
assertColumnTypes(resp.columns(), List.of("long", "long"));
268-
assertValues(resp.values(), List.of(List.of(2L, 4L)));
268+
assertValues(resp.values(), List.of(List.of(2L, 1L)));
269269
}
270270

271271
query = """
@@ -291,7 +291,7 @@ public void testMatchPhraseWithinEval() {
291291
""";
292292

293293
var error = expectThrows(VerificationException.class, () -> run(query));
294-
assertThat(error.getMessage(), containsString("[MATCH_PHRASE] function is only supported in WHERE and STATS commands"));
294+
assertThat(error.getMessage(), containsString("[MatchPhrase] function is only supported in WHERE and STATS commands"));
295295
}
296296

297297
private void createAndPopulateIndex() {

0 commit comments

Comments
 (0)