Skip to content

Commit

Permalink
Remove assumeTrues
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdelest committed Oct 10, 2024
1 parent 799b007 commit 6c7e01d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1089,8 +1089,6 @@ public void testMatchFilter() throws Exception {
}

public void testMatchFunctionNotAllowedAfterCommands() throws Exception {
assumeTrue("skipping because MATCH is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());

assertEquals(
"1:24: [MATCH] function cannot be used after LIMIT",
error("from test | limit 10 | where match(first_name, \"Anna\")")
Expand Down Expand Up @@ -1193,8 +1191,6 @@ public void testQueryStringWithDisjunctions() {
}

public void testMatchWithDisjunctions() {
assumeTrue("skipping because MATCH is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());

checkWithDisjunctions("MATCH", "match(first_name, \"Anna\")");
}

Expand Down Expand Up @@ -1239,8 +1235,6 @@ public void testQueryStringFunctionWithNonBooleanFunctions() {
}

public void testMatchFunctionWithNonBooleanFunctions() {
assumeTrue("skipping because MATCH is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());

checkFullTextFunctionsWithNonBooleanFunctions("MATCH", "match(first_name, \"Anna\")");
}

Expand All @@ -1264,8 +1258,6 @@ private void checkFullTextFunctionsWithNonBooleanFunctions(String functionName,
}

public void testMatchFunctionArgNotConstant() throws Exception {
assumeTrue("skipping because MATCH is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());

assertEquals(
"1:19: second argument of [match(first_name, first_name)] must be a constant, received [first_name]",
error("from test | where match(first_name, first_name)")
Expand All @@ -1279,17 +1271,13 @@ public void testMatchFunctionArgNotConstant() throws Exception {

// These should pass eventually once we lift some restrictions on match function
public void testMatchFunctionCurrentlyUnsupportedBehaviour() throws Exception {
assumeTrue("skipping because MATCH is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());

assertEquals(
"1:68: Unknown column [first_name]",
error("from test | stats max_salary = max(salary) by emp_no | where match(first_name, \"Anna\")")
);
}

public void testMatchFunctionNullArgs() throws Exception {
assumeTrue("skipping because MATCH is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());

assertEquals(
"1:19: first argument of [match(null, \"query\")] cannot be null, received [null]",
error("from test | where match(null, \"query\")")
Expand All @@ -1301,8 +1289,6 @@ public void testMatchFunctionNullArgs() throws Exception {
}

public void testMatchFunctionTargetsExistingField() throws Exception {
assumeTrue("skipping because MATCH is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());

assertEquals("1:39: Unknown column [first_name]", error("from test | keep emp_no | where match(first_name, \"Anna\")"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.elasticsearch.xpack.core.enrich.EnrichPolicy;
import org.elasticsearch.xpack.esql.EsqlTestUtils;
import org.elasticsearch.xpack.esql.EsqlTestUtils.TestSearchStats;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
import org.elasticsearch.xpack.esql.analysis.Analyzer;
import org.elasticsearch.xpack.esql.analysis.AnalyzerContext;
import org.elasticsearch.xpack.esql.analysis.EnrichResolution;
Expand Down Expand Up @@ -545,7 +544,6 @@ public void testQueryStringFunctionMultipleQstrClauses() {
* \_EsQueryExec[test], indexMode[standard], query[{"match":{"last_name":{"query":"Smith"}}}]
*/
public void testMatchFunction() {
assumeTrue("skipping because MATCH function is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());
var plan = plannerOptimizer.plan("""
from test
| where match(last_name, "Smith")
Expand Down Expand Up @@ -574,7 +572,6 @@ public void testMatchFunction() {
* "source":"emp_no > 10010@2:39"}}],"boost":1.0}}][_doc{f}#14], limit[1000], sort[] estimatedRowSize[324]
*/
public void testMatchFunctionConjunctionWhereOperands() {
assumeTrue("skipping because MATCH function is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());
String queryText = """
from test
| where match(last_name, "Smith") and emp_no > 10010
Expand Down Expand Up @@ -609,7 +606,6 @@ public void testMatchFunctionConjunctionWhereOperands() {
* "source":"cidr_match(ip, \"127.0.0.1/32\")@2:33"}}],"boost":1.0}}][_doc{f}#22], limit[1000], sort[] estimatedRowSize[354]
*/
public void testMatchFunctionWithFunctionsPushedToLucene() {
assumeTrue("skipping because MATCH function is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());
String queryText = """
from test
| where match(text, "beta") and cidr_match(ip, "127.0.0.1/32")
Expand Down Expand Up @@ -644,7 +640,6 @@ public void testMatchFunctionWithFunctionsPushedToLucene() {
* "source":"emp_no > 10010@3:9"}}],"boost":1.0}}][_doc{f}#14], limit[1000], sort[] estimatedRowSize[324]
*/
public void testMatchFunctionMultipleWhereClauses() {
assumeTrue("skipping because MATCH function is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());
String queryText = """
from test
| where match(last_name, "Smith")
Expand Down Expand Up @@ -678,7 +673,6 @@ public void testMatchFunctionMultipleWhereClauses() {
* {"match":{"first_name":{"query":"John"}}}],"boost":1.0}}][_doc{f}#14], limit[1000], sort[] estimatedRowSize[324]
*/
public void testMatchFunctionMultipleQstrClauses() {
assumeTrue("skipping because MATCH function is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());
String queryText = """
from test
| where match(last_name, "Smith") and match(first_name, "John")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.elasticsearch.xpack.esql.EsqlTestUtils;
import org.elasticsearch.xpack.esql.TestBlockFactory;
import org.elasticsearch.xpack.esql.VerificationException;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
import org.elasticsearch.xpack.esql.analysis.Analyzer;
import org.elasticsearch.xpack.esql.analysis.AnalyzerContext;
import org.elasticsearch.xpack.esql.analysis.AnalyzerTestUtils;
Expand Down Expand Up @@ -5568,8 +5567,6 @@ public void testToDatePeriodToTimeDurationWithField() {

// These should pass eventually once we lift some restrictions on match function
public void testMatchWithNonIndexedColumnCurrentlyUnsupported() {
assumeTrue("skipping because MATCH function is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());

final String header = "Found 1 problem\nline ";
VerificationException e = expectThrows(VerificationException.class, () -> plan("""
from test | eval initial = substring(first_name, 1) | where match(initial, "A")"""));
Expand All @@ -5589,8 +5586,6 @@ public void testMatchWithNonIndexedColumnCurrentlyUnsupported() {
}

public void testMatchFunctionIsNotNullable() {
assumeTrue("skipping because MATCH function is not enabled", EsqlCapabilities.Cap.MATCH_FUNCTION.isEnabled());

String queryText = """
row n = null | eval text = n + 5 | where match(text::keyword, "Anna")
""";
Expand Down

0 comments on commit 6c7e01d

Please sign in to comment.