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;
}
Aggregations