@@ -1259,112 +1259,83 @@ public void testMatchFunctionIsNotNullable() {
12591259 }
12601260
12611261 public void testQueryStringFunctionsNotAllowedAfterCommands () throws Exception {
1262- // Source commands
1263- assertEquals ("1:13: [QSTR] function cannot be used after SHOW" , error ("show info | where qstr(\" 8.16.0\" )" ));
1264- assertEquals ("1:17: [QSTR] function cannot be used after ROW" , error ("row a= \" Anna\" | where qstr(\" Anna\" )" ));
1262+ testNonFieldBasedFullTextFunctionsNotAllowedAfterCommands ("QSTR" , "qstr(\" field_name: Anna\" )" );
1263+ }
12651264
1266- // Processing commands
1267- assertEquals (
1268- "1:43: [QSTR] function cannot be used after DISSECT" ,
1269- error ("from test | dissect first_name \" %{foo}\" | where qstr(\" Connection\" )" )
1270- );
1271- assertEquals ("1:27: [QSTR] function cannot be used after DROP" , error ("from test | drop emp_no | where qstr(\" Anna\" )" ));
1272- assertEquals (
1273- "1:71: [QSTR] function cannot be used after ENRICH" ,
1274- error ("from test | enrich languages on languages with lang = language_name | where qstr(\" Anna\" )" )
1275- );
1276- assertEquals ("1:26: [QSTR] function cannot be used after EVAL" , error ("from test | eval z = 2 | where qstr(\" Anna\" )" ));
1277- assertEquals (
1278- "1:44: [QSTR] function cannot be used after GROK" ,
1279- error ("from test | grok last_name \" %{WORD:foo}\" | where qstr(\" Anna\" )" )
1280- );
1281- assertEquals ("1:27: [QSTR] function cannot be used after KEEP" , error ("from test | keep emp_no | where qstr(\" Anna\" )" ));
1282- assertEquals ("1:24: [QSTR] function cannot be used after LIMIT" , error ("from test | limit 10 | where qstr(\" Anna\" )" ));
1283- assertEquals (
1284- "1:35: [QSTR] function cannot be used after MV_EXPAND" ,
1285- error ("from test | mv_expand last_name | where qstr(\" Anna\" )" )
1286- );
1287- assertEquals (
1288- "1:45: [QSTR] function cannot be used after RENAME" ,
1289- error ("from test | rename last_name as full_name | where qstr(\" Anna\" )" )
1290- );
1265+ public void testKqlFunctionsNotAllowedAfterCommands () throws Exception {
1266+ testNonFieldBasedFullTextFunctionsNotAllowedAfterCommands ("KQL" , "kql(\" field_name: Anna\" )" );
1267+ }
1268+
1269+ public void testNonFieldBasedFullTextFunctionsNotAllowedAfterCommands (String functionName , String functionInvocation ) throws Exception {
1270+ // Source commands
1271+ assertEquals ("1:13: [" + functionName + "] function cannot be used after SHOW" , error ("show info | where " + functionInvocation ));
12911272 assertEquals (
1292- "1:52 : [QSTR ] function cannot be used after STATS " ,
1293- error ("from test | STATS c = COUNT(emp_no) BY languages | where qstr( \" Anna \" )" )
1273+ "1:17 : [" + functionName + " ] function cannot be used after ROW " ,
1274+ error ("row a= \" Anna \" | where " + functionInvocation )
12941275 );
12951276
1296- // Some combination of processing commands
1277+ // Processing commands
12971278 assertEquals (
1298- "1:38 : [QSTR ] function cannot be used after LIMIT " ,
1299- error ("from test | keep emp_no | limit 10 | where qstr( \" Anna \" )" )
1279+ "1:43 : [" + functionName + " ] function cannot be used after DISSECT " ,
1280+ error ("from test | dissect first_name \" %{foo} \" | where " + functionInvocation )
13001281 );
13011282 assertEquals (
1302- "1:46 : [QSTR ] function cannot be used after MV_EXPAND " ,
1303- error ("from test | limit 10 | mv_expand last_name | where qstr( \" Anna \" )" )
1283+ "1:27 : [" + functionName + " ] function cannot be used after DROP " ,
1284+ error ("from test | drop emp_no | where " + functionInvocation )
13041285 );
13051286 assertEquals (
1306- "1:52 : [QSTR ] function cannot be used after KEEP " ,
1307- error ("from test | mv_expand last_name | keep last_name | where qstr( \" Anna \" )" )
1287+ "1:71 : [" + functionName + " ] function cannot be used after ENRICH " ,
1288+ error ("from test | enrich languages on languages with lang = language_name | where " + functionInvocation )
13081289 );
13091290 assertEquals (
1310- "1:77 : [QSTR ] function cannot be used after RENAME " ,
1311- error ("from test | STATS c = COUNT(emp_no) BY languages | rename c as total_emps | where qstr( \" Anna \" )" )
1291+ "1:26 : [" + functionName + " ] function cannot be used after EVAL " ,
1292+ error ("from test | eval z = 2 | where " + functionInvocation )
13121293 );
13131294 assertEquals (
1314- "1:54 : [QSTR ] function cannot be used after KEEP " ,
1315- error ("from test | rename last_name as name | keep emp_no | where qstr( \" Anna \" )" )
1295+ "1:44 : [" + functionName + " ] function cannot be used after GROK " ,
1296+ error ("from test | grok last_name \" %{WORD:foo} \" | where " + functionInvocation )
13161297 );
1317- }
1318-
1319- public void testKqlFunctionsNotAllowedAfterCommands () throws Exception {
1320- // Source commands
1321- assertEquals ("1:13: [KQL] function cannot be used after SHOW" , error ("show info | where kql(\" 8.16.0\" )" ));
1322- assertEquals ("1:17: [KQL] function cannot be used after ROW" , error ("row a= \" Anna\" | where kql(\" Anna\" )" ));
1323-
1324- // Processing commands
13251298 assertEquals (
1326- "1:43 : [KQL ] function cannot be used after DISSECT " ,
1327- error ("from test | dissect first_name \" %{foo} \" | where kql( \" Connection \" )" )
1299+ "1:27 : [" + functionName + " ] function cannot be used after KEEP " ,
1300+ error ("from test | keep emp_no | where " + functionInvocation )
13281301 );
1329- assertEquals ("1:27: [KQL] function cannot be used after DROP" , error ("from test | drop emp_no | where kql(\" Anna\" )" ));
13301302 assertEquals (
1331- "1:71 : [KQL ] function cannot be used after ENRICH " ,
1332- error ("from test | enrich languages on languages with lang = language_name | where kql( \" Anna \" )" )
1303+ "1:24 : [" + functionName + " ] function cannot be used after LIMIT " ,
1304+ error ("from test | limit 10 | where " + functionInvocation )
13331305 );
1334- assertEquals ("1:26: [KQL] function cannot be used after EVAL" , error ("from test | eval z = 2 | where kql(\" Anna\" )" ));
13351306 assertEquals (
1336- "1:44 : [KQL ] function cannot be used after GROK " ,
1337- error ("from test | grok last_name \" %{WORD:foo} \" | where kql( \" Anna \" )" )
1307+ "1:35 : [" + functionName + " ] function cannot be used after MV_EXPAND " ,
1308+ error ("from test | mv_expand last_name | where " + functionInvocation )
13381309 );
1339- assertEquals ("1:27: [KQL] function cannot be used after KEEP" , error ("from test | keep emp_no | where kql(\" Anna\" )" ));
1340- assertEquals ("1:24: [KQL] function cannot be used after LIMIT" , error ("from test | limit 10 | where kql(\" Anna\" )" ));
1341- assertEquals ("1:35: [KQL] function cannot be used after MV_EXPAND" , error ("from test | mv_expand last_name | where kql(\" Anna\" )" ));
13421310 assertEquals (
1343- "1:45: [KQL ] function cannot be used after RENAME" ,
1344- error ("from test | rename last_name as full_name | where kql( \" Anna \" )" )
1311+ "1:45: [" + functionName + " ] function cannot be used after RENAME" ,
1312+ error ("from test | rename last_name as full_name | where " + functionInvocation )
13451313 );
13461314 assertEquals (
1347- "1:52: [KQL ] function cannot be used after STATS" ,
1348- error ("from test | STATS c = COUNT(emp_no) BY languages | where kql( \" Anna \" )" )
1315+ "1:52: [" + functionName + " ] function cannot be used after STATS" ,
1316+ error ("from test | STATS c = COUNT(emp_no) BY languages | where " + functionInvocation )
13491317 );
13501318
13511319 // Some combination of processing commands
1352- assertEquals ("1:38: [KQL] function cannot be used after LIMIT" , error ("from test | keep emp_no | limit 10 | where kql(\" Anna\" )" ));
13531320 assertEquals (
1354- "1:46 : [KQL ] function cannot be used after MV_EXPAND " ,
1355- error ("from test | limit 10 | mv_expand last_name | where kql( \" Anna \" )" )
1321+ "1:38 : [" + functionName + " ] function cannot be used after LIMIT " ,
1322+ error ("from test | keep emp_no | limit 10 | where " + functionInvocation )
13561323 );
13571324 assertEquals (
1358- "1:52 : [KQL ] function cannot be used after KEEP " ,
1359- error ("from test | mv_expand last_name | keep last_name | where kql( \" Anna \" )" )
1325+ "1:46 : [" + functionName + " ] function cannot be used after MV_EXPAND " ,
1326+ error ("from test | limit 10 | mv_expand last_name | where " + functionInvocation )
13601327 );
13611328 assertEquals (
1362- "1:77 : [KQL ] function cannot be used after RENAME " ,
1363- error ("from test | STATS c = COUNT(emp_no) BY languages | rename c as total_emps | where kql( \" Anna \" )" )
1329+ "1:52 : [" + functionName + " ] function cannot be used after KEEP " ,
1330+ error ("from test | mv_expand last_name | keep last_name | where " + functionInvocation )
13641331 );
13651332 assertEquals (
1366- "1:54: [KQL] function cannot be used after DROP" ,
1367- error ("from test | rename last_name as name | drop emp_no | where kql(\" Anna\" )" )
1333+ "1:77: [" + functionName + "] function cannot be used after RENAME" ,
1334+ error ("from test | STATS c = COUNT(emp_no) BY languages | rename c as total_emps | where " + functionInvocation )
1335+ );
1336+ assertEquals (
1337+ "1:54: [" + functionName + "] function cannot be used after DROP" ,
1338+ error ("from test | rename last_name as name | drop emp_no | where " + functionInvocation )
13681339 );
13691340 }
13701341
@@ -2156,10 +2127,7 @@ public void testMatchOptions() {
21562127 }
21572128
21582129 public void testMultiMatchOptions () {
2159- checkOptionDataTypes (
2160- MultiMatch .OPTIONS ,
2161- "FROM test | WHERE MULTI_MATCH(\" Jean\" , first_name, last_name, {\" %s\" : %s})"
2162- );
2130+ checkOptionDataTypes (MultiMatch .OPTIONS , "FROM test | WHERE MULTI_MATCH(\" Jean\" , first_name, last_name, {\" %s\" : %s})" );
21632131 }
21642132
21652133 public void testQueryStringOptions () {
0 commit comments