Search in sources :

Example 1 with TestingHiveOrcAggregatedMemoryContext

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);
}
Also used : TestingHiveOrcAggregatedMemoryContext(com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext)

Example 2 with TestingHiveOrcAggregatedMemoryContext

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);
}
Also used : TestingHiveOrcAggregatedMemoryContext(com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext)

Example 3 with TestingHiveOrcAggregatedMemoryContext

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);
}
Also used : TestingHiveOrcAggregatedMemoryContext(com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext)

Example 4 with TestingHiveOrcAggregatedMemoryContext

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);
}
Also used : TestingHiveOrcAggregatedMemoryContext(com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext)

Example 5 with TestingHiveOrcAggregatedMemoryContext

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);
}
Also used : OrcDataSourceId(com.facebook.presto.orc.OrcDataSourceId) Slice(io.airlift.slice.Slice) TestingHiveOrcAggregatedMemoryContext(com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext)

Aggregations

TestingHiveOrcAggregatedMemoryContext (com.facebook.presto.orc.TestingHiveOrcAggregatedMemoryContext)5 OrcDataSourceId (com.facebook.presto.orc.OrcDataSourceId)1 Slice (io.airlift.slice.Slice)1