Skip to content

Commit 8638f92

Browse files
authored
Merge pull request #324 from Bit-Quill/dev/sl_GoogleJavaFormat5_p2
[Spotless] Applying Google Code Format for core #5
2 parents a5ecf13 + 50fa8e8 commit 8638f92

File tree

134 files changed

+5626
-5665
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+5626
-5665
lines changed

build.gradle

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,7 @@ repositories {
8484
spotless {
8585
java {
8686
target fileTree('.') {
87-
include 'core/src/main/java/org/opensearch/sql/analysis/**/*.java',
88-
'core/src/test/java/org/opensearch/sql/data/**/*.java',
89-
'core/src/test/java/org/opensearch/sql/datasource/**/*.java',
90-
'core/src/test/java/org/opensearch/sql/ast/**/*.java',
91-
'core/src/main/java/org/opensearch/sql/monitor/**/*.java',
92-
'core/src/main/java/org/opensearch/sql/expression/**/*.java',
93-
'core/src/main/java/org/opensearch/sql/executor/**/*.java',
94-
'core/src/main/java/org/opensearch/sql/exception/**/*.java',
95-
'core/src/main/java/org/opensearch/sql/planner/**/*.java',
96-
'core/src/main/java/org/opensearch/sql/storage/**/*.java',
97-
'core/src/main/java/org/opensearch/sql/utils/**/*.java',
98-
'core/src/main/java/org/opensearch/sql/DataSourceSchemaName.java',
99-
'core/src/test/java/org/opensearch/sql/data/**/*.java',
100-
'core/src/test/java/org/opensearch/sql/config/**/*.java',
101-
'core/src/test/java/org/opensearch/sql/analysis/**/*.java'
87+
include 'core/**/*.java'
10288
exclude '**/build/**', '**/build-*/**'
10389
}
10490
// importOrder()

core/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ dependencies {
6666
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.12.4'
6767
}
6868

69+
checkstyleMain.ignoreFailures = true
70+
checkstyleTest.ignoreFailures = true
71+
6972
test {
7073
useJUnitPlatform()
7174
testLogging {

core/src/main/java/org/opensearch/sql/ast/dsl/AstDSL.java

Lines changed: 37 additions & 35 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.ast.dsl;
87

98
import java.util.Arrays;
@@ -63,9 +62,7 @@
6362
import org.opensearch.sql.ast.tree.UnresolvedPlan;
6463
import org.opensearch.sql.ast.tree.Values;
6564

66-
/**
67-
* Class of static methods to create specific node instances.
68-
*/
65+
/** Class of static methods to create specific node instances. */
6966
@UtilityClass
7067
public class AstDSL {
7168

@@ -132,8 +129,9 @@ public static UnresolvedPlan rename(UnresolvedPlan input, Map... maps) {
132129

133130
/**
134131
* Initialize Values node by rows of literals.
135-
* @param values rows in which each row is a list of literal values
136-
* @return Values node
132+
*
133+
* @param values rows in which each row is a list of literal values
134+
* @return Values node
137135
*/
138136
@SafeVarargs
139137
public UnresolvedPlan values(List<Literal>... values) {
@@ -255,21 +253,23 @@ public static Function function(String funcName, UnresolvedExpression... funcArg
255253
* &emsp; [ELSE result_expr]<br>
256254
* END
257255
*/
258-
public UnresolvedExpression caseWhen(UnresolvedExpression elseClause,
259-
When... whenClauses) {
256+
public UnresolvedExpression caseWhen(UnresolvedExpression elseClause, When... whenClauses) {
260257
return caseWhen(null, elseClause, whenClauses);
261258
}
262259

263260
/**
261+
*
262+
*
263+
* <pre>
264264
* CASE case_value_expr
265265
* WHEN compare_expr THEN result_expr
266266
* [WHEN compare_expr THEN result_expr] ...
267267
* [ELSE result_expr]
268268
* END
269+
* </pre>
269270
*/
270-
public UnresolvedExpression caseWhen(UnresolvedExpression caseValueExpr,
271-
UnresolvedExpression elseClause,
272-
When... whenClauses) {
271+
public UnresolvedExpression caseWhen(
272+
UnresolvedExpression caseValueExpr, UnresolvedExpression elseClause, When... whenClauses) {
273273
return new Case(caseValueExpr, Arrays.asList(whenClauses), elseClause);
274274
}
275275

@@ -281,19 +281,20 @@ public When when(UnresolvedExpression condition, UnresolvedExpression result) {
281281
return new When(condition, result);
282282
}
283283

284-
public UnresolvedExpression highlight(UnresolvedExpression fieldName,
285-
java.util.Map<String, Literal> arguments) {
284+
public UnresolvedExpression highlight(
285+
UnresolvedExpression fieldName, java.util.Map<String, Literal> arguments) {
286286
return new HighlightFunction(fieldName, arguments);
287287
}
288288

289-
public UnresolvedExpression score(UnresolvedExpression relevanceQuery,
290-
Literal relevanceFieldWeight) {
289+
public UnresolvedExpression score(
290+
UnresolvedExpression relevanceQuery, Literal relevanceFieldWeight) {
291291
return new ScoreFunction(relevanceQuery, relevanceFieldWeight);
292292
}
293293

294-
public UnresolvedExpression window(UnresolvedExpression function,
295-
List<UnresolvedExpression> partitionByList,
296-
List<Pair<SortOption, UnresolvedExpression>> sortList) {
294+
public UnresolvedExpression window(
295+
UnresolvedExpression function,
296+
List<UnresolvedExpression> partitionByList,
297+
List<Pair<SortOption, UnresolvedExpression>> sortList) {
297298
return new WindowFunction(function, partitionByList, sortList);
298299
}
299300

@@ -328,9 +329,10 @@ public static UnresolvedExpression compare(
328329
return new Compare(operator, left, right);
329330
}
330331

331-
public static UnresolvedExpression between(UnresolvedExpression value,
332-
UnresolvedExpression lowerBound,
333-
UnresolvedExpression upperBound) {
332+
public static UnresolvedExpression between(
333+
UnresolvedExpression value,
334+
UnresolvedExpression lowerBound,
335+
UnresolvedExpression upperBound) {
334336
return new Between(value, lowerBound, upperBound);
335337
}
336338

@@ -398,9 +400,7 @@ public static List<Argument> defaultFieldsArgs() {
398400
return exprList(argument("exclude", booleanLiteral(false)));
399401
}
400402

401-
/**
402-
* Default Stats Command Args.
403-
*/
403+
/** Default Stats Command Args. */
404404
public static List<Argument> defaultStatsArgs() {
405405
return exprList(
406406
argument("partitions", intLiteral(1)),
@@ -409,9 +409,7 @@ public static List<Argument> defaultStatsArgs() {
409409
argument("dedupsplit", booleanLiteral(false)));
410410
}
411411

412-
/**
413-
* Default Dedup Command Args.
414-
*/
412+
/** Default Dedup Command Args. */
415413
public static List<Argument> defaultDedupArgs() {
416414
return exprList(
417415
argument("number", intLiteral(1)),
@@ -447,9 +445,12 @@ public static List<Argument> defaultTopArgs() {
447445
return exprList(argument("noOfResults", intLiteral(10)));
448446
}
449447

450-
public static RareTopN rareTopN(UnresolvedPlan input, CommandType commandType,
451-
List<Argument> noOfResults, List<UnresolvedExpression> groupList,
452-
Field... fields) {
448+
public static RareTopN rareTopN(
449+
UnresolvedPlan input,
450+
CommandType commandType,
451+
List<Argument> noOfResults,
452+
List<UnresolvedExpression> groupList,
453+
Field... fields) {
453454
return new RareTopN(input, commandType, noOfResults, Arrays.asList(fields), groupList)
454455
.attach(input);
455456
}
@@ -458,11 +459,12 @@ public static Limit limit(UnresolvedPlan input, Integer limit, Integer offset) {
458459
return new Limit(limit, offset).attach(input);
459460
}
460461

461-
public static Parse parse(UnresolvedPlan input, ParseMethod parseMethod,
462-
UnresolvedExpression sourceField,
463-
Literal pattern,
464-
java.util.Map<String, Literal> arguments) {
462+
public static Parse parse(
463+
UnresolvedPlan input,
464+
ParseMethod parseMethod,
465+
UnresolvedExpression sourceField,
466+
Literal pattern,
467+
java.util.Map<String, Literal> arguments) {
465468
return new Parse(parseMethod, sourceField, pattern, arguments, input);
466469
}
467-
468470
}

core/src/main/java/org/opensearch/sql/ast/expression/QualifiedName.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,21 @@ public Optional<String> first() {
7575
}
7676

7777
/**
78+
*
79+
*
80+
* <pre>
7881
* Get rest parts of the qualified name. Assume that there must be remaining parts so caller is
79-
* responsible for the check (first() or size() must be called first).<br>
80-
* For example:<br>
81-
* {@code<br>
82-
* &nbsp; QualifiedName name = ...<br>
83-
* &nbsp; Optional<String> first = name.first();<br>
84-
* &nbsp; if (first.isPresent()) {<br>
85-
* &ensp; name.rest() ...<br>
86-
* &nbsp; }<br>
82+
* responsible for the check (first() or size() must be called first).
83+
* For example:
84+
* {@code
85+
* QualifiedName name = ...
86+
* Optional<String> first = name.first();
87+
* if (first.isPresent()) {
88+
* name.rest() ...
8789
* }
90+
* }
91+
* </pre>
92+
*
8893
* @return rest part(s)
8994
*/
9095
public QualifiedName rest() {

core/src/main/java/org/opensearch/sql/data/model/AbstractExprValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public int compareTo(ExprValue other) {
2929
}
3030

3131
/**
32-
* The customize equals logic.
33-
* The table below list the NULL and MISSING handling logic.
32+
* The customize equals logic. The table below list the NULL and MISSING handling logic.
33+
*
3434
* <table>
3535
* <tr>
3636
* <th>A</th>

core/src/main/java/org/opensearch/sql/data/model/ExprTimeValue.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public ExprTimeValue(String time) {
3434
this.time = LocalTime.parse(time, DATE_TIME_FORMATTER_VARIABLE_NANOS_OPTIONAL);
3535
} catch (DateTimeParseException e) {
3636
throw new SemanticCheckException(
37-
String.format(
38-
"time:%s in unsupported format, please use 'HH:mm:ss[.SSSSSSSSS]'", time));
37+
String.format("time:%s in unsupported format, please use 'HH:mm:ss[.SSSSSSSSS]'", time));
3938
}
4039
}
4140

core/src/main/java/org/opensearch/sql/data/type/WideningTypeRule.java

Lines changed: 7 additions & 6 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.data.type;
87

98
import static org.opensearch.sql.data.type.ExprCoreType.UNKNOWN;
@@ -13,6 +12,7 @@
1312

1413
/**
1514
* The definition of widening type rule for expression value.
15+
*
1616
* <table border="3">
1717
* <tr><th>ExprType</th><th>Widens to data types</th></tr>
1818
* <tr><td>INTEGER</td><td>LONG, FLOAT, DOUBLE</td></tr>
@@ -31,8 +31,8 @@ public class WideningTypeRule {
3131
public static final int TYPE_EQUAL = 0;
3232

3333
/**
34-
* The widening distance is calculated from the leaf to root.
35-
* e.g. distance(INTEGER, FLOAT) = 2, but distance(FLOAT, INTEGER) = IMPOSSIBLE_WIDENING
34+
* The widening distance is calculated from the leaf to root. e.g. distance(INTEGER, FLOAT) = 2,
35+
* but distance(FLOAT, INTEGER) = IMPOSSIBLE_WIDENING
3636
*
3737
* @param type1 widen from type
3838
* @param type2 widen to type
@@ -50,14 +50,15 @@ private static int distance(ExprType type1, ExprType type2, int distance) {
5050
} else {
5151
return type1.getParent().stream()
5252
.map(parentOfType1 -> distance(parentOfType1, type2, distance + 1))
53-
.reduce(Math::min).get();
53+
.reduce(Math::min)
54+
.get();
5455
}
5556
}
5657

5758
/**
5859
* The max type among two types. The max is defined as follow if type1 could widen to type2, then
59-
* max is type2, vice versa if type1 couldn't widen to type2 and type2 could't widen to type1, then
60-
* throw {@link ExpressionEvaluationException}.
60+
* max is type2, vice versa if type1 couldn't widen to type2 and type2 could't widen to type1,
61+
* then throw {@link ExpressionEvaluationException}.
6162
*
6263
* @param type1 type1
6364
* @param type2 type2

0 commit comments

Comments
 (0)