Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -961,14 +961,12 @@ public void testBasicSortCommand() {
}

public void testSubquery() {
assertEquals(new Explain(EMPTY, PROCESSING_CMD_INPUT), statement("explain ( row a = 1 )"));
}

public void testSubqueryWithPipe() {
assumeTrue("Requires EXPLAIN capability", EsqlCapabilities.Cap.EXPLAIN.isEnabled());
assertEquals(new Explain(EMPTY, PROCESSING_CMD_INPUT), statement("explain ( row a = 1 )"));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testSubquery and testSubqueryWithPipe are identical now. I am keeping only one of them.


public void testBlockComments() {
assumeTrue("Requires EXPLAIN capability", EsqlCapabilities.Cap.EXPLAIN.isEnabled());
String query = " explain ( from foo )";
LogicalPlan expected = statement(query);

Expand All @@ -984,6 +982,7 @@ public void testBlockComments() {
}

public void testSingleLineComments() {
assumeTrue("Requires EXPLAIN capability", EsqlCapabilities.Cap.EXPLAIN.isEnabled());
String query = " explain ( from foo ) ";
LogicalPlan expected = statement(query);

Expand All @@ -1009,16 +1008,19 @@ public void testNewLines() {
}

public void testSuggestAvailableSourceCommandsOnParsingError() {
for (Tuple<String, String> queryWithUnexpectedCmd : List.of(
Tuple.tuple("frm foo", "frm"),
Tuple.tuple("expln[from bar]", "expln"),
Tuple.tuple("not-a-thing logs", "not-a-thing"),
Tuple.tuple("high5 a", "high5"),
Tuple.tuple("a+b = c", "a+b"),
Tuple.tuple("a//hi", "a"),
Tuple.tuple("a/*hi*/", "a"),
Tuple.tuple("explain ( frm a )", "frm")
)) {
var cases = new ArrayList<Tuple<String, String>>();
cases.add(Tuple.tuple("frm foo", "frm"));
cases.add(Tuple.tuple("expln[from bar]", "expln"));
cases.add(Tuple.tuple("not-a-thing logs", "not-a-thing"));
cases.add(Tuple.tuple("high5 a", "high5"));
cases.add(Tuple.tuple("a+b = c", "a+b"));
cases.add(Tuple.tuple("a//hi", "a"));
cases.add(Tuple.tuple("a/*hi*/", "a"));
if (EsqlCapabilities.Cap.EXPLAIN.isEnabled()) {
cases.add(Tuple.tuple("explain ( frm a )", "frm"));
}

for (Tuple<String, String> queryWithUnexpectedCmd : cases) {
expectThrows(
ParsingException.class,
allOf(
Expand Down Expand Up @@ -1084,7 +1086,12 @@ public void testDeprecatedIsNullFunction() {
public void testMetadataFieldOnOtherSources() {
expectError("row a = 1 metadata _index", "line 1:20: extraneous input '_index' expecting <EOF>");
expectError("show info metadata _index", "line 1:11: token recognition error at: 'm'");
expectError("explain ( from foo ) metadata _index", "line 1:22: mismatched input 'metadata' expecting {'|', ',', ')', 'metadata'}");
if (EsqlCapabilities.Cap.EXPLAIN.isEnabled()) {
expectError(
"explain ( from foo ) metadata _index",
"line 1:22: mismatched input 'metadata' expecting {'|', ',', ')', 'metadata'}"
);
}
}

public void testMetadataFieldMultipleDeclarations() {
Expand Down Expand Up @@ -3473,18 +3480,20 @@ public void testFieldNamesAsCommands() throws Exception {
}

// [ and ( are used to trigger a double mode causing their symbol name (instead of text) to be used in error reporting
// this test checks that their are properly replaced in the error message
public void testPreserveParanthesis() {
// this test checks that they are properly replaced in the error message
public void testPreserveParentheses() {
// test for (
expectError("row a = 1 not in", "line 1:17: mismatched input '<EOF>' expecting '('");
expectError("row a = 1 | where a not in", "line 1:27: mismatched input '<EOF>' expecting '('");
expectError("row a = 1 | where a not in (1", "line 1:30: mismatched input '<EOF>' expecting {',', ')'}");
expectError("row a = 1 | where a not in [1", "line 1:28: missing '(' at '['");
expectError("row a = 1 | where a not in 123", "line 1:28: missing '(' at '123'");
// test for [
expectError("explain", "line 1:8: mismatched input '<EOF>' expecting '('");
expectError("explain ]", "line 1:9: token recognition error at: ']'");
expectError("explain ( row x = 1", "line 1:20: missing ')' at '<EOF>'");
if (EsqlCapabilities.Cap.EXPLAIN.isEnabled()) {
expectError("explain", "line 1:8: mismatched input '<EOF>' expecting '('");
expectError("explain ]", "line 1:9: token recognition error at: ']'");
expectError("explain ( row x = 1", "line 1:20: missing ')' at '<EOF>'");
}
}

public void testRerankDefaultInferenceIdAndScoreAttribute() {
Expand Down