Skip to content

Commit fa723bf

Browse files
committed
Upgrade to Spotless 2.44.3 and Google Java Format 1.17 (supporting JDK23)
1 parent 91b17f6 commit fa723bf

File tree

33 files changed

+121
-102
lines changed

33 files changed

+121
-102
lines changed

adapter/avro/src/main/java/org/apache/arrow/adapter/avro/AvroToArrowConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
public class AvroToArrowConfig {
2626

2727
private final BufferAllocator allocator;
28+
2829
/**
2930
* The maximum rowCount to read each time when partially convert data. Default value is 1024 and
3031
* -1 means read all data into one vector.

adapter/avro/src/main/java/org/apache/arrow/adapter/avro/AvroToArrowUtils.java

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private static Consumer createConsumer(
185185
break;
186186
case STRING:
187187
arrowType = new ArrowType.Utf8();
188-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
188+
fieldType = new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
189189
vector = createVector(consumerVector, fieldType, name, allocator);
190190
consumer = new AvroStringConsumer((VarCharVector) vector);
191191
break;
@@ -195,7 +195,7 @@ private static Consumer createConsumer(
195195
arrowType = createDecimalArrowType((LogicalTypes.Decimal) logicalType);
196196
fieldType =
197197
new FieldType(
198-
nullable, arrowType, /*dictionary=*/ null, getMetaData(schema, extProps));
198+
nullable, arrowType, /* dictionary= */ null, getMetaData(schema, extProps));
199199
vector = createVector(consumerVector, fieldType, name, allocator);
200200
consumer =
201201
new AvroDecimalConsumer.FixedDecimalConsumer(
@@ -204,87 +204,96 @@ private static Consumer createConsumer(
204204
arrowType = new ArrowType.FixedSizeBinary(schema.getFixedSize());
205205
fieldType =
206206
new FieldType(
207-
nullable, arrowType, /*dictionary=*/ null, getMetaData(schema, extProps));
207+
nullable, arrowType, /* dictionary= */ null, getMetaData(schema, extProps));
208208
vector = createVector(consumerVector, fieldType, name, allocator);
209209
consumer = new AvroFixedConsumer((FixedSizeBinaryVector) vector, schema.getFixedSize());
210210
}
211211
break;
212212
case INT:
213213
if (logicalType instanceof LogicalTypes.Date) {
214214
arrowType = new ArrowType.Date(DateUnit.DAY);
215-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
215+
fieldType =
216+
new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
216217
vector = createVector(consumerVector, fieldType, name, allocator);
217218
consumer = new AvroDateConsumer((DateDayVector) vector);
218219
} else if (logicalType instanceof LogicalTypes.TimeMillis) {
219220
arrowType = new ArrowType.Time(TimeUnit.MILLISECOND, 32);
220-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
221+
fieldType =
222+
new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
221223
vector = createVector(consumerVector, fieldType, name, allocator);
222224
consumer = new AvroTimeMillisConsumer((TimeMilliVector) vector);
223225
} else {
224-
arrowType = new ArrowType.Int(32, /*isSigned=*/ true);
225-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
226+
arrowType = new ArrowType.Int(32, /* isSigned= */ true);
227+
fieldType =
228+
new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
226229
vector = createVector(consumerVector, fieldType, name, allocator);
227230
consumer = new AvroIntConsumer((IntVector) vector);
228231
}
229232
break;
230233
case BOOLEAN:
231234
arrowType = new ArrowType.Bool();
232-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
235+
fieldType = new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
233236
vector = createVector(consumerVector, fieldType, name, allocator);
234237
consumer = new AvroBooleanConsumer((BitVector) vector);
235238
break;
236239
case LONG:
237240
if (logicalType instanceof LogicalTypes.TimeMicros) {
238241
arrowType = new ArrowType.Time(TimeUnit.MICROSECOND, 64);
239-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
242+
fieldType =
243+
new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
240244
vector = createVector(consumerVector, fieldType, name, allocator);
241245
consumer = new AvroTimeMicroConsumer((TimeMicroVector) vector);
242246
} else if (logicalType instanceof LogicalTypes.TimestampMillis) {
243247
arrowType = new ArrowType.Timestamp(TimeUnit.MILLISECOND, null);
244-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
248+
fieldType =
249+
new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
245250
vector = createVector(consumerVector, fieldType, name, allocator);
246251
consumer = new AvroTimestampMillisConsumer((TimeStampMilliVector) vector);
247252
} else if (logicalType instanceof LogicalTypes.TimestampMicros) {
248253
arrowType = new ArrowType.Timestamp(TimeUnit.MICROSECOND, null);
249-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
254+
fieldType =
255+
new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
250256
vector = createVector(consumerVector, fieldType, name, allocator);
251257
consumer = new AvroTimestampMicrosConsumer((TimeStampMicroVector) vector);
252258
} else {
253-
arrowType = new ArrowType.Int(64, /*isSigned=*/ true);
254-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
259+
arrowType = new ArrowType.Int(64, /* isSigned= */ true);
260+
fieldType =
261+
new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
255262
vector = createVector(consumerVector, fieldType, name, allocator);
256263
consumer = new AvroLongConsumer((BigIntVector) vector);
257264
}
258265
break;
259266
case FLOAT:
260267
arrowType = new ArrowType.FloatingPoint(SINGLE);
261-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
268+
fieldType = new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
262269
vector = createVector(consumerVector, fieldType, name, allocator);
263270
consumer = new AvroFloatConsumer((Float4Vector) vector);
264271
break;
265272
case DOUBLE:
266273
arrowType = new ArrowType.FloatingPoint(DOUBLE);
267-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
274+
fieldType = new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
268275
vector = createVector(consumerVector, fieldType, name, allocator);
269276
consumer = new AvroDoubleConsumer((Float8Vector) vector);
270277
break;
271278
case BYTES:
272279
if (logicalType instanceof LogicalTypes.Decimal) {
273280
arrowType = createDecimalArrowType((LogicalTypes.Decimal) logicalType);
274-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
281+
fieldType =
282+
new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
275283
vector = createVector(consumerVector, fieldType, name, allocator);
276284
consumer = new AvroDecimalConsumer.BytesDecimalConsumer((DecimalVector) vector);
277285
} else {
278286
arrowType = new ArrowType.Binary();
279-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
287+
fieldType =
288+
new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
280289
vector = createVector(consumerVector, fieldType, name, allocator);
281290
consumer = new AvroBytesConsumer((VarBinaryVector) vector);
282291
}
283292
break;
284293
case NULL:
285294
arrowType = new ArrowType.Null();
286-
fieldType = new FieldType(nullable, arrowType, /*dictionary=*/ null, getMetaData(schema));
287-
vector = fieldType.createNewSingleVector(name, allocator, /*schemaCallBack=*/ null);
295+
fieldType = new FieldType(nullable, arrowType, /* dictionary= */ null, getMetaData(schema));
296+
vector = fieldType.createNewSingleVector(name, allocator, /* schemaCallBack= */ null);
288297
consumer = new AvroNullConsumer((NullVector) vector);
289298
break;
290299
default:
@@ -462,17 +471,17 @@ private static Field avroSchemaToField(
462471
case MAP:
463472
// MapVector internal struct field and key field should be non-nullable
464473
FieldType keyFieldType =
465-
new FieldType(/*nullable=*/ false, new ArrowType.Utf8(), /*dictionary=*/ null);
466-
Field keyField = new Field("key", keyFieldType, /*children=*/ null);
474+
new FieldType(/* nullable= */ false, new ArrowType.Utf8(), /* dictionary= */ null);
475+
Field keyField = new Field("key", keyFieldType, /* children= */ null);
467476
Field valueField = avroSchemaToField(schema.getValueType(), "value", config);
468477

469478
FieldType structFieldType =
470-
new FieldType(false, new ArrowType.Struct(), /*dictionary=*/ null);
479+
new FieldType(false, new ArrowType.Struct(), /* dictionary= */ null);
471480
Field structField =
472481
new Field("internal", structFieldType, Arrays.asList(keyField, valueField));
473482
children.add(structField);
474483
fieldType =
475-
createFieldType(new ArrowType.Map(/*keysSorted=*/ false), schema, externalProps);
484+
createFieldType(new ArrowType.Map(/* keysSorted= */ false), schema, externalProps);
476485
break;
477486
case RECORD:
478487
final Set<String> skipFieldNames = config.getSkipFieldNames();
@@ -506,7 +515,7 @@ private static Field avroSchemaToField(
506515
indexType,
507516
schema,
508517
externalProps,
509-
new DictionaryEncoding(current, /*ordered=*/ false, /*indexType=*/ indexType));
518+
new DictionaryEncoding(current, /* ordered= */ false, /* indexType= */ indexType));
510519
break;
511520

512521
case STRING:
@@ -528,7 +537,7 @@ private static Field avroSchemaToField(
528537
} else if (logicalType instanceof LogicalTypes.TimeMillis) {
529538
intArrowType = new ArrowType.Time(TimeUnit.MILLISECOND, 32);
530539
} else {
531-
intArrowType = new ArrowType.Int(32, /*isSigned=*/ true);
540+
intArrowType = new ArrowType.Int(32, /* isSigned= */ true);
532541
}
533542
fieldType = createFieldType(intArrowType, schema, externalProps);
534543
break;
@@ -544,7 +553,7 @@ private static Field avroSchemaToField(
544553
} else if (logicalType instanceof LogicalTypes.TimestampMicros) {
545554
longArrowType = new ArrowType.Timestamp(TimeUnit.MICROSECOND, null);
546555
} else {
547-
longArrowType = new ArrowType.Int(64, /*isSigned=*/ true);
556+
longArrowType = new ArrowType.Int(64, /* isSigned= */ true);
548557
}
549558
fieldType = createFieldType(longArrowType, schema, externalProps);
550559
break;
@@ -806,7 +815,7 @@ private static Map<String, String> createExternalProps(Schema schema) {
806815

807816
private static FieldType createFieldType(
808817
ArrowType arrowType, Schema schema, Map<String, String> externalProps) {
809-
return createFieldType(arrowType, schema, externalProps, /*dictionary=*/ null);
818+
return createFieldType(arrowType, schema, externalProps, /* dictionary= */ null);
810819
}
811820

812821
private static FieldType createFieldType(
@@ -816,7 +825,7 @@ private static FieldType createFieldType(
816825
DictionaryEncoding dictionary) {
817826

818827
return new FieldType(
819-
/*nullable=*/ false, arrowType, dictionary, getMetaData(schema, externalProps));
828+
/* nullable= */ false, arrowType, dictionary, getMetaData(schema, externalProps));
820829
}
821830

822831
private static String convertAliases(Set<String> aliases) {

adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcParameterBinder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static class Builder {
116116
/** Bind each column to the corresponding parameter in order. */
117117
public Builder bindAll() {
118118
for (int i = 0; i < root.getFieldVectors().size(); i++) {
119-
bind(/*parameterIndex=*/ i + 1, /*columnIndex=*/ i);
119+
bind(/* parameterIndex= */ i + 1, /* columnIndex= */ i);
120120
}
121121
return this;
122122
}

adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public final class JdbcToArrowConfig {
6161
private final Map<String, String> schemaMetadata;
6262
private final Map<Integer, Map<String, String>> columnMetadataByColumnIndex;
6363
private final RoundingMode bigDecimalRoundingMode;
64+
6465
/**
6566
* The maximum rowCount to read each time when partially convert data. Default value is 1024 and
6667
* -1 means disable partial read. default is -1 which means disable partial read. Note that this

adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/JdbcToArrowUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public static Schema jdbcToArrowSchema(
145145
final int scale = parameterMetaData.getScale(parameterCounter);
146146
final ArrowType arrowType =
147147
getArrowTypeFromJdbcType(new JdbcFieldInfo(jdbcDataType, precision, scale), calendar);
148-
final FieldType fieldType = new FieldType(arrowIsNullable, arrowType, /*dictionary=*/ null);
148+
final FieldType fieldType = new FieldType(arrowIsNullable, arrowType, /* dictionary= */ null);
149149
parameterFields.add(new Field(null, fieldType, null));
150150
}
151151

adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/JdbcParameterBinderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ void bindOrder() throws SQLException {
107107
final VectorSchemaRoot root = VectorSchemaRoot.create(schema, allocator)) {
108108
final JdbcParameterBinder binder =
109109
JdbcParameterBinder.builder(statement, root)
110-
.bind(/*parameterIndex=*/ 1, /*columnIndex=*/ 2)
111-
.bind(/*parameterIndex=*/ 2, /*columnIndex=*/ 0)
110+
.bind(/* parameterIndex= */ 1, /* columnIndex= */ 2)
111+
.bind(/* parameterIndex= */ 2, /* columnIndex= */ 0)
112112
.build();
113113
assertThat(binder.next()).isFalse();
114114

@@ -166,7 +166,7 @@ void customBinder() throws SQLException {
166166
final JdbcParameterBinder binder =
167167
JdbcParameterBinder.builder(statement, root)
168168
.bind(
169-
/*parameterIndex=*/ 1,
169+
/* parameterIndex= */ 1,
170170
new ColumnBinder() {
171171
private final IntVector vector = (IntVector) root.getVector(0);
172172

adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/UnreliableMetaDataTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,11 @@ public void testIncorrectNullability(boolean reuseVectorSchemaRoot) throws Excep
187187
final Schema notNullSchema =
188188
new Schema(
189189
Collections.singletonList(
190-
Field.notNullable(/*name=*/ null, new ArrowType.Int(32, true))));
190+
Field.notNullable(/* name= */ null, new ArrowType.Int(32, true))));
191191
final Schema nullSchema =
192192
new Schema(
193-
Collections.singletonList(Field.nullable(/*name=*/ null, new ArrowType.Int(32, true))));
193+
Collections.singletonList(
194+
Field.nullable(/* name= */ null, new ArrowType.Int(32, true))));
194195

195196
try (final ResultSet rs = resultSetBuilder.build()) {
196197
JdbcToArrowConfig config =

bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ under the License.
203203
<plugin>
204204
<groupId>com.diffplug.spotless</groupId>
205205
<artifactId>spotless-maven-plugin</artifactId>
206-
<version>2.30.0</version>
206+
<version>2.44.3</version>
207207
</plugin>
208208
<plugin>
209209
<groupId>org.codehaus.mojo</groupId>

compression/src/main/java/org/apache/arrow/compression/Lz4CompressionCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected ArrowBuf doCompress(BufferAllocator allocator, ArrowBuf uncompressedBu
4141
Integer.MAX_VALUE);
4242

4343
byte[] inBytes = new byte[(int) uncompressedBuffer.writerIndex()];
44-
uncompressedBuffer.getBytes(/*index=*/ 0, inBytes);
44+
uncompressedBuffer.getBytes(/* index= */ 0, inBytes);
4545
ByteArrayOutputStream baos = new ByteArrayOutputStream();
4646
try (InputStream in = new ByteArrayInputStream(inBytes);
4747
OutputStream out = new FramedLZ4CompressorOutputStream(baos)) {
@@ -81,7 +81,7 @@ protected ArrowBuf doDecompress(BufferAllocator allocator, ArrowBuf compressedBu
8181

8282
byte[] outBytes = out.toByteArray();
8383
ArrowBuf decompressedBuffer = allocator.buffer(outBytes.length);
84-
decompressedBuffer.setBytes(/*index=*/ 0, outBytes);
84+
decompressedBuffer.setBytes(/* index= */ 0, outBytes);
8585
decompressedBuffer.writerIndex(decompressedLength);
8686
return decompressedBuffer;
8787
}

compression/src/main/java/org/apache/arrow/compression/ZstdCompressionCodec.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ protected ArrowBuf doCompress(BufferAllocator allocator, ArrowBuf uncompressedBu
4646
compressedBuffer.memoryAddress() + CompressionUtil.SIZE_OF_UNCOMPRESSED_LENGTH,
4747
dstSize,
4848
/*src*/ uncompressedBuffer.memoryAddress(),
49-
/*srcSize=*/ uncompressedBuffer.writerIndex(),
50-
/*level=*/ this.compressionLevel);
49+
/* srcSize= */ uncompressedBuffer.writerIndex(),
50+
/* level= */ this.compressionLevel);
5151
if (Zstd.isError(bytesWritten)) {
5252
compressedBuffer.close();
5353
throw new RuntimeException("Error compressing: " + Zstd.getErrorName(bytesWritten));
@@ -64,7 +64,8 @@ protected ArrowBuf doDecompress(BufferAllocator allocator, ArrowBuf compressedBu
6464
Zstd.decompressUnsafe(
6565
uncompressedBuffer.memoryAddress(),
6666
decompressedLength,
67-
/*src=*/ compressedBuffer.memoryAddress() + CompressionUtil.SIZE_OF_UNCOMPRESSED_LENGTH,
67+
/* src= */ compressedBuffer.memoryAddress()
68+
+ CompressionUtil.SIZE_OF_UNCOMPRESSED_LENGTH,
6869
compressedBuffer.writerIndex() - CompressionUtil.SIZE_OF_UNCOMPRESSED_LENGTH);
6970
if (Zstd.isError(decompressedSize)) {
7071
uncompressedBuffer.close();

0 commit comments

Comments
 (0)