@@ -961,14 +961,12 @@ public void testBasicSortCommand() {
961961 }
962962
963963 public void testSubquery () {
964- assertEquals (new Explain (EMPTY , PROCESSING_CMD_INPUT ), statement ("explain ( row a = 1 )" ));
965- }
966-
967- public void testSubqueryWithPipe () {
964+ assumeTrue ("Requires EXPLAIN capability" , EsqlCapabilities .Cap .EXPLAIN .isEnabled ());
968965 assertEquals (new Explain (EMPTY , PROCESSING_CMD_INPUT ), statement ("explain ( row a = 1 )" ));
969966 }
970967
971968 public void testBlockComments () {
969+ assumeTrue ("Requires EXPLAIN capability" , EsqlCapabilities .Cap .EXPLAIN .isEnabled ());
972970 String query = " explain ( from foo )" ;
973971 LogicalPlan expected = statement (query );
974972
@@ -984,6 +982,7 @@ public void testBlockComments() {
984982 }
985983
986984 public void testSingleLineComments () {
985+ assumeTrue ("Requires EXPLAIN capability" , EsqlCapabilities .Cap .EXPLAIN .isEnabled ());
987986 String query = " explain ( from foo ) " ;
988987 LogicalPlan expected = statement (query );
989988
@@ -1009,16 +1008,19 @@ public void testNewLines() {
10091008 }
10101009
10111010 public void testSuggestAvailableSourceCommandsOnParsingError () {
1012- for (Tuple <String , String > queryWithUnexpectedCmd : List .of (
1013- Tuple .tuple ("frm foo" , "frm" ),
1014- Tuple .tuple ("expln[from bar]" , "expln" ),
1015- Tuple .tuple ("not-a-thing logs" , "not-a-thing" ),
1016- Tuple .tuple ("high5 a" , "high5" ),
1017- Tuple .tuple ("a+b = c" , "a+b" ),
1018- Tuple .tuple ("a//hi" , "a" ),
1019- Tuple .tuple ("a/*hi*/" , "a" ),
1020- Tuple .tuple ("explain ( frm a )" , "frm" )
1021- )) {
1011+ var cases = new ArrayList <Tuple <String , String >>();
1012+ cases .add (Tuple .tuple ("frm foo" , "frm" ));
1013+ cases .add (Tuple .tuple ("expln[from bar]" , "expln" ));
1014+ cases .add (Tuple .tuple ("not-a-thing logs" , "not-a-thing" ));
1015+ cases .add (Tuple .tuple ("high5 a" , "high5" ));
1016+ cases .add (Tuple .tuple ("a+b = c" , "a+b" ));
1017+ cases .add (Tuple .tuple ("a//hi" , "a" ));
1018+ cases .add (Tuple .tuple ("a/*hi*/" , "a" ));
1019+ if (EsqlCapabilities .Cap .EXPLAIN .isEnabled ()) {
1020+ cases .add (Tuple .tuple ("explain ( frm a )" , "frm" ));
1021+ }
1022+
1023+ for (Tuple <String , String > queryWithUnexpectedCmd : cases ) {
10221024 expectThrows (
10231025 ParsingException .class ,
10241026 allOf (
@@ -1084,7 +1086,12 @@ public void testDeprecatedIsNullFunction() {
10841086 public void testMetadataFieldOnOtherSources () {
10851087 expectError ("row a = 1 metadata _index" , "line 1:20: extraneous input '_index' expecting <EOF>" );
10861088 expectError ("show info metadata _index" , "line 1:11: token recognition error at: 'm'" );
1087- expectError ("explain ( from foo ) metadata _index" , "line 1:22: mismatched input 'metadata' expecting {'|', ',', ')', 'metadata'}" );
1089+ if (EsqlCapabilities .Cap .EXPLAIN .isEnabled ()) {
1090+ expectError (
1091+ "explain ( from foo ) metadata _index" ,
1092+ "line 1:22: mismatched input 'metadata' expecting {'|', ',', ')', 'metadata'}"
1093+ );
1094+ }
10881095 }
10891096
10901097 public void testMetadataFieldMultipleDeclarations () {
@@ -3473,18 +3480,20 @@ public void testFieldNamesAsCommands() throws Exception {
34733480 }
34743481
34753482 // [ and ( are used to trigger a double mode causing their symbol name (instead of text) to be used in error reporting
3476- // this test checks that their are properly replaced in the error message
3477- public void testPreserveParanthesis () {
3483+ // this test checks that they are properly replaced in the error message
3484+ public void testPreserveParentheses () {
34783485 // test for (
34793486 expectError ("row a = 1 not in" , "line 1:17: mismatched input '<EOF>' expecting '('" );
34803487 expectError ("row a = 1 | where a not in" , "line 1:27: mismatched input '<EOF>' expecting '('" );
34813488 expectError ("row a = 1 | where a not in (1" , "line 1:30: mismatched input '<EOF>' expecting {',', ')'}" );
34823489 expectError ("row a = 1 | where a not in [1" , "line 1:28: missing '(' at '['" );
34833490 expectError ("row a = 1 | where a not in 123" , "line 1:28: missing '(' at '123'" );
34843491 // test for [
3485- expectError ("explain" , "line 1:8: mismatched input '<EOF>' expecting '('" );
3486- expectError ("explain ]" , "line 1:9: token recognition error at: ']'" );
3487- expectError ("explain ( row x = 1" , "line 1:20: missing ')' at '<EOF>'" );
3492+ if (EsqlCapabilities .Cap .EXPLAIN .isEnabled ()) {
3493+ expectError ("explain" , "line 1:8: mismatched input '<EOF>' expecting '('" );
3494+ expectError ("explain ]" , "line 1:9: token recognition error at: ']'" );
3495+ expectError ("explain ( row x = 1" , "line 1:20: missing ')' at '<EOF>'" );
3496+ }
34883497 }
34893498
34903499 public void testRerankDefaultInferenceIdAndScoreAttribute () {
0 commit comments