Skip to content
Closed
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
4 changes: 4 additions & 0 deletions java/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
<property name="format" value="Collections\.emptySet"/>
<property name="message" value="Use Set.of() instead." />
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="com\.google\.common\.collect\.Lists"/>
<property name="message" value="Use Java API instead." />
</module>
<module name="Indentation">
<property name="severity" value="error"/>
<property name="basicOffset" value="2"/>
Expand Down
64 changes: 32 additions & 32 deletions java/core/src/test/org/apache/orc/TestNewIntegerEncoding.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package org.apache.orc;

import com.google.common.collect.Lists;
import com.google.common.primitives.Longs;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
Expand All @@ -33,6 +32,7 @@

import java.io.File;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.Stream;
Expand Down Expand Up @@ -121,7 +121,7 @@ public void testBasicOld(OrcFile.EncodingStrategy encodingStrategy) throws Excep
2, 5, 1, 3, 7, 1, 9, 2, 6, 3, 7, 1, 9, 2, 6, 3, 7, 1, 9, 2, 6, 3, 7, 1,
9, 2, 6, 3, 7, 1, 9, 2, 6, 2000, 2, 1, 1, 1, 1, 1, 3, 7, 1, 9, 2, 6, 1,
1, 1, 1, 1 };
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));
Writer writer = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf)
.setSchema(schema)
Expand Down Expand Up @@ -159,7 +159,7 @@ public void testBasicNew(OrcFile.EncodingStrategy encodingStrategy) throws Excep
2, 5, 1, 3, 7, 1, 9, 2, 6, 3, 7, 1, 9, 2, 6, 3, 7, 1, 9, 2, 6, 3, 7, 1,
9, 2, 6, 3, 7, 1, 9, 2, 6, 2000, 2, 1, 1, 1, 1, 1, 3, 7, 1, 9, 2, 6, 1,
1, 1, 1, 1 };
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf)
Expand Down Expand Up @@ -194,7 +194,7 @@ public void testBasicDelta1(OrcFile.EncodingStrategy encodingStrategy) throws Ex
TypeDescription schema = TypeDescription.createLong();

long[] inp = new long[] { -500, -400, -350, -325, -310 };
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf)
Expand Down Expand Up @@ -229,7 +229,7 @@ public void testBasicDelta2(OrcFile.EncodingStrategy encodingStrategy) throws Ex
TypeDescription schema = TypeDescription.createLong();

long[] inp = new long[] { -500, -600, -650, -675, -710 };
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf)
Expand Down Expand Up @@ -264,7 +264,7 @@ public void testBasicDelta3(OrcFile.EncodingStrategy encodingStrategy) throws Ex
TypeDescription schema = TypeDescription.createLong();

long[] inp = new long[] { 500, 400, 350, 325, 310 };
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf)
Expand Down Expand Up @@ -299,7 +299,7 @@ public void testBasicDelta4(OrcFile.EncodingStrategy encodingStrategy) throws Ex
TypeDescription schema = TypeDescription.createLong();

long[] inp = new long[] { 500, 600, 650, 675, 710 };
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf)
Expand Down Expand Up @@ -335,7 +335,7 @@ public void testDeltaOverflow() throws Exception {
long[] inp = new long[]{4513343538618202719L, 4513343538618202711L,
2911390882471569739L,
-9181829309989854913L};
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(
testFilePath,
Expand Down Expand Up @@ -368,7 +368,7 @@ public void testDeltaOverflow2() throws Exception {
long[] inp = new long[]{Long.MAX_VALUE, 4513343538618202711L,
2911390882471569739L,
Long.MIN_VALUE};
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(
testFilePath,
Expand Down Expand Up @@ -400,7 +400,7 @@ public void testDeltaOverflow3() throws Exception {

long[] inp = new long[]{-4513343538618202711L, -2911390882471569739L, -2,
Long.MAX_VALUE};
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(
testFilePath,
Expand Down Expand Up @@ -431,7 +431,7 @@ public void testDeltaOverflow3() throws Exception {
public void testIntegerMin(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
input.add((long) Integer.MIN_VALUE);

Writer writer = OrcFile.createWriter(testFilePath,
Expand Down Expand Up @@ -465,7 +465,7 @@ public void testIntegerMin(OrcFile.EncodingStrategy encodingStrategy) throws Exc
public void testIntegerMax(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
input.add((long) Integer.MAX_VALUE);

Writer writer = OrcFile.createWriter(testFilePath,
Expand Down Expand Up @@ -500,7 +500,7 @@ public void testIntegerMax(OrcFile.EncodingStrategy encodingStrategy) throws Exc
public void testLongMin(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
input.add(Long.MIN_VALUE);

Writer writer = OrcFile.createWriter(testFilePath,
Expand Down Expand Up @@ -535,7 +535,7 @@ public void testLongMin(OrcFile.EncodingStrategy encodingStrategy) throws Except
public void testLongMax(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
input.add(Long.MAX_VALUE);

Writer writer = OrcFile.createWriter(testFilePath,
Expand Down Expand Up @@ -570,7 +570,7 @@ public void testLongMax(OrcFile.EncodingStrategy encodingStrategy) throws Except
public void testRandomInt(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for(int i = 0; i < 100000; i++) {
input.add((long) rand.nextInt());
Expand Down Expand Up @@ -608,7 +608,7 @@ public void testRandomInt(OrcFile.EncodingStrategy encodingStrategy) throws Exce
public void testRandomLong(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for(int i = 0; i < 100000; i++) {
input.add(rand.nextLong());
Expand Down Expand Up @@ -658,7 +658,7 @@ public void testPatchedBaseNegativeMin(OrcFile.EncodingStrategy encodingStrategy
2, 2, 1, 1, 8, 1, 1, 2, 1, 5, 9, 2, 3, 112, 13, 2, 2, 1, 5, 10, 3, 1,
1, 13, 2, 3, 4, 1, 3, 1, 1, 2, 1, 1, 2, 4, 2, 207, 1, 1, 2, 4, 3, 3, 2,
2, 16 };
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf)
Expand Down Expand Up @@ -704,7 +704,7 @@ public void testPatchedBaseNegativeMin2(OrcFile.EncodingStrategy encodingStrateg
2, 2, 1, 1, 8, 1, 1, 2, 1, 5, 9, 2, 3, 112, 13, 2, 2, 1, 5, 10, 3, 1,
1, 13, 2, 3, 4, 1, 3, 1, 1, 2, 1, 1, 2, 4, 2, 207, 1, 1, 2, 4, 3, 3, 2,
2, 16 };
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf)
Expand Down Expand Up @@ -750,7 +750,7 @@ public void testPatchedBaseNegativeMin3(OrcFile.EncodingStrategy encodingStrateg
2, 2, 1, 1, 8, 1, 1, 2, 1, 5, 9, 2, 3, 112, 13, 2, 2, 1, 5, 10, 3, 1,
1, 13, 2, 3, 4, 1, 3, 1, 1, 2, 1, 1, 2, 4, 2, 207, 1, 1, 2, 4, 3, 3, 2,
2, 16 };
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf)
Expand Down Expand Up @@ -787,7 +787,7 @@ public void testPatchedBaseNegativeMin4(OrcFile.EncodingStrategy encodingStrateg
long[] inp = new long[] { 13, 13, 11, 8, 13, 10, 10, 11, 11, 14, 11, 7, 13,
12, 12, 11, 15, 12, 12, 9, 8, 10, 13, 11, 8, 6, 5, 6, 11, 7, 15, 10, 7,
6, 8, 7, 9, 9, 11, 33, 11, 3, 7, 4, 6, 10, 14, 12, 5, 14, 7, 6 };
List<Long> input = Lists.newArrayList(Longs.asList(inp));
List<Long> input = new ArrayList<>(Longs.asList(inp));

Writer writer = OrcFile.createWriter(testFilePath,
OrcFile.writerOptions(conf)
Expand Down Expand Up @@ -821,7 +821,7 @@ public void testPatchedBaseNegativeMin4(OrcFile.EncodingStrategy encodingStrateg
public void testPatchedBaseAt0(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for(int i = 0; i < 5120; i++) {
input.add((long) rand.nextInt(100));
Expand Down Expand Up @@ -860,7 +860,7 @@ public void testPatchedBaseAt0(OrcFile.EncodingStrategy encodingStrategy) throws
public void testPatchedBaseAt1(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for(int i = 0; i < 5120; i++) {
input.add((long) rand.nextInt(100));
Expand Down Expand Up @@ -898,7 +898,7 @@ public void testPatchedBaseAt1(OrcFile.EncodingStrategy encodingStrategy) throws
public void testPatchedBaseAt255(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for(int i = 0; i < 5120; i++) {
input.add((long) rand.nextInt(100));
Expand Down Expand Up @@ -936,7 +936,7 @@ public void testPatchedBaseAt255(OrcFile.EncodingStrategy encodingStrategy) thro
public void testPatchedBaseAt256(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for(int i = 0; i < 5120; i++) {
input.add((long) rand.nextInt(100));
Expand Down Expand Up @@ -974,7 +974,7 @@ public void testPatchedBaseAt256(OrcFile.EncodingStrategy encodingStrategy) thro
public void testPatchedBase510(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for(int i = 0; i < 5120; i++) {
input.add((long) rand.nextInt(100));
Expand Down Expand Up @@ -1012,7 +1012,7 @@ public void testPatchedBase510(OrcFile.EncodingStrategy encodingStrategy) throws
public void testPatchedBase511(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for(int i = 0; i < 5120; i++) {
input.add((long) rand.nextInt(100));
Expand Down Expand Up @@ -1050,7 +1050,7 @@ public void testPatchedBase511(OrcFile.EncodingStrategy encodingStrategy) throws
public void testPatchedBaseMax1(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for (int i = 0; i < 5120; i++) {
input.add((long) rand.nextInt(60));
Expand Down Expand Up @@ -1088,7 +1088,7 @@ public void testPatchedBaseMax1(OrcFile.EncodingStrategy encodingStrategy) throw
public void testPatchedBaseMax2(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for (int i = 0; i < 5120; i++) {
input.add((long) rand.nextInt(60));
Expand Down Expand Up @@ -1128,7 +1128,7 @@ public void testPatchedBaseMax2(OrcFile.EncodingStrategy encodingStrategy) throw
public void testPatchedBaseMax3(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
input.add(371946367L);
input.add(11963367L);
input.add(68639400007L);
Expand Down Expand Up @@ -1180,7 +1180,7 @@ public void testPatchedBaseMax3(OrcFile.EncodingStrategy encodingStrategy) throw
public void testPatchedBaseMax4(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
for (int i = 0; i < 25; i++) {
input.add(371292224226367L);
input.add(119622332222267L);
Expand Down Expand Up @@ -1245,7 +1245,7 @@ public void testPatchedBaseTimestamp(OrcFile.EncodingStrategy encodingStrategy)
.encodingStrategy(encodingStrategy));
VectorizedRowBatch batch = schema.createRowBatch();

List<Timestamp> tslist = Lists.newArrayList();
List<Timestamp> tslist = new ArrayList<>();
tslist.add(Timestamp.valueOf("2099-01-01 00:00:00"));
tslist.add(Timestamp.valueOf("2003-01-01 00:00:00"));
tslist.add(Timestamp.valueOf("1999-01-01 00:00:00"));
Expand Down Expand Up @@ -1346,7 +1346,7 @@ public void testDirectLargeNegatives(OrcFile.EncodingStrategy encodingStrategy)
public void testSeek(OrcFile.EncodingStrategy encodingStrategy) throws Exception {
TypeDescription schema = TypeDescription.createLong();

List<Long> input = Lists.newArrayList();
List<Long> input = new ArrayList<>();
Random rand = new Random();
for(int i = 0; i < 100000; i++) {
input.add((long) rand.nextInt());
Expand Down
14 changes: 7 additions & 7 deletions java/core/src/test/org/apache/orc/TestOrcNullOptimization.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package org.apache.orc;

import com.google.common.collect.Lists;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
Expand All @@ -33,6 +32,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

Expand Down Expand Up @@ -158,15 +158,15 @@ public void testMultiStripeWithNull() throws Exception {

RecordReader rows = reader.rows();

List<Boolean> expected = Lists.newArrayList();
List<Boolean> expected = new ArrayList<>();
for (StripeInformation sinfo : reader.getStripes()) {
expected.add(false);
}
// only the first and last stripe will have PRESENT stream
expected.set(0, true);
expected.set(expected.size() - 1, true);

List<Boolean> got = Lists.newArrayList();
List<Boolean> got = new ArrayList<>();
// check if the strip footer contains PRESENT stream
for (StripeInformation sinfo : reader.getStripes()) {
OrcProto.StripeFooter sf = ((RecordReaderImpl) rows).readStripeFooter(sinfo);
Expand Down Expand Up @@ -273,12 +273,12 @@ public void testMultiStripeWithoutNull() throws Exception {
RecordReader rows = reader.rows();

// none of the stripes will have PRESENT stream
List<Boolean> expected = Lists.newArrayList();
List<Boolean> expected = new ArrayList<>();
for (StripeInformation sinfo : reader.getStripes()) {
expected.add(false);
}

List<Boolean> got = Lists.newArrayList();
List<Boolean> got = new ArrayList<>();
// check if the strip footer contains PRESENT stream
for (StripeInformation sinfo : reader.getStripes()) {
OrcProto.StripeFooter sf = ((RecordReaderImpl) rows).readStripeFooter(sinfo);
Expand Down Expand Up @@ -372,13 +372,13 @@ public void testColumnsWithNullAndCompression() throws Exception {

RecordReader rows = reader.rows();
// only the last strip will have PRESENT stream
List<Boolean> expected = Lists.newArrayList();
List<Boolean> expected = new ArrayList<>();
for (StripeInformation sinfo : reader.getStripes()) {
expected.add(false);
}
expected.set(expected.size() - 1, true);

List<Boolean> got = Lists.newArrayList();
List<Boolean> got = new ArrayList<>();
// check if the strip footer contains PRESENT stream
for (StripeInformation sinfo : reader.getStripes()) {
OrcProto.StripeFooter sf = ((RecordReaderImpl) rows).readStripeFooter(sinfo);
Expand Down
Loading
Loading