Skip to content

Commit e68a194

Browse files
committed
Spotless apply on PPL
Signed-off-by: Mitchell Gale <[email protected]>
1 parent a3d2fae commit e68a194

26 files changed

+1114
-1565
lines changed

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ spotless {
8585
java {
8686
target fileTree('.') {
8787
include 'datasources/**/*.java',
88-
'core/**/*.java'
88+
'core/**/*.java',
89+
'ppl/**/*.java'
8990
exclude '**/build/**', '**/build-*/**'
9091
}
9192
importOrder()

ppl/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ plugins {
2929
id 'antlr'
3030
}
3131

32+
// Being ignored as a temporary measure before being removed in favour of
33+
// spotless https://github.com/opensearch-project/sql/issues/1101
34+
checkstyleTest.ignoreFailures = true
35+
checkstyleMain.ignoreFailures = true
36+
3237
generateGrammarSource {
3338
arguments += ['-visitor', '-package', 'org.opensearch.sql.ppl.antlr.parser']
3439
source = sourceSets.main.antlr

ppl/src/main/java/org/opensearch/sql/ppl/PPLService.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
76
package org.opensearch.sql.ppl;
87

98
import static org.opensearch.sql.executor.ExecutionEngine.QueryResponse;
@@ -27,9 +26,7 @@
2726
import org.opensearch.sql.ppl.parser.AstStatementBuilder;
2827
import org.opensearch.sql.ppl.utils.PPLQueryDataAnonymizer;
2928

30-
/**
31-
* PPLService.
32-
*/
29+
/** PPLService. */
3330
@RequiredArgsConstructor
3431
public class PPLService {
3532
private final PPLSyntaxParser parser;
@@ -45,7 +42,7 @@ public class PPLService {
4542
/**
4643
* Execute the {@link PPLQueryRequest}, using {@link ResponseListener} to get response.
4744
*
48-
* @param request {@link PPLQueryRequest}
45+
* @param request {@link PPLQueryRequest}
4946
* @param listener {@link ResponseListener}
5047
*/
5148
public void execute(PPLQueryRequest request, ResponseListener<QueryResponse> listener) {
@@ -57,10 +54,10 @@ public void execute(PPLQueryRequest request, ResponseListener<QueryResponse> lis
5754
}
5855

5956
/**
60-
* Explain the query in {@link PPLQueryRequest} using {@link ResponseListener} to
61-
* get and format explain response.
57+
* Explain the query in {@link PPLQueryRequest} using {@link ResponseListener} to get and format
58+
* explain response.
6259
*
63-
* @param request {@link PPLQueryRequest}
60+
* @param request {@link PPLQueryRequest}
6461
* @param listener {@link ResponseListener} for explain response
6562
*/
6663
public void explain(PPLQueryRequest request, ResponseListener<ExplainResponse> listener) {
@@ -90,7 +87,6 @@ private AbstractPlan plan(
9087
QueryContext.getRequestId(),
9188
anonymizer.anonymizeStatement(statement));
9289

93-
return queryExecutionFactory.create(
94-
statement, queryListener, explainListener);
90+
return queryExecutionFactory.create(statement, queryListener, explainListener);
9591
}
9692
}

ppl/src/main/java/org/opensearch/sql/ppl/antlr/PPLSyntaxParser.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
76
package org.opensearch.sql.ppl.antlr;
87

98
import org.antlr.v4.runtime.CommonTokenStream;
@@ -15,13 +14,9 @@
1514
import org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLLexer;
1615
import org.opensearch.sql.ppl.antlr.parser.OpenSearchPPLParser;
1716

18-
/**
19-
* PPL Syntax Parser.
20-
*/
17+
/** PPL Syntax Parser. */
2118
public class PPLSyntaxParser implements Parser {
22-
/**
23-
* Analyze the query syntax.
24-
*/
19+
/** Analyze the query syntax. */
2520
@Override
2621
public ParseTree parse(String query) {
2722
OpenSearchPPLParser parser = createParser(createLexer(query));
@@ -30,12 +25,10 @@ public ParseTree parse(String query) {
3025
}
3126

3227
private OpenSearchPPLParser createParser(Lexer lexer) {
33-
return new OpenSearchPPLParser(
34-
new CommonTokenStream(lexer));
28+
return new OpenSearchPPLParser(new CommonTokenStream(lexer));
3529
}
3630

3731
private OpenSearchPPLLexer createLexer(String query) {
38-
return new OpenSearchPPLLexer(
39-
new CaseInsensitiveCharStream(query));
32+
return new OpenSearchPPLLexer(new CaseInsensitiveCharStream(query));
4033
}
4134
}

ppl/src/main/java/org/opensearch/sql/ppl/domain/PPLQueryRequest.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
76
package org.opensearch.sql.ppl.domain;
87

98
import java.util.Locale;
@@ -22,12 +21,9 @@ public class PPLQueryRequest {
2221
public static final PPLQueryRequest NULL = new PPLQueryRequest("", null, DEFAULT_PPL_PATH, "");
2322

2423
private final String pplQuery;
25-
@Getter
26-
private final JSONObject jsonContent;
27-
@Getter
28-
private final String path;
29-
@Getter
30-
private String format = "";
24+
@Getter private final JSONObject jsonContent;
25+
@Getter private final String path;
26+
@Getter private String format = "";
3127

3228
@Setter
3329
@Getter
@@ -43,9 +39,7 @@ public PPLQueryRequest(String pplQuery, JSONObject jsonContent, String path) {
4339
this(pplQuery, jsonContent, path, "");
4440
}
4541

46-
/**
47-
* Constructor of PPLQueryRequest.
48-
*/
42+
/** Constructor of PPLQueryRequest. */
4943
public PPLQueryRequest(String pplQuery, JSONObject jsonContent, String path, String format) {
5044
this.pplQuery = pplQuery;
5145
this.jsonContent = jsonContent;
@@ -59,23 +53,21 @@ public String getRequest() {
5953

6054
/**
6155
* Check if request is to explain rather than execute the query.
62-
* @return true if it is a explain request
56+
*
57+
* @return true if it is a explain request
6358
*/
6459
public boolean isExplainRequest() {
6560
return path.endsWith("/_explain");
6661
}
6762

68-
/**
69-
* Decide on the formatter by the requested format.
70-
*/
63+
/** Decide on the formatter by the requested format. */
7164
public Format format() {
7265
Optional<Format> optionalFormat = Format.of(format);
7366
if (optionalFormat.isPresent()) {
7467
return optionalFormat.get();
7568
} else {
7669
throw new IllegalArgumentException(
77-
String.format(Locale.ROOT,"response in %s format is not supported.", format));
70+
String.format(Locale.ROOT, "response in %s format is not supported.", format));
7871
}
7972
}
80-
8173
}

ppl/src/main/java/org/opensearch/sql/ppl/domain/PPLQueryResponse.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
76
package org.opensearch.sql.ppl.domain;
87

9-
public class PPLQueryResponse {
10-
}
8+
public class PPLQueryResponse {}

0 commit comments

Comments
 (0)