public abstract class AbstractBlockEncodingBuffer extends Object implements BlockEncodingBuffer
Modifier and Type | Field and Description |
---|---|
protected int |
batchSize |
protected ArrayAllocator |
bufferAllocator |
protected int |
bufferedPositionCount |
protected Block |
decodedBlock |
protected boolean |
flushed |
static double |
GRACE_FACTOR_FOR_MAX_BUFFER_CAPACITY |
protected boolean |
isNested |
protected int |
positionCount |
protected boolean |
positionsMapped |
protected int |
positionsOffset |
Modifier | Constructor and Description |
---|---|
protected |
AbstractBlockEncodingBuffer(ArrayAllocator bufferAllocator,
boolean isNested) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
accumulateSerializedRowSizes(int[] positionOffsets,
int positionCount,
int[] serializedRowSizes)
Called by accumulateSerializedRowSizes(int[] serializedRowSizes) for composite types to add row sizes for nested blocks.
|
protected void |
appendNulls() |
protected void |
appendPositionRange(int offset,
int length) |
static BlockEncodingBuffer |
createBlockEncodingBuffers(com.facebook.presto.operator.repartition.DecodedBlockNode decodedBlockNode,
ArrayAllocator bufferAllocator,
boolean isNested) |
protected void |
ensurePositionsCapacity(int capacity) |
protected static int |
getEstimatedBufferMaxCapacity(double targetBufferSize,
int unitSize,
int positionSize) |
protected long |
getNullsBufferSerializedSizeInBytes() |
protected int[] |
getPositions() |
protected com.facebook.presto.operator.repartition.DecodedBlockNode |
mapPositionsToNestedBlock(com.facebook.presto.operator.repartition.DecodedBlockNode decodedBlockNode)
Map the positions for DictionaryBlock to its nested dictionaryBlock, and positions for RunLengthEncodedBlock
to its nested value block.
|
void |
noMoreBatches()
Signals that this is the last batch in this page, so that the internal buffers in BlockEncodingBuffers can recycled.
|
protected void |
resetNullsBuffer() |
protected void |
resetPositions() |
protected void |
serializeNullsTo(io.airlift.slice.SliceOutput output) |
protected void |
setEstimatedNullsBufferMaxCapacity(int estimatedNullsBufferMaxCapacity) |
void |
setNextBatch(int positionsOffset,
int batchSize)
Set the position offset and batch size on the positions array in the BlockEncodingBuffer.
|
protected abstract void |
setupDecodedBlockAndMapPositions(com.facebook.presto.operator.repartition.DecodedBlockNode decodedBlockNode,
int partitionBufferCapacity,
double decodedBlockPageSizeFraction) |
void |
setupDecodedBlocksAndPositions(com.facebook.presto.operator.repartition.DecodedBlockNode decodedBlockNode,
int[] positions,
int positionCount,
int partitionBufferCapacity,
long estimatedSerializedPageSize)
Pass in the decoded block and positions in this block to copy.
|
String |
toString() |
protected static void |
writeLengthPrefixedString(io.airlift.slice.SliceOutput output,
String value) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
accumulateSerializedRowSizes, appendDataInBatch, getRetainedSizeInBytes, getSerializedSizeInBytes, resetBuffers, serializeTo
public static final double GRACE_FACTOR_FOR_MAX_BUFFER_CAPACITY
protected final ArrayAllocator bufferAllocator
protected final boolean isNested
protected Block decodedBlock
protected int positionCount
protected int batchSize
protected int positionsOffset
protected int bufferedPositionCount
protected boolean positionsMapped
protected boolean flushed
protected AbstractBlockEncodingBuffer(ArrayAllocator bufferAllocator, boolean isNested)
protected abstract void setupDecodedBlockAndMapPositions(com.facebook.presto.operator.repartition.DecodedBlockNode decodedBlockNode, int partitionBufferCapacity, double decodedBlockPageSizeFraction)
public static BlockEncodingBuffer createBlockEncodingBuffers(com.facebook.presto.operator.repartition.DecodedBlockNode decodedBlockNode, ArrayAllocator bufferAllocator, boolean isNested)
public void setupDecodedBlocksAndPositions(com.facebook.presto.operator.repartition.DecodedBlockNode decodedBlockNode, int[] positions, int positionCount, int partitionBufferCapacity, long estimatedSerializedPageSize)
BlockEncodingBuffer
setupDecodedBlocksAndPositions
in interface BlockEncodingBuffer
public void setNextBatch(int positionsOffset, int batchSize)
BlockEncodingBuffer
setNextBatch
in interface BlockEncodingBuffer
protected void setEstimatedNullsBufferMaxCapacity(int estimatedNullsBufferMaxCapacity)
protected static int getEstimatedBufferMaxCapacity(double targetBufferSize, int unitSize, int positionSize)
protected com.facebook.presto.operator.repartition.DecodedBlockNode mapPositionsToNestedBlock(com.facebook.presto.operator.repartition.DecodedBlockNode decodedBlockNode)
protected void ensurePositionsCapacity(int capacity)
protected void appendPositionRange(int offset, int length)
protected abstract void accumulateSerializedRowSizes(int[] positionOffsets, int positionCount, int[] serializedRowSizes)
For example, a AbstractBlockEncodingBuffer for an array(int) column with 3 rows - [{1, 2}, {3}, {4, 5, 6}] - will call accumulateSerializedRowSizes with positionOffsets = [0, 2, 3, 6] and serializedRowSizes = [5, 5, 5] (5 = 4 + 1 where 4 bytes for offset and 1 for null flag). After the method returns, serializedRowSizes will be [15, 10, 20].
positionOffsets
- The offsets of the top level rowspositionCount
- Number of top level rowsprotected void resetPositions()
protected int[] getPositions()
protected void appendNulls()
public void noMoreBatches()
BlockEncodingBuffer
noMoreBatches
in interface BlockEncodingBuffer
protected void serializeNullsTo(io.airlift.slice.SliceOutput output)
protected static void writeLengthPrefixedString(io.airlift.slice.SliceOutput output, String value)
protected void resetNullsBuffer()
protected long getNullsBufferSerializedSizeInBytes()
Copyright © 2012–2022. All rights reserved.