Skip to content

Commit ff1ad0c

Browse files
authored
Check SCORE_FUNCTION capability in VerifierTests (#131352)
1 parent 1832248 commit ff1ad0c

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,6 @@ tests:
427427
- class: org.elasticsearch.xpack.esql.expression.function.fulltext.ScoreTests
428428
method: testSerializationOfSimple {TestCase=<boolean>}
429429
issue: https://github.com/elastic/elasticsearch/issues/131334
430-
- class: org.elasticsearch.xpack.esql.analysis.VerifierTests
431-
method: testFullTextFunctionsOnlyAllowedInWhere
432-
issue: https://github.com/elastic/elasticsearch/issues/131335
433430
- class: org.elasticsearch.xpack.esql.analysis.VerifierTests
434431
method: testMatchInsideEval
435432
issue: https://github.com/elastic/elasticsearch/issues/131336

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,9 @@ public void testWeightedAvg() {
12131213

12141214
public void testMatchInsideEval() throws Exception {
12151215
assertEquals(
1216-
"1:36: [:] operator is only supported in WHERE and STATS commands, or in EVAL within score(.) function\n"
1216+
"1:36: [:] operator is only supported in WHERE and STATS commands"
1217+
+ (EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled() ? ", or in EVAL within score(.) function" : "")
1218+
+ "\n"
12171219
+ "line 1:36: [:] operator cannot operate on [title], which is not a field from an index mapping",
12181220
error("row title = \"brown fox\" | eval x = title:\"fox\" ")
12191221
);
@@ -1385,7 +1387,8 @@ private void checkFullTextFunctionsOnlyAllowedInWhere(String functionName, Strin
13851387
+ functionName
13861388
+ "] "
13871389
+ functionType
1388-
+ " is only supported in WHERE and STATS commands, or in EVAL within score(.) function"
1390+
+ " is only supported in WHERE and STATS commands"
1391+
+ (EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled() ? ", or in EVAL within score(.) function" : "")
13891392
)
13901393
);
13911394
assertThat(
@@ -1400,7 +1403,14 @@ private void checkFullTextFunctionsOnlyAllowedInWhere(String functionName, Strin
14001403
if ("KQL".equals(functionName) || "QSTR".equals(functionName)) {
14011404
assertThat(
14021405
error("row a = " + functionInvocation, fullTextAnalyzer),
1403-
containsString("[" + functionName + "] " + functionType + " is only supported in WHERE and STATS commands")
1406+
containsString(
1407+
"["
1408+
+ functionName
1409+
+ "] "
1410+
+ functionType
1411+
+ " is only supported in WHERE and STATS commands"
1412+
+ (EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled() ? ", or in EVAL within score(.) function" : "")
1413+
)
14041414
);
14051415
}
14061416
}

0 commit comments

Comments
 (0)