Skip to content

Commit ead6a93

Browse files
authored
[ES|QL] Adding precondition for planning tests including score (#136938)
1 parent 7b7c403 commit ead6a93

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

muted-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -567,12 +567,6 @@ tests:
567567
- class: org.elasticsearch.xpack.esql.qa.mixed.FieldExtractorIT
568568
method: testTextFieldWithKeywordSubfield {STORED}
569569
issue: https://github.com/elastic/elasticsearch/issues/136918
570-
- class: org.elasticsearch.xpack.esql.optimizer.LogicalPlanOptimizerTests
571-
method: testEvalWithScoreExplicitLimit
572-
issue: https://github.com/elastic/elasticsearch/issues/136920
573-
- class: org.elasticsearch.xpack.esql.optimizer.LogicalPlanOptimizerTests
574-
method: testEvalWithScoreImplicitLimit
575-
issue: https://github.com/elastic/elasticsearch/issues/136921
576570
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
577571
method: test {p0=ml/sparse_vector_search/Test sparse_vector search with query vector and pruning config}
578572
issue: https://github.com/elastic/elasticsearch/issues/136061

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ public class LogicalPlanOptimizerTests extends AbstractLogicalPlanOptimizerTests
211211
private static final LiteralsOnTheRight LITERALS_ON_THE_RIGHT = new LiteralsOnTheRight();
212212

213213
public void testEvalWithScoreImplicitLimit() {
214+
assumeTrue("[SCORE] function is only available in snapshot builds", EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled());
215+
214216
var plan = plan("""
215217
FROM test
216218
| EVAL s = SCORE(MATCH(last_name, "high"))
@@ -224,6 +226,8 @@ public void testEvalWithScoreImplicitLimit() {
224226
}
225227

226228
public void testEvalWithScoreExplicitLimit() {
229+
assumeTrue("[SCORE] function is only available in snapshot builds", EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled());
230+
227231
var plan = plan("""
228232
FROM test
229233
| EVAL s = SCORE(MATCH(last_name, "high"))

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/PhysicalPlanOptimizerTests.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,11 @@ public void testTripleExtractorPerField() {
670670
* [[QueryBuilderAndTags{queryBuilder=[null], tags=[]}]]
671671
*/
672672
public void testEvalWithScoreImplicitLimit() {
673+
assumeTrue("[SCORE] function is only available in snapshot builds", EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled());
674+
673675
var plan = physicalPlan("""
674-
from test
675-
| eval s = score(match(first_name, "foo"))
676+
FROM test
677+
| EVAL s = SCORE(MATCH(first_name, "foo"))
676678
""");
677679

678680
var optimized = optimizedPlan(plan);
@@ -702,10 +704,12 @@ public void testEvalWithScoreImplicitLimit() {
702704
* [[QueryBuilderAndTags{queryBuilder=[null], tags=[]}]]
703705
*/
704706
public void testEvalWithScoreExplicitLimit() {
707+
assumeTrue("[SCORE] function is only available in snapshot builds", EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled());
708+
705709
var plan = physicalPlan("""
706-
from test
707-
| eval s = score(match(first_name, "foo"))
708-
| limit 42
710+
FROM test
711+
| EVAL s = SCORE(MATCH(first_name, "foo"))
712+
| LIMIT 42
709713
""");
710714

711715
var optimized = optimizedPlan(plan);
@@ -743,6 +747,8 @@ public void testEvalWithScoreExplicitLimit() {
743747
* }], tags=[]}]]
744748
**/
745749
public void testEvalWithScoreAndFilterOnEval() {
750+
assumeTrue("[SCORE] function is only available in snapshot builds", EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled());
751+
746752
var plan = physicalPlan("""
747753
FROM test
748754
| EVAL s = SCORE(MATCH(first_name, "foo"))
@@ -796,6 +802,8 @@ public void testEvalWithScoreAndFilterOnEval() {
796802
* }], tags=[]}]]
797803
**/
798804
public void testEvalWithScoreAndGenericFilter() {
805+
assumeTrue("[SCORE] function is only available in snapshot builds", EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled());
806+
799807
var plan = physicalPlan("""
800808
FROM test
801809
| EVAL s = SCORE(MATCH(first_name, "foo"))
@@ -847,6 +855,8 @@ public void testEvalWithScoreAndGenericFilter() {
847855
* }], tags=[]}]]
848856
*/
849857
public void testEvalWithScoreForTopN() {
858+
assumeTrue("[SCORE] function is only available in snapshot builds", EsqlCapabilities.Cap.SCORE_FUNCTION.isEnabled());
859+
850860
var plan = physicalPlan("""
851861
FROM test
852862
| EVAL s = SCORE(MATCH(first_name, "foo"))

0 commit comments

Comments
 (0)