Skip to content

Commit 75debde

Browse files
committed
Move on from java8 for three core modules
1 parent 4147bc6 commit 75debde

File tree

46 files changed

+233
-275
lines changed

Some content is hidden

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

46 files changed

+233
-275
lines changed

parquet-column/src/main/java/org/apache/parquet/filter2/recordlevel/IncrementallyUpdatedFilterPredicate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
package org.apache.parquet.filter2.recordlevel;
2020

21-
import java.util.Arrays;
21+
import java.util.List;
2222
import java.util.Objects;
2323
import org.apache.parquet.io.api.Binary;
2424

@@ -153,7 +153,7 @@ abstract static class DelegatingValueInspector extends ValueInspector {
153153
private final Iterable<ValueInspector> delegates;
154154

155155
DelegatingValueInspector(ValueInspector... delegates) {
156-
this.delegates = Arrays.asList(delegates);
156+
this.delegates = List.of(delegates);
157157
}
158158

159159
/**

parquet-column/src/main/java/org/apache/parquet/io/RecordReaderImplementation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,6 @@ protected Converter getRecordConsumer() {
488488

489489
protected Iterable<ColumnReader> getColumnReaders() {
490490
// Converting the array to an iterable ensures that the array cannot be altered
491-
return Arrays.asList(columnReaders);
491+
return List.of(columnReaders);
492492
}
493493
}

parquet-column/src/main/java/org/apache/parquet/schema/LogicalTypeAnnotation.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919
package org.apache.parquet.schema;
2020

21-
import static java.util.Arrays.asList;
2221
import static java.util.Optional.empty;
2322
import static org.apache.parquet.schema.ColumnOrder.ColumnOrderName.TYPE_DEFINED_ORDER;
2423
import static org.apache.parquet.schema.ColumnOrder.ColumnOrderName.UNDEFINED;
@@ -33,8 +32,6 @@
3332
import static org.apache.parquet.schema.PrimitiveStringifier.TIME_STRINGIFIER;
3433
import static org.apache.parquet.schema.PrimitiveStringifier.TIME_UTC_STRINGIFIER;
3534

36-
import java.util.Collections;
37-
import java.util.HashSet;
3835
import java.util.List;
3936
import java.util.Objects;
4037
import java.util.Optional;
@@ -822,8 +819,7 @@ PrimitiveStringifier valueStringifier(PrimitiveType primitiveType) {
822819
}
823820

824821
public static class IntLogicalTypeAnnotation extends LogicalTypeAnnotation {
825-
private static final Set<Integer> VALID_BIT_WIDTH =
826-
Collections.unmodifiableSet(new HashSet<>(asList(8, 16, 32, 64)));
822+
private static final Set<Integer> VALID_BIT_WIDTH = Set.of(8, 16, 32, 64);
827823

828824
private final int bitWidth;
829825
private final boolean isSigned;

parquet-column/src/test/java/org/apache/parquet/column/statistics/TestSizeStatistics.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
*/
1919
package org.apache.parquet.column.statistics;
2020

21-
import java.util.Arrays;
2221
import java.util.Collections;
22+
import java.util.List;
2323
import java.util.Optional;
2424
import org.apache.parquet.io.api.Binary;
2525
import org.apache.parquet.schema.LogicalTypeAnnotation;
@@ -47,8 +47,8 @@ public void testAddBinaryType() {
4747
builder.add(1, 1);
4848
SizeStatistics statistics = builder.build();
4949
Assert.assertEquals(Optional.of(3L), statistics.getUnencodedByteArrayDataBytes());
50-
Assert.assertEquals(Arrays.asList(3L, 3L, 1L), statistics.getRepetitionLevelHistogram());
51-
Assert.assertEquals(Arrays.asList(2L, 2L, 3L), statistics.getDefinitionLevelHistogram());
50+
Assert.assertEquals(List.of(3L, 3L, 1L), statistics.getRepetitionLevelHistogram());
51+
Assert.assertEquals(List.of(2L, 2L, 3L), statistics.getDefinitionLevelHistogram());
5252
}
5353

5454
@Test
@@ -67,7 +67,7 @@ public void testAddNonBinaryType() {
6767
builder.add(1, 0);
6868
SizeStatistics statistics = builder.build();
6969
Assert.assertEquals(Optional.empty(), statistics.getUnencodedByteArrayDataBytes());
70-
Assert.assertEquals(Arrays.asList(2L, 4L), statistics.getRepetitionLevelHistogram());
70+
Assert.assertEquals(List.of(2L, 4L), statistics.getRepetitionLevelHistogram());
7171
Assert.assertEquals(Collections.emptyList(), statistics.getDefinitionLevelHistogram());
7272
}
7373

@@ -89,8 +89,8 @@ public void testMergeStatistics() {
8989
SizeStatistics statistics2 = builder2.build();
9090
statistics1.mergeStatistics(statistics2);
9191
Assert.assertEquals(Optional.of(5L), statistics1.getUnencodedByteArrayDataBytes());
92-
Assert.assertEquals(Arrays.asList(3L, 1L, 1L), statistics1.getRepetitionLevelHistogram());
93-
Assert.assertEquals(Arrays.asList(1L, 3L, 1L), statistics1.getDefinitionLevelHistogram());
92+
Assert.assertEquals(List.of(3L, 1L, 1L), statistics1.getRepetitionLevelHistogram());
93+
Assert.assertEquals(List.of(1L, 3L, 1L), statistics1.getDefinitionLevelHistogram());
9494
}
9595

9696
@Test
@@ -122,8 +122,8 @@ public void testCopyStatistics() {
122122
SizeStatistics statistics = builder.build();
123123
SizeStatistics copy = statistics.copy();
124124
Assert.assertEquals(Optional.of(3L), copy.getUnencodedByteArrayDataBytes());
125-
Assert.assertEquals(Arrays.asList(1L, 1L, 1L), copy.getRepetitionLevelHistogram());
126-
Assert.assertEquals(Arrays.asList(1L, 1L, 1L), copy.getDefinitionLevelHistogram());
125+
Assert.assertEquals(List.of(1L, 1L, 1L), copy.getRepetitionLevelHistogram());
126+
Assert.assertEquals(List.of(1L, 1L, 1L), copy.getDefinitionLevelHistogram());
127127
}
128128

129129
@Test

parquet-column/src/test/java/org/apache/parquet/column/values/bytestreamsplit/ByteStreamSplitValuesReaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private static <Reader extends ValuesReader> Reader makeReader(byte[] input, int
3737
throws Exception {
3838
ByteBuffer buffer = ByteBuffer.wrap(input);
3939
ByteBufferInputStream stream = ByteBufferInputStream.wrap(buffer);
40-
Reader reader = cls.newInstance();
40+
Reader reader = cls.getDeclaredConstructor().newInstance();
4141
reader.initFromPage(length, stream);
4242
return reader;
4343
}

parquet-column/src/test/java/org/apache/parquet/column/values/rle/TestRunLengthBitPackingHybridEncoder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import java.io.ByteArrayInputStream;
2424
import java.util.ArrayList;
25-
import java.util.Arrays;
2625
import java.util.List;
2726
import org.apache.parquet.bytes.BytesUtils;
2827
import org.apache.parquet.bytes.DirectByteBufferAllocator;
@@ -187,7 +186,7 @@ public void testTransitionFromBitPackingToRle() throws Exception {
187186
assertEquals(3, BytesUtils.readUnsignedVarInt(is));
188187

189188
List<Integer> values = unpack(3, 8, is);
190-
assertEquals(Arrays.asList(0, 1, 0, 1, 0, 2, 2, 2), values);
189+
assertEquals(List.of(0, 1, 0, 1, 0, 2, 2, 2), values);
191190

192191
// header = 100 << 1 = 200
193192
assertEquals(200, BytesUtils.readUnsignedVarInt(is));
@@ -212,7 +211,7 @@ public void testPaddingZerosOnUnfinishedBitPackedRuns() throws Exception {
212211

213212
List<Integer> values = unpack(5, 16, is);
214213

215-
assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0), values);
214+
assertEquals(List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0), values);
216215

217216
assertEquals(-1, is.read());
218217
}

parquet-column/src/test/java/org/apache/parquet/filter2/recordlevel/TestValueInspector.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import static org.junit.Assert.assertTrue;
2525
import static org.junit.Assert.fail;
2626

27-
import java.util.Arrays;
2827
import java.util.List;
2928
import org.apache.parquet.filter2.recordlevel.IncrementallyUpdatedFilterPredicate.ValueInspector;
3029
import org.junit.Test;
@@ -83,7 +82,7 @@ public void testLifeCycle() {
8382

8483
@Test
8584
public void testReusable() {
86-
List<Integer> values = Arrays.asList(2, 4, 7, 3, 8, 8, 11, 200);
85+
List<Integer> values = List.of(2, 4, 7, 3, 8, 8, 11, 200);
8786
ValueInspector v = intIsEven();
8887

8988
for (Integer x : values) {

parquet-column/src/test/java/org/apache/parquet/internal/column/columnindex/TestColumnIndexBuilder.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919
package org.apache.parquet.internal.column.columnindex;
2020

21-
import static java.util.Arrays.asList;
2221
import static org.apache.parquet.filter2.predicate.FilterApi.and;
2322
import static org.apache.parquet.filter2.predicate.FilterApi.binaryColumn;
2423
import static org.apache.parquet.filter2.predicate.FilterApi.booleanColumn;
@@ -688,8 +687,8 @@ public void testStaticBuildBinary() {
688687
ColumnIndex columnIndex = ColumnIndexBuilder.build(
689688
Types.required(BINARY).as(UTF8).named("test_binary_utf8"),
690689
BoundaryOrder.ASCENDING,
691-
asList(true, true, false, false, true, false, true, false),
692-
asList(1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l),
690+
List.of(true, true, false, false, true, false, true, false),
691+
List.of(1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l),
693692
toBBList(
694693
null,
695694
null,
@@ -738,7 +737,7 @@ public void testFilterWithoutNullCounts() {
738737
ColumnIndex columnIndex = ColumnIndexBuilder.build(
739738
Types.required(BINARY).as(UTF8).named("test_binary_utf8"),
740739
BoundaryOrder.ASCENDING,
741-
asList(true, true, false, false, true, false, true, false),
740+
List.of(true, true, false, false, true, false, true, false),
742741
null,
743742
toBBList(
744743
null,
@@ -904,8 +903,8 @@ public void testStaticBuildBoolean() {
904903
ColumnIndex columnIndex = ColumnIndexBuilder.build(
905904
Types.required(BOOLEAN).named("test_boolean"),
906905
BoundaryOrder.DESCENDING,
907-
asList(false, true, false, true, false, true),
908-
asList(9l, 8l, 7l, 6l, 5l, 0l),
906+
List.of(false, true, false, true, false, true),
907+
List.of(9l, 8l, 7l, 6l, 5l, 0l),
909908
toBBList(false, null, false, null, true, null),
910909
toBBList(true, null, false, null, true, null));
911910
assertEquals(BoundaryOrder.DESCENDING, columnIndex.getBoundaryOrder());
@@ -1058,8 +1057,8 @@ public void testStaticBuildDouble() {
10581057
ColumnIndex columnIndex = ColumnIndexBuilder.build(
10591058
Types.required(DOUBLE).named("test_double"),
10601059
BoundaryOrder.UNORDERED,
1061-
asList(false, false, false, false, false, false),
1062-
asList(0l, 1l, 2l, 3l, 4l, 5l),
1060+
List.of(false, false, false, false, false, false),
1061+
List.of(0l, 1l, 2l, 3l, 4l, 5l),
10631062
toBBList(-1.0, -2.0, -3.0, -4.0, -5.0, -6.0),
10641063
toBBList(1.0, 2.0, 3.0, 4.0, 5.0, 6.0));
10651064
assertEquals(BoundaryOrder.UNORDERED, columnIndex.getBoundaryOrder());
@@ -1211,8 +1210,8 @@ public void testStaticBuildFloat() {
12111210
ColumnIndex columnIndex = ColumnIndexBuilder.build(
12121211
Types.required(FLOAT).named("test_float"),
12131212
BoundaryOrder.ASCENDING,
1214-
asList(true, true, true, false, false, false),
1215-
asList(9l, 8l, 7l, 6l, 0l, 0l),
1213+
List.of(true, true, true, false, false, false),
1214+
List.of(9l, 8l, 7l, 6l, 0l, 0l),
12161215
toBBList(null, null, null, -3.0f, -2.0f, 0.1f),
12171216
toBBList(null, null, null, -2.0f, 0.0f, 6.0f));
12181217
assertEquals(BoundaryOrder.ASCENDING, columnIndex.getBoundaryOrder());
@@ -1345,8 +1344,8 @@ public void testStaticBuildInt32() {
13451344
ColumnIndex columnIndex = ColumnIndexBuilder.build(
13461345
Types.required(INT32).named("test_int32"),
13471346
BoundaryOrder.DESCENDING,
1348-
asList(false, false, false, true, true, true),
1349-
asList(0l, 10l, 0l, 3l, 5l, 7l),
1347+
List.of(false, false, false, true, true, true),
1348+
List.of(0l, 10l, 0l, 3l, 5l, 7l),
13501349
toBBList(10, 8, 6, null, null, null),
13511350
toBBList(9, 7, 5, null, null, null));
13521351
assertEquals(BoundaryOrder.DESCENDING, columnIndex.getBoundaryOrder());
@@ -1597,8 +1596,8 @@ public void testStaticBuildInt64() {
15971596
ColumnIndex columnIndex = ColumnIndexBuilder.build(
15981597
Types.required(INT64).named("test_int64"),
15991598
BoundaryOrder.UNORDERED,
1600-
asList(true, false, true, false, true, false),
1601-
asList(1l, 2l, 3l, 4l, 5l, 6l),
1599+
List.of(true, false, true, false, true, false),
1600+
List.of(1l, 2l, 3l, 4l, 5l, 6l),
16021601
toBBList(null, 2l, null, 4l, null, 9l),
16031602
toBBList(null, 3l, null, 15l, null, 10l));
16041603
assertEquals(BoundaryOrder.UNORDERED, columnIndex.getBoundaryOrder());

parquet-column/src/test/java/org/apache/parquet/io/ExpectationValidatingConverter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static org.junit.Assert.assertEquals;
2222

2323
import java.util.ArrayDeque;
24-
import java.util.Arrays;
2524
import java.util.Deque;
2625
import java.util.List;
2726
import org.apache.parquet.io.api.Binary;
@@ -48,7 +47,7 @@ public void validate(String got) {
4847
}
4948

5049
public ExpectationValidatingConverter(String[] expectations, MessageType schema) {
51-
this(new ArrayDeque<>(Arrays.asList(expectations)), schema);
50+
this(new ArrayDeque<>(List.of(expectations)), schema);
5251
}
5352

5453
public ExpectationValidatingConverter(Deque<String> expectations, MessageType schema) {

parquet-column/src/test/java/org/apache/parquet/io/TestColumnIO.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public class TestColumnIO {
144144
@Parameterized.Parameters
145145
public static Collection<Object[]> data() throws IOException {
146146
Object[][] data = {{true}, {false}};
147-
return Arrays.asList(data);
147+
return List.of(data);
148148
}
149149

150150
private boolean useDictionary;
@@ -386,7 +386,7 @@ public void testOneOfEach() {
386386
.append("g", new NanoTime(1234, System.currentTimeMillis() * 1000))
387387
.append("h", Binary.fromString("abc"));
388388

389-
testSchema(oneOfEachSchema, Arrays.asList(g1));
389+
testSchema(oneOfEachSchema, List.of(g1));
390390
}
391391

392392
@Test
@@ -398,7 +398,7 @@ public void testRequiredOfRequired() {
398398
Group g1 = gf.newGroup();
399399
g1.addGroup("foo").append("bar", 2l);
400400

401-
testSchema(reqreqSchema, Arrays.asList(g1));
401+
testSchema(reqreqSchema, List.of(g1));
402402
}
403403

404404
@Test

0 commit comments

Comments
 (0)