Skip to content

Commit

Permalink
Chanage error messages to start with lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdelest committed Sep 12, 2024
1 parent 4b97e6d commit 8a4b150
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ private static void checkFullTextQueryFunctions(LogicalPlan plan, Set<Failure> f
failures.add(
fail(
plan,
"Full text functions cannot be used after {}",
"full text functions cannot be used after {}",
lp.sourceText().split(" ")[0].toUpperCase(Locale.ROOT)
)
);
Expand All @@ -681,7 +681,7 @@ private static void checkFullTextQueryFunctions(LogicalPlan plan, Set<Failure> f
}
} else {
plan.forEachExpression(FullTextFunction.class, ftf -> {
failures.add(fail(ftf, "Full text functions are only supported in WHERE commands"));
failures.add(fail(ftf, "full text functions are only supported in WHERE commands"));
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1094,70 +1094,70 @@ public void testQueryStringFunctionsNotAllowedAfterCommands() throws Exception {
assumeTrue("skipping because QSTR is not enabled", EsqlCapabilities.Cap.QSTR_FUNCTION.isEnabled());

// Source commands
assertEquals("1:13: Full text functions cannot be used after SHOW", error("show info | where qstr(\"8.16.0\")"));
assertEquals("1:17: Full text functions cannot be used after ROW", error("row a= \"Anna\" | where qstr(\"Anna\")"));
assertEquals("1:13: full text functions cannot be used after SHOW", error("show info | where qstr(\"8.16.0\")"));
assertEquals("1:17: full text functions cannot be used after ROW", error("row a= \"Anna\" | where qstr(\"Anna\")"));

// Processing commands
assertEquals(
"1:43: Full text functions cannot be used after DISSECT",
"1:43: full text functions cannot be used after DISSECT",
error("from test | dissect first_name \"%{foo}\" | where qstr(\"Connection\")")
);
assertEquals("1:27: Full text functions cannot be used after DROP", error("from test | drop emp_no | where qstr(\"Anna\")"));
assertEquals("1:27: full text functions cannot be used after DROP", error("from test | drop emp_no | where qstr(\"Anna\")"));
assertEquals(
"1:71: Full text functions cannot be used after ENRICH",
"1:71: full text functions cannot be used after ENRICH",
error("from test | enrich languages on languages with lang = language_name | where qstr(\"Anna\")")
);
assertEquals("1:26: Full text functions cannot be used after EVAL", error("from test | eval z = 2 | where qstr(\"Anna\")"));
assertEquals("1:26: full text functions cannot be used after EVAL", error("from test | eval z = 2 | where qstr(\"Anna\")"));
assertEquals(
"1:44: Full text functions cannot be used after GROK",
"1:44: full text functions cannot be used after GROK",
error("from test | grok last_name \"%{WORD:foo}\" | where qstr(\"Anna\")")
);
assertEquals("1:27: Full text functions cannot be used after KEEP", error("from test | keep emp_no | where qstr(\"Anna\")"));
assertEquals("1:24: Full text functions cannot be used after LIMIT", error("from test | limit 10 | where qstr(\"Anna\")"));
assertEquals("1:27: full text functions cannot be used after KEEP", error("from test | keep emp_no | where qstr(\"Anna\")"));
assertEquals("1:24: full text functions cannot be used after LIMIT", error("from test | limit 10 | where qstr(\"Anna\")"));
assertEquals(
"1:35: Full text functions cannot be used after MV_EXPAND",
"1:35: full text functions cannot be used after MV_EXPAND",
error("from test | mv_expand last_name | where qstr(\"Anna\")")
);
assertEquals(
"1:45: Full text functions cannot be used after RENAME",
"1:45: full text functions cannot be used after RENAME",
error("from test | rename last_name as full_name | where qstr(\"Anna\")")
);
assertEquals(
"1:52: Full text functions cannot be used after STATS",
"1:52: full text functions cannot be used after STATS",
error("from test | STATS c = COUNT(emp_no) BY languages | where qstr(\"Anna\")")
);

// Some combination of processing commands
assertEquals(
"1:38: Full text functions cannot be used after LIMIT",
"1:38: full text functions cannot be used after LIMIT",
error("from test | keep emp_no | limit 10 | where qstr(\"Anna\")")
);
assertEquals(
"1:46: Full text functions cannot be used after MV_EXPAND",
"1:46: full text functions cannot be used after MV_EXPAND",
error("from test | limit 10 | mv_expand last_name | where qstr(\"Anna\")")
);
assertEquals(
"1:52: Full text functions cannot be used after KEEP",
"1:52: full text functions cannot be used after KEEP",
error("from test | mv_expand last_name | keep last_name | where qstr(\"Anna\")")
);
assertEquals(
"1:77: Full text functions cannot be used after RENAME",
"1:77: full text functions cannot be used after RENAME",
error("from test | STATS c = COUNT(emp_no) BY languages | rename c as total_emps | where qstr(\"Anna\")")
);
assertEquals(
"1:54: Full text functions cannot be used after KEEP",
"1:54: full text functions cannot be used after KEEP",
error("from test | rename last_name as name | keep emp_no | where qstr(\"Anna\")")
);
}

public void testQueryStringFunctionsOnlyAllowedInWhere() throws Exception {
assumeTrue("skipping because QSTR is not enabled", EsqlCapabilities.Cap.QSTR_FUNCTION.isEnabled());

assertEquals("1:22: Full text functions are only supported in WHERE commands", error("from test | eval y = qstr(\"Anna\")"));
assertEquals("1:18: Full text functions are only supported in WHERE commands", error("from test | sort qstr(\"Connection\") asc"));
assertEquals("1:5: Full text functions are only supported in WHERE commands", error("row qstr(\"Connection\")"));
assertEquals("1:22: full text functions are only supported in WHERE commands", error("from test | eval y = qstr(\"Anna\")"));
assertEquals("1:18: full text functions are only supported in WHERE commands", error("from test | sort qstr(\"Connection\") asc"));
assertEquals("1:5: full text functions are only supported in WHERE commands", error("row qstr(\"Connection\")"));
assertEquals(
"1:23: Full text functions are only supported in WHERE commands",
"1:23: full text functions are only supported in WHERE commands",
error("from test | STATS c = qstr(\"foo\") BY languages")
);
}
Expand Down

0 comments on commit 8a4b150

Please sign in to comment.