@@ -1168,14 +1168,14 @@ public void testMatchInsideEval() throws Exception {
11681168 public void testMatchFilter () throws Exception {
11691169 assertEquals (
11701170 "1:19: Invalid condition [first_name:\" Anna\" or starts_with(first_name, \" Anne\" )]. "
1171- + "[:] operator can be used as part of an OR condition, "
1172- + "but only if other full text functions are used as part of the condition" ,
1171+ + "[:] operator can be used in an OR condition, "
1172+ + "but only if just full text functions are used in the OR condition" ,
11731173 error ("from test | where first_name:\" Anna\" or starts_with(first_name, \" Anne\" )" )
11741174 );
11751175
11761176 assertEquals (
1177- "1:51: Invalid condition [first_name:\" Anna\" OR new_salary > 100]. [:] operator can be used as part of an OR "
1178- + "condition, but only if other full text functions are used as part of the condition" ,
1177+ "1:51: Invalid condition [first_name:\" Anna\" OR new_salary > 100]. [:] operator can be used in an OR "
1178+ + "condition, but only if just full text functions are used in the OR condition" ,
11791179 error ("from test | eval new_salary = salary + 10 | where first_name:\" Anna\" OR new_salary > 100" )
11801180 );
11811181 }
@@ -1413,45 +1413,26 @@ public void testMatchOperatorWithDisjunctions() {
14131413 }
14141414
14151415 private void checkWithDisjunctions (String functionName , String functionInvocation , String functionType ) {
1416+ String expression = functionInvocation + " or length(first_name) > 12" ;
1417+ checkdisjunctionError ("1:19" , expression , functionName , functionType );
1418+ expression = "(" + functionInvocation + " or first_name is not null) or (length(first_name) > 12 and match(last_name, \" Smith\" ))" ;
1419+ checkdisjunctionError ("1:19" , expression , functionName , functionType );
1420+ expression = functionInvocation + " or (last_name is not null and first_name is null)" ;
1421+ checkdisjunctionError ("1:19" , expression , functionName , functionType );
1422+ }
1423+
1424+ private void checkdisjunctionError (String position , String expression , String functionName , String functionType ) {
14161425 assertEquals (
14171426 LoggerMessageFormat .format (
14181427 null ,
1419- "1:19: Invalid condition [{} or length(first_name) > 12]. "
1420- + "[{}] "
1421- + functionType
1422- + " can be used as part of an OR condition, but only if other full text functions are used as part of the condition" ,
1423- functionInvocation ,
1424- functionName
1425- ),
1426- error ("from test | where " + functionInvocation + " or length(first_name) > 12" )
1427- );
1428- assertEquals (
1429- LoggerMessageFormat .format (
1430- null ,
1431- "1:20: Invalid condition [{} or first_name is not null]. "
1432- + "[{}] "
1433- + functionType
1434- + " can be used as part of an OR condition, but only if other full text functions are used as part of the condition" ,
1435- functionInvocation ,
1436- functionName
1437- ),
1438- error (
1439- "from test | where ("
1440- + functionInvocation
1441- + " or first_name is not null) or (length(first_name) > 12 and match(last_name, \" Smith\" ))"
1442- )
1443- );
1444- assertEquals (
1445- LoggerMessageFormat .format (
1446- null ,
1447- "1:19: Invalid condition [{} or (last_name is not null and first_name is null)]. "
1448- + "[{}] "
1449- + functionType
1450- + " can be used as part of an OR condition, but only if other full text functions are used as part of the condition" ,
1451- functionInvocation ,
1452- functionName
1428+ "{}: Invalid condition [{}]. [{}] {} can be used in an OR condition, "
1429+ + "but only if just full text functions are used in the OR condition" ,
1430+ position ,
1431+ expression ,
1432+ functionName ,
1433+ functionType
14531434 ),
1454- error ("from test | where " + functionInvocation + " or (last_name is not null and first_name is null)" )
1435+ error ("from test | where " + expression )
14551436 );
14561437 }
14571438
@@ -1465,35 +1446,23 @@ public void testFullTextFunctionsDisjunctions() {
14651446 }
14661447
14671448 private void checkWithFullTextFunctionsDisjunctions (String functionName , String functionInvocation , String functionType ) {
1449+
1450+ String expression = functionInvocation + " or length(first_name) > 10" ;
1451+ checkdisjunctionError ("1:19" , expression , functionName , functionType );
1452+
1453+ expression = "match(last_name, \" Anneke\" ) or (" + functionInvocation + " and length(first_name) > 10)" ;
1454+ checkdisjunctionError ("1:19" , expression , functionName , functionType );
1455+
1456+ expression = "("
1457+ + functionInvocation
1458+ + " and length(first_name) > 0) or (match(last_name, \" Anneke\" ) and length(first_name) > 10)" ;
1459+ checkdisjunctionError ("1:19" , expression , functionName , functionType );
1460+
14681461 passes ("from test | where " + functionInvocation + " or match(first_name, \" Anna\" )" );
14691462 passes ("from test | where " + functionInvocation + " or not match(first_name, \" Anna\" )" );
14701463 passes ("from test | where (" + functionInvocation + " or match(first_name, \" Anna\" )) and length(first_name) > 10" );
14711464 passes ("from test | where (" + functionInvocation + " or match(first_name, \" Anna\" )) and match(last_name, \" Smith\" )" );
14721465 passes ("from test | where " + functionInvocation + " or (match(first_name, \" Anna\" ) and match(last_name, \" Smith\" ))" );
1473-
1474- assertEquals (
1475- LoggerMessageFormat .format (
1476- null ,
1477- "1:19: Invalid condition [{} or length(first_name) > 10]. [{}] {} can be used as part of an OR condition, "
1478- + "but only if other full text functions are used as part of the condition" ,
1479- functionInvocation ,
1480- functionName ,
1481- functionType
1482- ),
1483- error ("from test | where " + functionInvocation + " or length(first_name) > 10" )
1484- );
1485- assertEquals (
1486- LoggerMessageFormat .format (
1487- null ,
1488- "1:19: Invalid condition [{} or (match(last_name, \" Anneke\" ) and length(first_name) > 10)]."
1489- + " [{}] {} can be used as part of an OR condition, "
1490- + "but only if other full text functions are used as part of the condition" ,
1491- functionInvocation ,
1492- functionName ,
1493- functionType
1494- ),
1495- error ("from test | where " + functionInvocation + " or (match(last_name, \" Anneke\" ) and length(first_name) > 10)" )
1496- );
14971466 }
14981467
14991468 public void testQueryStringFunctionWithNonBooleanFunctions () {
0 commit comments