Skip to content
Merged
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
7 changes: 0 additions & 7 deletions presto-parquet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,6 @@
<artifactId>jmh-generator-annprocess</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.parquet.io.api.Binary;
import org.apache.parquet.schema.PrimitiveType;
import org.apache.parquet.schema.Types;
import org.junit.Test;
import org.testng.annotations.Test;

import java.math.BigDecimal;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -60,15 +60,12 @@
import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.FLOAT;
import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.INT32;
import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.INT64;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

// import static org.hamcrest.CoreMatchers.instanceOf;
// import static org.junit.Assert.assertThat;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;

public class TestColumnIndexBuilder
{
Expand Down Expand Up @@ -1464,7 +1461,7 @@ private static void assertCorrectValues(List<ByteBuffer> values, Binary... expec
Binary expectedValue = expectedValues[i];
ByteBuffer value = values.get(i);
if (expectedValue == null) {
assertFalse("The byte buffer should be empty for null pages", value.hasRemaining());
assertFalse(value.hasRemaining(), "The byte buffer should be empty for null pages");
}
else {
assertArrayEquals("Invalid value for page " + i, expectedValue.getBytesUnsafe(), value.array());
Expand All @@ -1479,11 +1476,11 @@ private static void assertCorrectValues(List<ByteBuffer> values, Boolean... expe
Boolean expectedValue = expectedValues[i];
ByteBuffer value = values.get(i);
if (expectedValue == null) {
assertFalse("The byte buffer should be empty for null pages", value.hasRemaining());
assertFalse(value.hasRemaining(), "The byte buffer should be empty for null pages");
}
else {
assertEquals("The byte buffer should be 1 byte long for boolean", 1, value.remaining());
assertEquals("Invalid value for page " + i, expectedValue.booleanValue(), value.get(0) != 0);
assertEquals(1, value.remaining(), "The byte buffer should be 1 byte long for boolean");
assertEquals(expectedValue.booleanValue(), value.get(0) != 0, "Invalid value for page " + i);
}
}
}
Expand All @@ -1495,11 +1492,11 @@ private static void assertCorrectValues(List<ByteBuffer> values, Double... expec
Double expectedValue = expectedValues[i];
ByteBuffer value = values.get(i);
if (expectedValue == null) {
assertFalse("The byte buffer should be empty for null pages", value.hasRemaining());
assertFalse(value.hasRemaining(), "The byte buffer should be empty for null pages");
}
else {
assertEquals("The byte buffer should be 8 bytes long for double", 8, value.remaining());
assertTrue("Invalid value for page " + i, Double.compare(expectedValue.doubleValue(), value.getDouble(0)) == 0);
assertEquals(8, value.remaining(), "The byte buffer should be 8 bytes long for double");
assertTrue(Double.compare(expectedValue.doubleValue(), value.getDouble(0)) == 0, "Invalid value for page " + i);
}
}
}
Expand All @@ -1511,11 +1508,11 @@ private static void assertCorrectValues(List<ByteBuffer> values, Float... expect
Float expectedValue = expectedValues[i];
ByteBuffer value = values.get(i);
if (expectedValue == null) {
assertFalse("The byte buffer should be empty for null pages", value.hasRemaining());
assertFalse(value.hasRemaining(), "The byte buffer should be empty for null pages");
}
else {
assertEquals("The byte buffer should be 4 bytes long for double", 4, value.remaining());
assertTrue("Invalid value for page " + i, Float.compare(expectedValue.floatValue(), value.getFloat(0)) == 0);
assertEquals(4, value.remaining(), "The byte buffer should be 4 bytes long for double");
assertTrue(Float.compare(expectedValue.floatValue(), value.getFloat(0)) == 0, "Invalid value for page " + i);
}
}
}
Expand All @@ -1527,11 +1524,11 @@ private static void assertCorrectValues(List<ByteBuffer> values, Integer... expe
Integer expectedValue = expectedValues[i];
ByteBuffer value = values.get(i);
if (expectedValue == null) {
assertFalse("The byte buffer should be empty for null pages", value.hasRemaining());
assertFalse(value.hasRemaining(), "The byte buffer should be empty for null pages");
}
else {
assertEquals("The byte buffer should be 4 bytes long for int32", 4, value.remaining());
assertEquals("Invalid value for page " + i, expectedValue.intValue(), value.getInt(0));
assertEquals(4, value.remaining(), "The byte buffer should be 4 bytes long for int32");
assertEquals(expectedValue.intValue(), value.getInt(0), "Invalid value for page " + i);
}
}
}
Expand All @@ -1543,11 +1540,11 @@ private static void assertCorrectValues(List<ByteBuffer> values, Long... expecte
Long expectedValue = expectedValues[i];
ByteBuffer value = values.get(i);
if (expectedValue == null) {
assertFalse("The byte buffer should be empty for null pages", value.hasRemaining());
assertFalse(value.hasRemaining(), "The byte buffer should be empty for null pages");
}
else {
assertEquals("The byte buffer should be 8 bytes long for int64", 8, value.remaining());
assertEquals("Invalid value for page " + i, expectedValue.intValue(), value.getLong(0));
assertEquals(8, value.remaining(), "The byte buffer should be 8 bytes long for int64");
assertEquals(expectedValue.intValue(), value.getLong(0), "Invalid value for page " + i);
}
}
}
Expand All @@ -1557,7 +1554,7 @@ private static void assertCorrectNullCounts(ColumnIndex columnIndex, long... exp
List<Long> nullCounts = columnIndex.getNullCounts();
assertEquals(expectedNullCounts.length, nullCounts.size());
for (int i = 0; i < expectedNullCounts.length; ++i) {
assertEquals("Invalid null count at page " + i, expectedNullCounts[i], nullCounts.get(i).longValue());
assertEquals(expectedNullCounts[i], nullCounts.get(i).longValue(), "Invalid null count at page " + i);
}
}

Expand All @@ -1566,7 +1563,7 @@ private static void assertCorrectNullPages(ColumnIndex columnIndex, boolean... e
List<Boolean> nullPages = columnIndex.getNullPages();
assertEquals(expectedNullPages.length, nullPages.size());
for (int i = 0; i < expectedNullPages.length; ++i) {
assertEquals("Invalid null pages at page " + i, expectedNullPages[i], nullPages.get(i).booleanValue());
assertEquals(expectedNullPages[i], nullPages.get(i).booleanValue(), "Invalid null pages at page " + i);
}
}

Expand Down Expand Up @@ -1630,8 +1627,7 @@ static void checkEquals(PrimitiveIterator.OfInt actualIt, int... expectedValues)
IntList actualList = new IntArrayList();
actualIt.forEachRemaining((int value) -> actualList.add(value));
int[] actualValues = actualList.toIntArray();
assertArrayEquals(
"ExpectedValues: " + Arrays.toString(expectedValues) + " ActualValues: " + Arrays.toString(actualValues),
assertArrayEquals("ExpectedValues: " + Arrays.toString(expectedValues) + " ActualValues: " + Arrays.toString(actualValues),
expectedValues, actualValues);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.apache.parquet.internal.filter2.columnindex.ColumnIndexStore;
import org.apache.parquet.internal.filter2.columnindex.RowRanges;
import org.apache.parquet.schema.PrimitiveType;
import org.junit.Test;
import org.testng.annotations.Test;

import java.nio.ByteBuffer;
import java.util.ArrayList;
Expand Down Expand Up @@ -66,7 +66,7 @@
import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.INT32;
import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.INT64;
import static org.apache.parquet.schema.Types.optional;
import static org.junit.Assert.assertArrayEquals;
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;

/**
* Unit tests of {@link ColumnIndexFilter}
Expand Down