Skip to content

Commit 80fe29d

Browse files
committed
fix SpotlessCheck issue
Signed-off-by: Lantao Jin <ltjin@amazon.com>
1 parent ce571cd commit 80fe29d

42 files changed

Lines changed: 763 additions & 687 deletions

File tree

Some content is hidden

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

api/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spotless {
2828
removeUnusedImports()
2929
trimTrailingWhitespace()
3030
endWithNewline()
31-
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
31+
googleJavaFormat('1.32.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
3232
}
3333
}
3434

async-query-core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ spotless {
8080
removeUnusedImports()
8181
trimTrailingWhitespace()
8282
endWithNewline()
83-
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
83+
googleJavaFormat('1.32.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
8484
}
8585
}
8686

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ plugins {
8080
id 'java-library'
8181
id "io.freefair.lombok" version "8.14"
8282
id 'jacoco'
83-
id 'com.diffplug.spotless' version '7.2.1'
83+
id 'com.diffplug.spotless' version '8.1.0'
8484
}
8585

8686
// import versions defined in https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java#L94
@@ -113,7 +113,7 @@ spotless {
113113
removeUnusedImports()
114114
trimTrailingWhitespace()
115115
endWithNewline()
116-
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
116+
googleJavaFormat('1.32.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
117117
}
118118
}
119119

common/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ spotless {
8080
removeUnusedImports()
8181
trimTrailingWhitespace()
8282
endWithNewline()
83-
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
83+
googleJavaFormat('1.32.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
8484
}
8585
}

core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ spotless {
9191
removeUnusedImports()
9292
trimTrailingWhitespace()
9393
endWithNewline()
94-
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
94+
googleJavaFormat('1.32.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
9595
}
9696
}
9797

core/src/main/java/org/opensearch/sql/calcite/CalciteRelNodeVisitor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,9 @@ private List<RexNode> expandProjectFields(
451451
.filter(addedFields::add)
452452
.forEach(field -> expandedFields.add(context.relBuilder.field(field)));
453453
}
454-
default -> throw new IllegalStateException(
455-
"Unexpected expression type in project list: " + expr.getClass().getSimpleName());
454+
default ->
455+
throw new IllegalStateException(
456+
"Unexpected expression type in project list: " + expr.getClass().getSimpleName());
456457
}
457458
}
458459

core/src/main/java/org/opensearch/sql/calcite/ExtendedRexBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ public RexNode makeCast(
171171
"Cannot convert %s to IP, only STRING and IP types are supported",
172172
argExprType));
173173
}
174-
default -> throw new SemanticCheckException(
175-
String.format(Locale.ROOT, "Cannot cast from %s to %s", argExprType, udt.name()));
174+
default ->
175+
throw new SemanticCheckException(
176+
String.format(Locale.ROOT, "Cannot cast from %s to %s", argExprType, udt.name()));
176177
};
177178
}
178179
// Use a custom operator when casting floating point or decimal number to a character type.

core/src/main/java/org/opensearch/sql/calcite/type/ExprSqlType.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public Type getJavaType() {
5454
INTEGER,
5555
INTERVAL_YEAR,
5656
INTERVAL_YEAR_MONTH,
57-
INTERVAL_MONTH -> this.isNullable() ? Integer.class : int.class;
57+
INTERVAL_MONTH ->
58+
this.isNullable() ? Integer.class : int.class;
5859
case TIMESTAMP,
5960
TIMESTAMP_WITH_LOCAL_TIME_ZONE,
6061
TIMESTAMP_TZ,
@@ -68,13 +69,14 @@ public Type getJavaType() {
6869
INTERVAL_HOUR_SECOND,
6970
INTERVAL_MINUTE,
7071
INTERVAL_MINUTE_SECOND,
71-
INTERVAL_SECOND -> this.isNullable() ? Long.class : long.class;
72+
INTERVAL_SECOND ->
73+
this.isNullable() ? Long.class : long.class;
7274
case SMALLINT -> this.isNullable() ? Short.class : short.class;
7375
case TINYINT -> this.isNullable() ? Byte.class : byte.class;
7476
case DECIMAL -> BigDecimal.class;
7577
case BOOLEAN -> this.isNullable() ? Boolean.class : boolean.class;
7678
case DOUBLE, FLOAT -> // sic
77-
this.isNullable() ? Double.class : double.class;
79+
this.isNullable() ? Double.class : double.class;
7880
case REAL -> this.isNullable() ? Float.class : float.class;
7981
case BINARY, VARBINARY -> ByteString.class;
8082
case GEOMETRY -> Geometry.class;

core/src/main/java/org/opensearch/sql/calcite/utils/OpenSearchTypeFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ public static ExprType convertSqlTypeNameToExprType(SqlTypeName sqlTypeName) {
240240
INTERVAL_HOUR_SECOND,
241241
INTERVAL_MINUTE,
242242
INTERVAL_MINUTE_SECOND,
243-
INTERVAL_SECOND -> INTERVAL;
243+
INTERVAL_SECOND ->
244+
INTERVAL;
244245
case ARRAY -> ARRAY;
245246
case MAP -> STRUCT;
246247
case GEOMETRY -> GEO_POINT;

core/src/main/java/org/opensearch/sql/calcite/utils/PlanUtils.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ static RexNode makeOver(
159159
RexWindowBound lowerBound = convert(context, windowFrame.getLower());
160160
RexWindowBound upperBound = convert(context, windowFrame.getUpper());
161161
switch (functionName) {
162-
// There is no "avg" AggImplementor in Calcite, we have to change avg window
163-
// function to `sum over(...).toRex / count over(...).toRex`
162+
// There is no "avg" AggImplementor in Calcite, we have to change avg window
163+
// function to `sum over(...).toRex / count over(...).toRex`
164164
case AVG:
165165
// avg(x) ==>
166166
// sum(x) / count(x)
@@ -170,17 +170,17 @@ static RexNode makeOver(
170170
context.relBuilder.cast(
171171
countOver(context, field, partitions, rows, lowerBound, upperBound),
172172
SqlTypeName.DOUBLE));
173-
// stddev_pop(x) ==>
174-
// power((sum(x * x) - sum(x) * sum(x) / count(x)) / count(x), 0.5)
175-
//
176-
// stddev_samp(x) ==>
177-
// power((sum(x * x) - sum(x) * sum(x) / count(x)) / (count(x) - 1), 0.5)
178-
//
179-
// var_pop(x) ==>
180-
// (sum(x * x) - sum(x) * sum(x) / count(x)) / count(x)
181-
//
182-
// var_samp(x) ==>
183-
// (sum(x * x) - sum(x) * sum(x) / count(x)) / (count(x) - 1)
173+
// stddev_pop(x) ==>
174+
// power((sum(x * x) - sum(x) * sum(x) / count(x)) / count(x), 0.5)
175+
//
176+
// stddev_samp(x) ==>
177+
// power((sum(x * x) - sum(x) * sum(x) / count(x)) / (count(x) - 1), 0.5)
178+
//
179+
// var_pop(x) ==>
180+
// (sum(x * x) - sum(x) * sum(x) / count(x)) / count(x)
181+
//
182+
// var_samp(x) ==>
183+
// (sum(x * x) - sum(x) * sum(x) / count(x)) / (count(x) - 1)
184184
case STDDEV_POP:
185185
return variance(context, field, partitions, rows, lowerBound, upperBound, true, true);
186186
case STDDEV_SAMP:

0 commit comments

Comments
 (0)