Search in sources :

Example 1 with DiskRangeInfo

use of org.apache.hadoop.hive.common.DiskRangeInfo in project hive by apache.

the class StreamUtils method createDiskRangeInfo.

/**
 * Converts stream buffers to disk ranges.
 * @param streamBuffer - stream buffer
 * @return - total length of disk ranges
 */
public static DiskRangeInfo createDiskRangeInfo(ColumnStreamData streamBuffer) {
    DiskRangeInfo diskRangeInfo = new DiskRangeInfo(streamBuffer.getIndexBaseOffset());
    // See ctor comment.
    long offset = streamBuffer.getIndexBaseOffset();
    // TODO: we should get rid of this
    for (MemoryBuffer memoryBuffer : streamBuffer.getCacheBuffers()) {
        ByteBuffer buffer = memoryBuffer.getByteBufferDup();
        diskRangeInfo.addDiskRange(new BufferChunk(buffer, offset));
        offset += buffer.remaining();
    }
    return diskRangeInfo;
}
Also used : MemoryBuffer(org.apache.hadoop.hive.common.io.encoded.MemoryBuffer) DiskRangeInfo(org.apache.hadoop.hive.common.DiskRangeInfo) BufferChunk(org.apache.orc.impl.BufferChunk) ByteBuffer(java.nio.ByteBuffer)

Aggregations

ByteBuffer (java.nio.ByteBuffer)1 DiskRangeInfo (org.apache.hadoop.hive.common.DiskRangeInfo)1 MemoryBuffer (org.apache.hadoop.hive.common.io.encoded.MemoryBuffer)1 BufferChunk (org.apache.orc.impl.BufferChunk)1