Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.parquet.filter2.recordlevel;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.apache.parquet.io.api.Binary;

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

DelegatingValueInspector(ValueInspector... delegates) {
this.delegates = Arrays.asList(delegates);
this.delegates = List.of(delegates);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,6 @@ protected Converter getRecordConsumer() {

protected Iterable<ColumnReader> getColumnReaders() {
// Converting the array to an iterable ensures that the array cannot be altered
return Arrays.asList(columnReaders);
return List.of(columnReaders);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.parquet.schema;

import static java.util.Arrays.asList;
import static java.util.Optional.empty;
import static org.apache.parquet.schema.ColumnOrder.ColumnOrderName.TYPE_DEFINED_ORDER;
import static org.apache.parquet.schema.ColumnOrder.ColumnOrderName.UNDEFINED;
Expand All @@ -33,8 +32,6 @@
import static org.apache.parquet.schema.PrimitiveStringifier.TIME_STRINGIFIER;
import static org.apache.parquet.schema.PrimitiveStringifier.TIME_UTC_STRINGIFIER;

import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -822,8 +819,7 @@ PrimitiveStringifier valueStringifier(PrimitiveType primitiveType) {
}

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

private final int bitWidth;
private final boolean isSigned;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
package org.apache.parquet.column.statistics;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.apache.parquet.io.api.Binary;
import org.apache.parquet.schema.LogicalTypeAnnotation;
Expand Down Expand Up @@ -47,8 +47,8 @@ public void testAddBinaryType() {
builder.add(1, 1);
SizeStatistics statistics = builder.build();
Assert.assertEquals(Optional.of(3L), statistics.getUnencodedByteArrayDataBytes());
Assert.assertEquals(Arrays.asList(3L, 3L, 1L), statistics.getRepetitionLevelHistogram());
Assert.assertEquals(Arrays.asList(2L, 2L, 3L), statistics.getDefinitionLevelHistogram());
Assert.assertEquals(List.of(3L, 3L, 1L), statistics.getRepetitionLevelHistogram());
Assert.assertEquals(List.of(2L, 2L, 3L), statistics.getDefinitionLevelHistogram());
}

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

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

@Test
Expand Down Expand Up @@ -122,8 +122,8 @@ public void testCopyStatistics() {
SizeStatistics statistics = builder.build();
SizeStatistics copy = statistics.copy();
Assert.assertEquals(Optional.of(3L), copy.getUnencodedByteArrayDataBytes());
Assert.assertEquals(Arrays.asList(1L, 1L, 1L), copy.getRepetitionLevelHistogram());
Assert.assertEquals(Arrays.asList(1L, 1L, 1L), copy.getDefinitionLevelHistogram());
Assert.assertEquals(List.of(1L, 1L, 1L), copy.getRepetitionLevelHistogram());
Assert.assertEquals(List.of(1L, 1L, 1L), copy.getDefinitionLevelHistogram());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private static <Reader extends ValuesReader> Reader makeReader(byte[] input, int
throws Exception {
ByteBuffer buffer = ByteBuffer.wrap(input);
ByteBufferInputStream stream = ByteBufferInputStream.wrap(buffer);
Reader reader = cls.newInstance();
Reader reader = cls.getDeclaredConstructor().newInstance();
reader.initFromPage(length, stream);
return reader;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.parquet.bytes.BytesUtils;
import org.apache.parquet.bytes.DirectByteBufferAllocator;
Expand Down Expand Up @@ -187,7 +186,7 @@ public void testTransitionFromBitPackingToRle() throws Exception {
assertEquals(3, BytesUtils.readUnsignedVarInt(is));

List<Integer> values = unpack(3, 8, is);
assertEquals(Arrays.asList(0, 1, 0, 1, 0, 2, 2, 2), values);
assertEquals(List.of(0, 1, 0, 1, 0, 2, 2, 2), values);

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

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

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

assertEquals(-1, is.read());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.Arrays;
import java.util.List;
import org.apache.parquet.filter2.recordlevel.IncrementallyUpdatedFilterPredicate.ValueInspector;
import org.junit.Test;
Expand Down Expand Up @@ -83,7 +82,7 @@ public void testLifeCycle() {

@Test
public void testReusable() {
List<Integer> values = Arrays.asList(2, 4, 7, 3, 8, 8, 11, 200);
List<Integer> values = List.of(2, 4, 7, 3, 8, 8, 11, 200);
ValueInspector v = intIsEven();

for (Integer x : values) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.parquet.internal.column.columnindex;

import static java.util.Arrays.asList;
import static org.apache.parquet.filter2.predicate.FilterApi.and;
import static org.apache.parquet.filter2.predicate.FilterApi.binaryColumn;
import static org.apache.parquet.filter2.predicate.FilterApi.booleanColumn;
Expand Down Expand Up @@ -688,8 +687,8 @@ public void testStaticBuildBinary() {
ColumnIndex columnIndex = ColumnIndexBuilder.build(
Types.required(BINARY).as(UTF8).named("test_binary_utf8"),
BoundaryOrder.ASCENDING,
asList(true, true, false, false, true, false, true, false),
asList(1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l),
List.of(true, true, false, false, true, false, true, false),
List.of(1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l),
toBBList(
null,
null,
Expand Down Expand Up @@ -738,7 +737,7 @@ public void testFilterWithoutNullCounts() {
ColumnIndex columnIndex = ColumnIndexBuilder.build(
Types.required(BINARY).as(UTF8).named("test_binary_utf8"),
BoundaryOrder.ASCENDING,
asList(true, true, false, false, true, false, true, false),
List.of(true, true, false, false, true, false, true, false),
null,
toBBList(
null,
Expand Down Expand Up @@ -904,8 +903,8 @@ public void testStaticBuildBoolean() {
ColumnIndex columnIndex = ColumnIndexBuilder.build(
Types.required(BOOLEAN).named("test_boolean"),
BoundaryOrder.DESCENDING,
asList(false, true, false, true, false, true),
asList(9l, 8l, 7l, 6l, 5l, 0l),
List.of(false, true, false, true, false, true),
List.of(9l, 8l, 7l, 6l, 5l, 0l),
toBBList(false, null, false, null, true, null),
toBBList(true, null, false, null, true, null));
assertEquals(BoundaryOrder.DESCENDING, columnIndex.getBoundaryOrder());
Expand Down Expand Up @@ -1058,8 +1057,8 @@ public void testStaticBuildDouble() {
ColumnIndex columnIndex = ColumnIndexBuilder.build(
Types.required(DOUBLE).named("test_double"),
BoundaryOrder.UNORDERED,
asList(false, false, false, false, false, false),
asList(0l, 1l, 2l, 3l, 4l, 5l),
List.of(false, false, false, false, false, false),
List.of(0l, 1l, 2l, 3l, 4l, 5l),
toBBList(-1.0, -2.0, -3.0, -4.0, -5.0, -6.0),
toBBList(1.0, 2.0, 3.0, 4.0, 5.0, 6.0));
assertEquals(BoundaryOrder.UNORDERED, columnIndex.getBoundaryOrder());
Expand Down Expand Up @@ -1211,8 +1210,8 @@ public void testStaticBuildFloat() {
ColumnIndex columnIndex = ColumnIndexBuilder.build(
Types.required(FLOAT).named("test_float"),
BoundaryOrder.ASCENDING,
asList(true, true, true, false, false, false),
asList(9l, 8l, 7l, 6l, 0l, 0l),
List.of(true, true, true, false, false, false),
List.of(9l, 8l, 7l, 6l, 0l, 0l),
toBBList(null, null, null, -3.0f, -2.0f, 0.1f),
toBBList(null, null, null, -2.0f, 0.0f, 6.0f));
assertEquals(BoundaryOrder.ASCENDING, columnIndex.getBoundaryOrder());
Expand Down Expand Up @@ -1345,8 +1344,8 @@ public void testStaticBuildInt32() {
ColumnIndex columnIndex = ColumnIndexBuilder.build(
Types.required(INT32).named("test_int32"),
BoundaryOrder.DESCENDING,
asList(false, false, false, true, true, true),
asList(0l, 10l, 0l, 3l, 5l, 7l),
List.of(false, false, false, true, true, true),
List.of(0l, 10l, 0l, 3l, 5l, 7l),
toBBList(10, 8, 6, null, null, null),
toBBList(9, 7, 5, null, null, null));
assertEquals(BoundaryOrder.DESCENDING, columnIndex.getBoundaryOrder());
Expand Down Expand Up @@ -1597,8 +1596,8 @@ public void testStaticBuildInt64() {
ColumnIndex columnIndex = ColumnIndexBuilder.build(
Types.required(INT64).named("test_int64"),
BoundaryOrder.UNORDERED,
asList(true, false, true, false, true, false),
asList(1l, 2l, 3l, 4l, 5l, 6l),
List.of(true, false, true, false, true, false),
List.of(1l, 2l, 3l, 4l, 5l, 6l),
toBBList(null, 2l, null, 4l, null, 9l),
toBBList(null, 3l, null, 15l, null, 10l));
assertEquals(BoundaryOrder.UNORDERED, columnIndex.getBoundaryOrder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static org.junit.Assert.assertEquals;

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import org.apache.parquet.io.api.Binary;
Expand All @@ -48,7 +47,7 @@ public void validate(String got) {
}

public ExpectationValidatingConverter(String[] expectations, MessageType schema) {
this(new ArrayDeque<>(Arrays.asList(expectations)), schema);
this(new ArrayDeque<>(List.of(expectations)), schema);
}

public ExpectationValidatingConverter(Deque<String> expectations, MessageType schema) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public class TestColumnIO {
@Parameterized.Parameters
public static Collection<Object[]> data() throws IOException {
Object[][] data = {{true}, {false}};
return Arrays.asList(data);
return List.of(data);
}

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

testSchema(oneOfEachSchema, Arrays.asList(g1));
testSchema(oneOfEachSchema, List.of(g1));
}

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

testSchema(reqreqSchema, Arrays.asList(g1));
testSchema(reqreqSchema, List.of(g1));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.apache.parquet.schema;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Arrays.asList;
import static java.util.concurrent.TimeUnit.HOURS;
import static java.util.concurrent.TimeUnit.MICROSECONDS;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
Expand Down Expand Up @@ -48,6 +47,7 @@
import java.nio.ByteBuffer;
import java.util.Calendar;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -175,7 +175,7 @@ public void testDateStringifier() {
@Test
public void testTimestampMillisStringifier() {
for (PrimitiveStringifier stringifier :
asList(TIMESTAMP_MILLIS_STRINGIFIER, TIMESTAMP_MILLIS_UTC_STRINGIFIER)) {
List.of(TIMESTAMP_MILLIS_STRINGIFIER, TIMESTAMP_MILLIS_UTC_STRINGIFIER)) {
String timezoneAmendment = (stringifier == TIMESTAMP_MILLIS_STRINGIFIER ? "" : "+0000");

assertEquals(withZoneString("1970-01-01T00:00:00.000", timezoneAmendment), stringifier.stringify(0l));
Expand All @@ -202,7 +202,7 @@ public void testTimestampMillisStringifier() {
@Test
public void testTimestampMicrosStringifier() {
for (PrimitiveStringifier stringifier :
asList(TIMESTAMP_MICROS_STRINGIFIER, TIMESTAMP_MICROS_UTC_STRINGIFIER)) {
List.of(TIMESTAMP_MICROS_STRINGIFIER, TIMESTAMP_MICROS_UTC_STRINGIFIER)) {
String timezoneAmendment = (stringifier == TIMESTAMP_MICROS_STRINGIFIER ? "" : "+0000");

assertEquals(withZoneString("1970-01-01T00:00:00.000000", timezoneAmendment), stringifier.stringify(0l));
Expand All @@ -228,7 +228,7 @@ public void testTimestampMicrosStringifier() {

@Test
public void testTimestampNanosStringifier() {
for (PrimitiveStringifier stringifier : asList(TIMESTAMP_NANOS_STRINGIFIER, TIMESTAMP_NANOS_UTC_STRINGIFIER)) {
for (PrimitiveStringifier stringifier : List.of(TIMESTAMP_NANOS_STRINGIFIER, TIMESTAMP_NANOS_UTC_STRINGIFIER)) {
String timezoneAmendment = (stringifier == TIMESTAMP_NANOS_STRINGIFIER ? "" : "+0000");

assertEquals(withZoneString("1970-01-01T00:00:00.000000000", timezoneAmendment), stringifier.stringify(0l));
Expand All @@ -254,7 +254,7 @@ public void testTimestampNanosStringifier() {

@Test
public void testTimeStringifier() {
for (PrimitiveStringifier stringifier : asList(TIME_STRINGIFIER, TIME_UTC_STRINGIFIER)) {
for (PrimitiveStringifier stringifier : List.of(TIME_STRINGIFIER, TIME_UTC_STRINGIFIER)) {
String timezoneAmendment = (stringifier == TIME_STRINGIFIER ? "" : "+0000");

assertEquals(withZoneString("00:00:00.000", timezoneAmendment), stringifier.stringify(0));
Expand Down Expand Up @@ -290,7 +290,7 @@ public void testTimeStringifier() {

@Test
public void testTimeNanoStringifier() {
for (PrimitiveStringifier stringifier : asList(TIME_NANOS_STRINGIFIER, TIME_NANOS_UTC_STRINGIFIER)) {
for (PrimitiveStringifier stringifier : List.of(TIME_NANOS_STRINGIFIER, TIME_NANOS_UTC_STRINGIFIER)) {
String timezoneAmendment = (stringifier == TIME_NANOS_STRINGIFIER ? "" : "+0000");

assertEquals(withZoneString("00:00:00.000000000", timezoneAmendment), stringifier.stringify(0l));
Expand Down Expand Up @@ -434,7 +434,7 @@ private Binary toBinary(int... bytes) {
}

private void checkThrowingUnsupportedException(PrimitiveStringifier stringifier, Class<?>... excludes) {
Set<Class<?>> set = new HashSet<>(asList(excludes));
Set<Class<?>> set = new HashSet<>(List.of(excludes));
if (!set.contains(Integer.TYPE)) {
try {
stringifier.stringify(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.Arrays;
import java.util.List;
import org.junit.Test;

Expand Down Expand Up @@ -51,7 +50,7 @@ public void testCompare() {

@Test
public void testSemverPrereleaseExamples() throws Exception {
List<String> examples = Arrays.asList(
List<String> examples = List.of(
"1.0.0-alpha",
"1.0.0-alpha.1",
"1.0.0-alpha.beta",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand Down Expand Up @@ -54,7 +54,7 @@ public void test() throws IOException {
ConcatenatingByteBufferCollector inner = new ConcatenatingByteBufferCollector(allocator)) {
outer.collect(BytesInput.concat(
BytesInput.from(byteBuffer("This"), byteBuffer(" "), byteBuffer("is")),
BytesInput.from(Arrays.asList(byteBuffer(" a"), byteBuffer(" "), byteBuffer("test"))),
BytesInput.from(List.of(byteBuffer(" a"), byteBuffer(" "), byteBuffer("test"))),
BytesInput.from(inputStream(" text to blabla"), 8),
BytesInput.from(bytes(" ")),
BytesInput.from(bytes("blabla validate blabla"), 7, 9),
Expand Down
Loading