88package org .elasticsearch .xpack .esql .analysis ;
99
1010import org .elasticsearch .Build ;
11- import org .elasticsearch .common .logging .LoggerMessageFormat ;
1211import org .elasticsearch .test .ESTestCase ;
1312import org .elasticsearch .xpack .esql .VerificationException ;
1413import org .elasticsearch .xpack .esql .action .EsqlCapabilities ;
@@ -1190,21 +1189,6 @@ public void testMatchInsideEval() throws Exception {
11901189 );
11911190 }
11921191
1193- public void testMatchFilter () throws Exception {
1194- assertEquals (
1195- "1:19: Invalid condition [first_name:\" Anna\" or starts_with(first_name, \" Anne\" )]. "
1196- + "Full text functions can be used in an OR condition, "
1197- + "but only if just full text functions are used in the OR condition" ,
1198- error ("from test | where first_name:\" Anna\" or starts_with(first_name, \" Anne\" )" )
1199- );
1200-
1201- assertEquals (
1202- "1:51: Invalid condition [first_name:\" Anna\" OR new_salary > 100]. Full text functions can be"
1203- + " used in an OR condition, but only if just full text functions are used in the OR condition" ,
1204- error ("from test | eval new_salary = salary + 10 | where first_name:\" Anna\" OR new_salary > 100" )
1205- );
1206- }
1207-
12081192 public void testMatchFunctionNotAllowedAfterCommands () throws Exception {
12091193 assertEquals (
12101194 "1:24: [MATCH] function cannot be used after LIMIT" ,
@@ -1426,25 +1410,13 @@ public void testMatchOperatorWithDisjunctions() {
14261410 }
14271411
14281412 private void checkWithDisjunctions (String functionName , String functionInvocation , String functionType ) {
1429- String expression = functionInvocation + " or length(first_name) > 12" ;
1430- checkdisjunctionError ("1:19" , expression , functionName , functionType );
1431- expression = "(" + functionInvocation + " or first_name is not null) or (length(first_name) > 12 and match(last_name, \" Smith\" ))" ;
1432- checkdisjunctionError ("1:19" , expression , functionName , functionType );
1433- expression = functionInvocation + " or (last_name is not null and first_name is null)" ;
1434- checkdisjunctionError ("1:19" , expression , functionName , functionType );
1435- }
1436-
1437- private void checkdisjunctionError (String position , String expression , String functionName , String functionType ) {
1438- assertEquals (
1439- LoggerMessageFormat .format (
1440- null ,
1441- "{}: Invalid condition [{}]. Full text functions can be used in an OR condition, "
1442- + "but only if just full text functions are used in the OR condition" ,
1443- position ,
1444- expression
1445- ),
1446- error ("from test | where " + expression )
1413+ query ("from test | where " + functionInvocation + " or length(first_name) > 12" );
1414+ query (
1415+ "from test | where ("
1416+ + functionInvocation
1417+ + " or first_name is not null) or (length(first_name) > 12 and match(last_name, \" Smith\" ))"
14471418 );
1419+ query ("from test | where " + functionInvocation + " or (last_name is not null and first_name is null)" );
14481420 }
14491421
14501422 public void testFullTextFunctionsDisjunctions () {
@@ -1456,17 +1428,13 @@ public void testFullTextFunctionsDisjunctions() {
14561428
14571429 private void checkWithFullTextFunctionsDisjunctions (String functionName , String functionInvocation , String functionType ) {
14581430
1459- String expression = functionInvocation + " or length(first_name) > 10" ;
1460- checkdisjunctionError ("1:19" , expression , functionName , functionType );
1461-
1462- expression = "match(last_name, \" Anneke\" ) or (" + functionInvocation + " and length(first_name) > 10)" ;
1463- checkdisjunctionError ("1:19" , expression , functionName , functionType );
1464-
1465- expression = "("
1466- + functionInvocation
1467- + " and length(first_name) > 0) or (match(last_name, \" Anneke\" ) and length(first_name) > 10)" ;
1468- checkdisjunctionError ("1:19" , expression , functionName , functionType );
1469-
1431+ query ("from test | where " + functionInvocation + " or length(first_name) > 10" );
1432+ query ("from test | where match(last_name, \" Anneke\" ) or (" + functionInvocation + " and length(first_name) > 10)" );
1433+ query (
1434+ "from test | where ("
1435+ + functionInvocation
1436+ + " and length(first_name) > 0) or (match(last_name, \" Anneke\" ) and length(first_name) > 10)"
1437+ );
14701438 query ("from test | where " + functionInvocation + " or match(first_name, \" Anna\" )" );
14711439 query ("from test | where " + functionInvocation + " or not match(first_name, \" Anna\" )" );
14721440 query ("from test | where (" + functionInvocation + " or match(first_name, \" Anna\" )) and length(first_name) > 10" );
0 commit comments