use of org.apache.parquet.column.values.ValuesReader in project parquet-mr by apache.
the class TestDeltaLengthByteArray method testLengths.
@Test
public void testLengths() throws IOException {
DeltaLengthByteArrayValuesWriter writer = getDeltaLengthByteArrayValuesWriter();
ValuesReader reader = new DeltaBinaryPackingValuesReader();
Utils.writeData(writer, values);
int[] bin = Utils.readInts(reader, writer.getBytes().toInputStream(), values.length);
for (int i = 0; i < bin.length; i++) {
Assert.assertEquals(values[i].length(), bin[i]);
}
}
use of org.apache.parquet.column.values.ValuesReader in project parquet-mr by apache.
the class TestDictionary method testLongDictionaryFallBack.
@Test
public void testLongDictionaryFallBack() throws IOException {
int slabSize = 100;
int maxDictionaryByteSize = 50;
final FallbackValuesWriter<PlainLongDictionaryValuesWriter, PlainValuesWriter> cw = newPlainLongDictionaryValuesWriter(maxDictionaryByteSize, slabSize);
// Fallbacked to Plain encoding, therefore use PlainValuesReader to read it back
ValuesReader reader = new PlainValuesReader.LongPlainValuesReader();
roundTripLong(cw, reader, maxDictionaryByteSize);
// simulate cutting the page
cw.reset();
assertEquals(0, cw.getBufferedSize());
cw.resetDictionary();
roundTripLong(cw, reader, maxDictionaryByteSize);
}
use of org.apache.parquet.column.values.ValuesReader in project parquet-mr by apache.
the class TestDictionary method testDoubleDictionaryFallBack.
@Test
public void testDoubleDictionaryFallBack() throws IOException {
int slabSize = 100;
int maxDictionaryByteSize = 50;
final FallbackValuesWriter<PlainDoubleDictionaryValuesWriter, PlainValuesWriter> cw = newPlainDoubleDictionaryValuesWriter(maxDictionaryByteSize, slabSize);
// Fallbacked to Plain encoding, therefore use PlainValuesReader to read it back
ValuesReader reader = new PlainValuesReader.DoublePlainValuesReader();
roundTripDouble(cw, reader, maxDictionaryByteSize);
// simulate cutting the page
cw.reset();
assertEquals(0, cw.getBufferedSize());
cw.resetDictionary();
roundTripDouble(cw, reader, maxDictionaryByteSize);
}
use of org.apache.parquet.column.values.ValuesReader in project parquet-mr by apache.
the class TestDictionary method testIntDictionaryFallBack.
@Test
public void testIntDictionaryFallBack() throws IOException {
int slabSize = 100;
int maxDictionaryByteSize = 50;
final FallbackValuesWriter<PlainIntegerDictionaryValuesWriter, PlainValuesWriter> cw = newPlainIntegerDictionaryValuesWriter(maxDictionaryByteSize, slabSize);
// Fallbacked to Plain encoding, therefore use PlainValuesReader to read it back
ValuesReader reader = new PlainValuesReader.IntegerPlainValuesReader();
roundTripInt(cw, reader, maxDictionaryByteSize);
// simulate cutting the page
cw.reset();
assertEquals(0, cw.getBufferedSize());
cw.resetDictionary();
roundTripInt(cw, reader, maxDictionaryByteSize);
}
use of org.apache.parquet.column.values.ValuesReader in project parquet-mr by apache.
the class TestDictionary method testFloatDictionaryFallBack.
@Test
public void testFloatDictionaryFallBack() throws IOException {
int slabSize = 100;
int maxDictionaryByteSize = 50;
final FallbackValuesWriter<PlainFloatDictionaryValuesWriter, PlainValuesWriter> cw = newPlainFloatDictionaryValuesWriter(maxDictionaryByteSize, slabSize);
// Fallbacked to Plain encoding, therefore use PlainValuesReader to read it back
ValuesReader reader = new PlainValuesReader.FloatPlainValuesReader();
roundTripFloat(cw, reader, maxDictionaryByteSize);
// simulate cutting the page
cw.reset();
assertEquals(0, cw.getBufferedSize());
cw.resetDictionary();
roundTripFloat(cw, reader, maxDictionaryByteSize);
}
Aggregations