use of com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext in project presto by prestodb.
the class TestLongStreamDwrf method createValueStream.
@Override
protected LongInputStreamDwrf createValueStream(Slice slice) throws OrcCorruptionException {
TestingHiveOrcAggregatedMemoryContext aggregatedMemoryContext = new TestingHiveOrcAggregatedMemoryContext();
OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, new SharedBuffer(aggregatedMemoryContext.newOrcLocalMemoryContext("sharedDecompressionBuffer")), slice.getInput(), getOrcDecompressor(), Optional.empty(), aggregatedMemoryContext, slice.getRetainedSize());
return new LongInputStreamDwrf(input, LONG, true, true);
}
use of com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext in project presto by prestodb.
the class TestLongStreamV2 method createValueStream.
@Override
protected LongInputStreamV2 createValueStream(Slice slice) throws OrcCorruptionException {
TestingHiveOrcAggregatedMemoryContext aggregatedMemoryContext = new TestingHiveOrcAggregatedMemoryContext();
OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, new SharedBuffer(aggregatedMemoryContext.newOrcLocalMemoryContext("sharedDecompressionBuffer")), slice.getInput(), getOrcDecompressor(), Optional.empty(), aggregatedMemoryContext, slice.getRetainedSize());
return new LongInputStreamV2(input, true, false);
}
use of com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext in project presto by prestodb.
the class TestShortDecimalStream method createValueStream.
@Override
protected DecimalInputStream createValueStream(Slice slice) throws OrcCorruptionException {
TestingHiveOrcAggregatedMemoryContext aggregatedMemoryContext = new TestingHiveOrcAggregatedMemoryContext();
OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, new SharedBuffer(aggregatedMemoryContext.newOrcLocalMemoryContext("sharedDecompressionBuffer")), slice.getInput(), getOrcDecompressor(), Optional.empty(), aggregatedMemoryContext, slice.getRetainedSize());
return new DecimalInputStream(input);
}
use of com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext in project presto by prestodb.
the class TestLongStreamV1 method createValueStream.
@Override
protected LongInputStreamV1 createValueStream(Slice slice) throws OrcCorruptionException {
TestingHiveOrcAggregatedMemoryContext aggregatedMemoryContext = new TestingHiveOrcAggregatedMemoryContext();
OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, new SharedBuffer(aggregatedMemoryContext.newOrcLocalMemoryContext("sharedDecompressionBuffer")), slice.getInput(), getOrcDecompressor(), Optional.empty(), aggregatedMemoryContext, slice.getRetainedSize());
return new LongInputStreamV1(input, true);
}
use of com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext in project presto by prestodb.
the class TestLongDecode method assertVIntRoundTrip.
private static void assertVIntRoundTrip(SliceOutput output, long value, boolean signed) throws IOException {
// write using Hive's code
output.reset();
if (signed) {
writeVslong(output, value);
} else {
writeVulong(output, value);
}
Slice hiveBytes = Slices.copyOf(output.slice());
// write using Presto's code, and verify they are the same
output.reset();
writeVLong(output, value, signed);
Slice prestoBytes = Slices.copyOf(output.slice());
if (!prestoBytes.equals(hiveBytes)) {
assertEquals(prestoBytes, hiveBytes);
}
// read using Hive's code
if (signed) {
long readValueOld = readVslong(hiveBytes.getInput());
assertEquals(readValueOld, value);
} else {
long readValueOld = readVulong(hiveBytes.getInput());
assertEquals(readValueOld, value);
}
// read using Presto's code
TestingHiveOrcAggregatedMemoryContext aggregatedMemoryContext = new TestingHiveOrcAggregatedMemoryContext();
long readValueNew = readVInt(signed, new OrcInputStream(new OrcDataSourceId("test"), new SharedBuffer(aggregatedMemoryContext.newOrcLocalMemoryContext("sharedDecompressionBuffer")), hiveBytes.getInput(), Optional.empty(), Optional.empty(), aggregatedMemoryContext, hiveBytes.getRetainedSize()));
assertEquals(readValueNew, value);
}
Aggregations