Skip to content

Commit 7d6ae9e

Browse files
spotless
1 parent 72b833a commit 7d6ae9e

File tree

1 file changed

+28
-45
lines changed

1 file changed

+28
-45
lines changed

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public void testStatsWithoutAggsOrGroup() {
328328
}
329329

330330
public void testAggsWithGroupKeyAsAgg() {
331-
var queries = new String[]{"""
331+
var queries = new String[] { """
332332
row a = 1, b = 2
333333
| stats a by a
334334
""", """
@@ -341,7 +341,7 @@ public void testAggsWithGroupKeyAsAgg() {
341341
""", """
342342
row a = 1, b = 2
343343
| stats x = a by a
344-
"""};
344+
""" };
345345

346346
for (String query : queries) {
347347
expectVerificationError(query, "grouping key [a] already specified in the STATS BY clause");
@@ -891,16 +891,16 @@ public void testInvalidQuotingAsLookupIndexPattern() {
891891
}
892892

893893
public void testIdentifierAsFieldName() {
894-
String[] operators = new String[]{"==", "!=", ">", "<", ">=", "<="};
895-
Class<?>[] expectedOperators = new Class<?>[]{
894+
String[] operators = new String[] { "==", "!=", ">", "<", ">=", "<=" };
895+
Class<?>[] expectedOperators = new Class<?>[] {
896896
Equals.class,
897897
Not.class,
898898
GreaterThan.class,
899899
LessThan.class,
900900
GreaterThanOrEqual.class,
901-
LessThanOrEqual.class};
902-
String[] identifiers = new String[]{"abc", "`abc`", "ab_c", "a.b.c", "@a", "a.@b", "`[email protected]`"};
903-
String[] expectedIdentifiers = new String[]{"abc", "abc", "ab_c", "a.b.c", "@a", "a.@b", "[email protected]"};
901+
LessThanOrEqual.class };
902+
String[] identifiers = new String[] { "abc", "`abc`", "ab_c", "a.b.c", "@a", "a.@b", "`[email protected]`" };
903+
String[] expectedIdentifiers = new String[] { "abc", "abc", "ab_c", "a.b.c", "@a", "a.@b", "[email protected]" };
904904
LogicalPlan where;
905905
for (int i = 0; i < operators.length; i++) {
906906
for (int j = 0; j < identifiers.length; j++) {
@@ -1033,7 +1033,7 @@ public void testSingleLineComments() {
10331033
}
10341034

10351035
public void testNewLines() {
1036-
String[] delims = new String[]{"", "\r", "\n", "\r\n"};
1036+
String[] delims = new String[] { "", "\r", "\n", "\r\n" };
10371037
Function<String, String> queryFun = d -> d + "from " + d + " foo " + d + "| eval " + d + " x = concat(bar, \"baz\")" + d;
10381038
LogicalPlan reference = statement(queryFun.apply(delims[0]));
10391039
for (int i = 1; i < delims.length; i++) {
@@ -2941,13 +2941,13 @@ public void testNamedFunctionArgumentNotInMap() {
29412941

29422942
public void testNamedFunctionArgumentNotConstant() {
29432943
Map<String, String[]> commands = Map.ofEntries(
2944-
Map.entry("eval x = {}", new String[]{"31", "35"}),
2945-
Map.entry("where {}", new String[]{"28", "32"}),
2946-
Map.entry("stats {}", new String[]{"28", "32"}),
2947-
Map.entry("stats agg() by {}", new String[]{"37", "41"}),
2948-
Map.entry("sort {}", new String[]{"27", "31"}),
2949-
Map.entry("dissect {} \"%{bar}\"", new String[]{"30", "34"}),
2950-
Map.entry("grok {} \"%{WORD:foo}\"", new String[]{"27", "31"})
2944+
Map.entry("eval x = {}", new String[] { "31", "35" }),
2945+
Map.entry("where {}", new String[] { "28", "32" }),
2946+
Map.entry("stats {}", new String[] { "28", "32" }),
2947+
Map.entry("stats agg() by {}", new String[] { "37", "41" }),
2948+
Map.entry("sort {}", new String[] { "27", "31" }),
2949+
Map.entry("dissect {} \"%{bar}\"", new String[] { "30", "34" }),
2950+
Map.entry("grok {} \"%{WORD:foo}\"", new String[] { "27", "31" })
29512951
);
29522952

29532953
for (Map.Entry<String, String[]> command : commands.entrySet()) {
@@ -3176,7 +3176,7 @@ public void testValidJoinPattern() {
31763176
}
31773177

31783178
public void testInvalidFromPatterns() {
3179-
var sourceCommands = Build.current().isSnapshot() ? new String[]{"FROM", "TS"} : new String[]{"FROM"};
3179+
var sourceCommands = Build.current().isSnapshot() ? new String[] { "FROM", "TS" } : new String[] { "FROM" };
31803180
var indexIsBlank = "Blank index specified in index pattern";
31813181
var remoteIsEmpty = "remote part is empty";
31823182
var invalidDoubleColonUsage = "invalid usage of :: separator";
@@ -3226,7 +3226,7 @@ public void testInvalidPatternsWithIntermittentQuotes() {
32263226
var randomIndex = randomIndexPattern();
32273227
// Select an invalid char to sneak in.
32283228
// Note: some chars like '|' and '"' are excluded to generate a proper invalid name.
3229-
Character[] invalidChars = {' ', '/', '<', '>', '?'};
3229+
Character[] invalidChars = { ' ', '/', '<', '>', '?' };
32303230
var randomInvalidChar = randomFrom(invalidChars);
32313231

32323232
// Construct the new invalid index pattern.
@@ -3664,7 +3664,7 @@ public void testInvalidFork() {
36643664
}
36653665

36663666
public void testFieldNamesAsCommands() throws Exception {
3667-
String[] keywords = new String[]{
3667+
String[] keywords = new String[] {
36683668
"dissect",
36693669
"drop",
36703670
"enrich",
@@ -3677,7 +3677,7 @@ public void testFieldNamesAsCommands() throws Exception {
36773677
"mv_expand",
36783678
"rename",
36793679
"sort",
3680-
"stats"};
3680+
"stats" };
36813681
for (String keyword : keywords) {
36823682
var plan = statement("FROM test | STATS avg(" + keyword + ")");
36833683
var aggregate = as(plan, Aggregate.class);
@@ -4724,7 +4724,7 @@ public void testUnclosedParenthesis() {
47244724
"ROW x = 1 | DROP x )",
47254725
"ROW a = [1, 2] | RENAME a =b)",
47264726
"ROW a = [1, 2] | MV_EXPAND a)",
4727-
"from test | enrich a on b)"};
4727+
"from test | enrich a on b)" };
47284728
for (String q : queries) {
47294729
expectError(q, "Invalid query");
47304730
}
@@ -4746,7 +4746,8 @@ public void testBracketsInIndexNames() {
47464746
"((((()))))",
47474747
"(((abc)))",
47484748
"*()*",
4749-
"*test()*");
4749+
"*test()*"
4750+
);
47504751

47514752
for (String pattern : patterns) {
47524753
expectErrorForBracketsWithoutQuotes(pattern);
@@ -4760,30 +4761,15 @@ public void testBracketsInIndexNames() {
47604761
}
47614762

47624763
private void expectErrorForBracketsWithoutQuotes(String pattern) {
4763-
expectThrows(
4764-
ParsingException.class,
4765-
() -> processingCommand("from " + pattern)
4766-
);
4764+
expectThrows(ParsingException.class, () -> processingCommand("from " + pattern));
47674765

4768-
expectThrows(
4769-
ParsingException.class,
4770-
() -> processingCommand("from *:" + pattern)
4771-
);
4766+
expectThrows(ParsingException.class, () -> processingCommand("from *:" + pattern));
47724767

4773-
expectThrows(
4774-
ParsingException.class,
4775-
() -> processingCommand("from remote1:" + pattern + ",remote2:" + pattern)
4776-
);
4768+
expectThrows(ParsingException.class, () -> processingCommand("from remote1:" + pattern + ",remote2:" + pattern));
47774769

4778-
expectThrows(
4779-
ParsingException.class,
4780-
() -> processingCommand("from test | lookup join " + pattern + " on bar")
4781-
);
4770+
expectThrows(ParsingException.class, () -> processingCommand("from test | lookup join " + pattern + " on bar"));
47824771

4783-
expectThrows(
4784-
ParsingException.class,
4785-
() -> processingCommand("from test | enrich " + pattern)
4786-
);
4772+
expectThrows(ParsingException.class, () -> processingCommand("from test | enrich " + pattern));
47874773
}
47884774

47894775
private void expectSuccessForBracketsWithinQuotes(String indexName) {
@@ -4805,10 +4791,7 @@ private void expectSuccessForBracketsWithinQuotes(String indexName) {
48054791
as(enrich.child(), UnresolvedRelation.class);
48064792

48074793
if (indexName.contains("*")) {
4808-
expectThrows(
4809-
ParsingException.class,
4810-
() -> processingCommand("from test | lookup join \"" + indexName + "\" on bar")
4811-
);
4794+
expectThrows(ParsingException.class, () -> processingCommand("from test | lookup join \"" + indexName + "\" on bar"));
48124795
} else {
48134796
plan = statement("from test | lookup join \"" + indexName + "\" on bar");
48144797
LookupJoin lookup = as(plan, LookupJoin.class);

0 commit comments

Comments
 (0)