public class FixedWidthBlockBuilder extends AbstractFixedWidthBlock implements BlockBuilder
fixedSize
Constructor and Description |
---|
FixedWidthBlockBuilder(int fixedSize,
BlockBuilderStatus blockBuilderStatus,
int expectedEntries) |
FixedWidthBlockBuilder(int fixedSize,
int positionCount) |
Modifier and Type | Method and Description |
---|---|
BlockBuilder |
appendNull()
Appends a null value to the block.
|
Block |
build()
Builds the block.
|
BlockBuilder |
closeEntry()
Write a byte to the current entry;
|
Block |
copyPositions(List<Integer> positions)
Returns a block containing the specified positions.
|
Block |
copyRegion(int positionOffset,
int length)
Returns a block starting at the specified position and extends for the
specified length.
|
int |
getPositionCount()
Returns the number of positions in this block.
|
protected io.airlift.slice.Slice |
getRawSlice() |
Block |
getRegion(int positionOffset,
int length)
Returns a block starting at the specified position and extends for the
specified length.
|
long |
getRetainedSizeInBytes()
Returns the retained size of this block in memory.
|
long |
getSizeInBytes()
Returns the logical size of this block in memory.
|
protected boolean |
isEntryNull(int position) |
BlockBuilder |
newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus)
Creates a new block builder of the same type based on the current usage statistics of this block builder.
|
void |
retainedBytesForEachPart(java.util.function.BiConsumer<Object,Long> consumer)
consumer visits each of the internal data container and accepts the size for it. |
String |
toString() |
BlockBuilder |
writeByte(int value)
Write a byte to the current entry;
|
BlockBuilder |
writeBytes(io.airlift.slice.Slice source,
int sourceIndex,
int length)
Write a byte sequences to the current entry;
|
BlockBuilder |
writeInt(int value)
Write a int to the current entry;
|
BlockBuilder |
writeLong(long value)
Write a long to the current entry;
|
BlockBuilder |
writeShort(int value)
Write a short to the current entry;
|
bytesCompare, bytesEqual, checkReadablePosition, compareTo, equals, getByte, getEncoding, getFixedSize, getInt, getLong, getRegionSizeInBytes, getShort, getSingleValueBlock, getSlice, getSliceLength, hash, isNull, writeBytesTo, writePositionTo
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
beginBlockEntry, writeObject
assureLoaded, bytesCompare, bytesEqual, compareTo, equals, getByte, getEncoding, getInt, getLong, getObject, getRegionSizeInBytes, getShort, getSingleValueBlock, getSlice, getSliceLength, hash, isNull, writeBytesTo, writePositionTo
public FixedWidthBlockBuilder(int fixedSize, @Nullable BlockBuilderStatus blockBuilderStatus, int expectedEntries)
public FixedWidthBlockBuilder(int fixedSize, int positionCount)
protected io.airlift.slice.Slice getRawSlice()
getRawSlice
in class AbstractFixedWidthBlock
public int getPositionCount()
Block
getPositionCount
in interface Block
public long getSizeInBytes()
Block
getSizeInBytes
in interface Block
public long getRetainedSizeInBytes()
Block
getRetainedSizeInBytes
in interface Block
public void retainedBytesForEachPart(java.util.function.BiConsumer<Object,Long> consumer)
Block
consumer
visits each of the internal data container and accepts the size for it.
This method can be helpful in cases such as memory counting for internal data structure.
Also, the method should be non-recursive, only visit the elements at the top level,
and specifically should not call retainedBytesForEachPart on nested blocks
consumer
should be called at least once with the current block and
must include the instance size of the current blockretainedBytesForEachPart
in interface Block
public Block copyPositions(List<Integer> positions)
Block
The returned block must be a compact representation of the original block.
copyPositions
in interface Block
public BlockBuilder writeByte(int value)
BlockBuilder
writeByte
in interface BlockBuilder
public BlockBuilder writeShort(int value)
BlockBuilder
writeShort
in interface BlockBuilder
public BlockBuilder writeInt(int value)
BlockBuilder
writeInt
in interface BlockBuilder
public BlockBuilder writeLong(long value)
BlockBuilder
writeLong
in interface BlockBuilder
public BlockBuilder writeBytes(io.airlift.slice.Slice source, int sourceIndex, int length)
BlockBuilder
writeBytes
in interface BlockBuilder
public BlockBuilder closeEntry()
BlockBuilder
closeEntry
in interface BlockBuilder
public BlockBuilder appendNull()
BlockBuilder
appendNull
in interface BlockBuilder
protected boolean isEntryNull(int position)
isEntryNull
in class AbstractFixedWidthBlock
public Block getRegion(int positionOffset, int length)
Block
The region can be a view over this block. If this block is released the region block may also be released. If the region block is released this block may also be released.
public Block copyRegion(int positionOffset, int length)
Block
The region returned must be a compact representation of the original block, unless their internal representation will be exactly the same. This method is useful for operators that hold on to a range of values without holding on to the entire block.
copyRegion
in interface Block
public Block build()
BlockBuilder
build
in interface BlockBuilder
public BlockBuilder newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus)
BlockBuilder
newBlockBuilderLike
in interface BlockBuilder
Copyright © 2012-2017. All Rights Reserved.