public MemoryRowBlock(DataType[] dataTypes, int bytes, boolean isDirect, String dataFormat) { this(dataTypes, new ResizableLimitSpec(bytes), isDirect, dataFormat); }
public boolean canIncrease(long currentSize) { return remain(currentSize) > 0; }
public ResizableMemoryBlock(ResizableLimitSpec limitSpec, boolean isDirect) { if (isDirect) { this.buffer = BufferPool.directBuffer((int) limitSpec.initialSize(), (int) limitSpec.limit()); this.memoryAddress = buffer.memoryAddress(); } else { this.buffer = BufferPool.heapBuffer((int) limitSpec.initialSize(), (int) limitSpec.limit()); } this.limitSpec = limitSpec; }
@Override public void ensureSize(int size) { if (!buffer.isWritable(size)) { int newBlockSize = limitSpec.increasedSize(size); if (!limitSpec.canIncrease(buffer.writableBytes() + newBlockSize)) { throw new ValueOutOfRangeException("Cannot increase RowBlock anymore."); } resize(newBlockSize); LOG.info("Increase DirectRowBlock to " + FileUtil.humanReadableByteCount(newBlockSize, false)); } }
private void resize(int newSize) { Preconditions.checkArgument(newSize > 0, "Size must be greater than 0 bytes"); if (newSize > limitSpec.limit()) { throw new ValueOutOfRangeException("Resize cannot exceed the capacity limit"); } if (newSize < buffer.writableBytes()) { LOG.warn("The capacity reduction is ignored."); } int newBlockSize = UnsafeUtil.alignedSize(newSize); buffer = BufferPool.ensureWritable(buffer, newBlockSize); memoryAddress = buffer.memoryAddress(); }
public ResizableMemoryBlock(ResizableLimitSpec limitSpec, boolean isDirect) { if (isDirect) { this.buffer = BufferPool.directBuffer((int) limitSpec.initialSize(), (int) limitSpec.limit()); this.memoryAddress = buffer.memoryAddress(); } else { this.buffer = BufferPool.heapBuffer((int) limitSpec.initialSize(), (int) limitSpec.limit()); } this.limitSpec = limitSpec; }
@Override public void ensureSize(int size) { if (!buffer.isWritable(size)) { int newBlockSize = limitSpec.increasedSize(size); if (!limitSpec.canIncrease(buffer.writableBytes() + newBlockSize)) { throw new ValueOutOfRangeException("Cannot increase RowBlock anymore."); } resize(newBlockSize); LOG.info("Increase DirectRowBlock to " + FileUtil.humanReadableByteCount(newBlockSize, false)); } }
private void resize(int newSize) { Preconditions.checkArgument(newSize > 0, "Size must be greater than 0 bytes"); if (newSize > limitSpec.limit()) { throw new ValueOutOfRangeException("Resize cannot exceed the capacity limit"); } if (newSize < buffer.writableBytes()) { LOG.warn("The capacity reduction is ignored."); } int newBlockSize = UnsafeUtil.alignedSize(newSize); buffer = BufferPool.ensureWritable(buffer, newBlockSize); memoryAddress = buffer.memoryAddress(); }
public MemoryRowBlock(DataType[] dataTypes) { this(dataTypes, new ResizableLimitSpec(64 * StorageUnit.KB), true); }
public boolean canIncrease(long currentSize) { return remain(currentSize) > 0; }
public MemoryRowBlock(DataType[] dataTypes, int bytes) { this(dataTypes, new ResizableLimitSpec(bytes), true); }
public MemoryRowBlock(DataType[] dataTypes, int bytes, boolean isDirect, String dataFormat) { this(dataTypes, new ResizableLimitSpec(bytes), isDirect, dataFormat); }
public MemoryRowBlock(DataType[] dataTypes) { this(dataTypes, new ResizableLimitSpec(64 * StorageUnit.KB), true); }
public MemoryRowBlock(DataType[] dataTypes, int bytes) { this(dataTypes, new ResizableLimitSpec(bytes), true); }
public BaseTupleBuilder(DataType[] schema) { super(schema); this.memoryBlock = new ResizableMemoryBlock(new ResizableLimitSpec(64 * StorageUnit.KB), true); }
public BaseTupleBuilder(DataType[] schema) { super(schema); this.memoryBlock = new ResizableMemoryBlock(new ResizableLimitSpec(64 * StorageUnit.KB), true); }
public ResizableMemoryBlock(ByteBuffer buffer) { this(Unpooled.wrappedBuffer(buffer), new ResizableLimitSpec(buffer.capacity(), buffer.capacity())); }
public ResizableMemoryBlock(ByteBuffer buffer) { this(Unpooled.wrappedBuffer(buffer), new ResizableLimitSpec(buffer.capacity(), buffer.capacity())); }
public ResizableMemoryBlock(ByteBuf buffer) { this(buffer, new ResizableLimitSpec(buffer.capacity())); }
public ResizableMemoryBlock(ByteBuf buffer) { this(buffer, new ResizableLimitSpec(buffer.capacity())); }