Skip to content

Commit 02f8748

Browse files
committed
Changed error message
1 parent 52dd7b9 commit 02f8748

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

docs/changelog/125479.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pr: 125479
2-
summary: ES|QL - Allow full text functions to be used in STATS ... WHERE
2+
summary: ES|QL - Allow full text functions to be used in STATS
33
area: ES|QL
44
type: enhancement
55
issues:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void testKqlQueryWithinEval() {
6666
""";
6767

6868
var error = expectThrows(VerificationException.class, () -> run(query));
69-
assertThat(error.getMessage(), containsString("[KQL] function is only supported in WHERE and STATS ... WHERE commands"));
69+
assertThat(error.getMessage(), containsString("[KQL] function is only supported in WHERE and STATS commands"));
7070
}
7171

7272
public void testInvalidKqlQueryEof() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public void testMatchWithStats() {
253253
""";
254254

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

258258
var query = """
259259
FROM test
@@ -274,7 +274,7 @@ public void testMatchWithinEval() {
274274
""";
275275

276276
var error = expectThrows(VerificationException.class, () -> run(query));
277-
assertThat(error.getMessage(), containsString("[MATCH] function is only supported in WHERE and STATS ... WHERE commands"));
277+
assertThat(error.getMessage(), containsString("[MATCH] function is only supported in WHERE and STATS commands"));
278278
}
279279

280280
private void createAndPopulateIndex() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public void testMatchWithinEval() {
354354
""";
355355

356356
var error = expectThrows(VerificationException.class, () -> run(query));
357-
assertThat(error.getMessage(), containsString("[:] operator is only supported in WHERE and STATS ... WHERE commands"));
357+
assertThat(error.getMessage(), containsString("[:] operator is only supported in WHERE and STATS commands"));
358358
}
359359

360360
public void testMatchWithNonTextField() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void testQueryStringWithinEval() {
6363
""";
6464

6565
var error = expectThrows(VerificationException.class, () -> run(query));
66-
assertThat(error.getMessage(), containsString("[QSTR] function is only supported in WHERE and STATS ... WHERE commands"));
66+
assertThat(error.getMessage(), containsString("[QSTR] function is only supported in WHERE and STATS commands"));
6767
}
6868

6969
public void testInvalidQueryStringEof() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void testTermWithinEval() {
5757
""";
5858

5959
var error = expectThrows(VerificationException.class, () -> run(query));
60-
assertThat(error.getMessage(), containsString("[Term] function is only supported in WHERE and STATS ... WHERE commands"));
60+
assertThat(error.getMessage(), containsString("[Term] function is only supported in WHERE and STATS commands"));
6161
}
6262

6363
public void testMultipleTerm() {

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
@@ -1067,7 +1067,7 @@ public enum Cap {
10671067
FIRST_OVER_TIME(Build.current().isSnapshot()),
10681068

10691069
/**
1070-
* Full text functions in STATS ... WHERE
1070+
* Full text functions in STATS
10711071
*/
10721072
FULL_TEXT_FUNCTIONS_IN_STATS_WHERE;
10731073

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/FullTextFunction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private static void checkFullTextQueryFunctions(LogicalPlan plan, Failures failu
231231
} else {
232232
plan.forEachExpression(FullTextFunction.class, ftf -> {
233233
failures.add(
234-
fail(ftf, "[{}] {} is only supported in WHERE and STATS ... WHERE commands", ftf.functionName(), ftf.functionType())
234+
fail(ftf, "[{}] {} is only supported in WHERE and STATS commands", ftf.functionName(), ftf.functionType())
235235
);
236236
});
237237
}
@@ -242,7 +242,7 @@ private static void checkFullTextFunctionsInAggs(Aggregate agg, Failures failure
242242
exp.forEachDown(e -> {
243243
if (e instanceof FullTextFunction ftf) {
244244
failures.add(
245-
fail(ftf, "[{}] {} is only supported in WHERE and STATS ... WHERE commands", ftf.functionName(), ftf.functionType())
245+
fail(ftf, "[{}] {} is only supported in WHERE and STATS commands", ftf.functionName(), ftf.functionType())
246246
);
247247
}
248248
});

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ public void testWeightedAvg() {
12091209

12101210
public void testMatchInsideEval() throws Exception {
12111211
assertEquals(
1212-
"1:36: [:] operator is only supported in WHERE and STATS ... WHERE commands\n"
1212+
"1:36: [:] operator is only supported in WHERE and STATS commands\n"
12131213
+ "line 1:36: [:] operator cannot operate on [title], which is not a field from an index mapping",
12141214
error("row title = \"brown fox\" | eval x = title:\"fox\" ")
12151215
);
@@ -1369,12 +1369,12 @@ public void testKqlFunctionsNotAllowedAfterCommands() throws Exception {
13691369
}
13701370

13711371
public void testQueryStringFunctionOnlyAllowedInWhere() throws Exception {
1372-
assertEquals("1:9: [QSTR] function is only supported in WHERE and STATS ... WHERE commands", error("row a = qstr(\"Anna\")"));
1372+
assertEquals("1:9: [QSTR] function is only supported in WHERE and STATS commands", error("row a = qstr(\"Anna\")"));
13731373
checkFullTextFunctionsOnlyAllowedInWhere("QSTR", "qstr(\"Anna\")", "function");
13741374
}
13751375

13761376
public void testKqlFunctionOnlyAllowedInWhere() throws Exception {
1377-
assertEquals("1:9: [KQL] function is only supported in WHERE and STATS ... WHERE commands", error("row a = kql(\"Anna\")"));
1377+
assertEquals("1:9: [KQL] function is only supported in WHERE and STATS commands", error("row a = kql(\"Anna\")"));
13781378
checkFullTextFunctionsOnlyAllowedInWhere("KQL", "kql(\"Anna\")", "function");
13791379
}
13801380

@@ -1394,15 +1394,15 @@ public void testMatchOperatornOnlyAllowedInWhere() throws Exception {
13941394
private void checkFullTextFunctionsOnlyAllowedInWhere(String functionName, String functionInvocation, String functionType)
13951395
throws Exception {
13961396
assertEquals(
1397-
"1:22: [" + functionName + "] " + functionType + " is only supported in WHERE and STATS ... WHERE commands",
1397+
"1:22: [" + functionName + "] " + functionType + " is only supported in WHERE and STATS commands",
13981398
error("from test | eval y = " + functionInvocation)
13991399
);
14001400
assertEquals(
1401-
"1:18: [" + functionName + "] " + functionType + " is only supported in WHERE and STATS ... WHERE commands",
1401+
"1:18: [" + functionName + "] " + functionType + " is only supported in WHERE and STATS commands",
14021402
error("from test | sort " + functionInvocation + " asc")
14031403
);
14041404
assertEquals(
1405-
"1:47: [" + functionName + "] " + functionType + " is only supported in WHERE and STATS ... WHERE commands",
1405+
"1:47: [" + functionName + "] " + functionType + " is only supported in WHERE and STATS commands",
14061406
error("from test | stats max_salary = max(salary) by " + functionInvocation)
14071407
);
14081408
}
@@ -2478,7 +2478,7 @@ public void testMultiMatchTargetsExistingField() throws Exception {
24782478
public void testMultiMatchInsideEval() throws Exception {
24792479
assumeTrue("MultiMatch operator is available just for snapshots", Build.current().isSnapshot());
24802480
assertEquals(
2481-
"1:36: [MultiMatch] function is only supported in WHERE and STATS ... WHERE commands\n"
2481+
"1:36: [MultiMatch] function is only supported in WHERE and STATS commands\n"
24822482
+ "line 1:55: [MultiMatch] function cannot operate on [title], which is not a field from an index mapping",
24832483
error("row title = \"brown fox\" | eval x = multi_match(\"fox\", title)")
24842484
);

0 commit comments

Comments
 (0)