public class SingleMapBlockWriter extends AbstractSingleMapBlock implements BlockBuilder
| Modifier and Type | Method and Description |
|---|---|
BlockBuilder |
appendNull()
Appends a null value to the block.
|
BlockBuilder |
appendStructure(Block block)
Append a struct to the block and close the entry.
|
BlockBuilder |
appendStructureInternal(Block block,
int position)
Do not use this interface outside block package.
|
BlockBuilder |
beginBlockEntry()
Return a writer to the current entry.
|
Block |
build()
Builds the block.
|
BlockBuilder |
closeEntry()
Closes the current entry.
|
OptionalInt |
fixedSizeInBytesPerPosition()
Returns the number of bytes (in terms of
Block.getSizeInBytes()) required per position
that this block contains, assuming that the number of bytes required is a known static quantity
and not dependent on any particular specific position. |
String |
getEncodingName()
Get the encoding for this block.
|
int |
getPositionCount()
Returns the number of positions in this block.
|
long |
getRetainedSizeInBytes()
Returns the retained size of this block in memory, including over-allocations.
|
long |
getSizeInBytes()
Returns the size of this block as if it was compacted, ignoring any over-allocations.
|
BlockBuilder |
newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus)
Creates a new block builder of the same type based on the current usage statistics of this block builder.
|
BlockBuilder |
newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus,
int expectedEntries)
Creates a new block builder of the same type based on the expectedEntries and the current usage statistics of this block builder.
|
BlockBuilder |
readPositionFrom(io.airlift.slice.SliceInput input)
Read a single position from the input
|
void |
retainedBytesForEachPart(ObjLongConsumer<Object> 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, compareTo, copyPositions, copyRegion, equals, getBlock, getBlockUnchecked, getByte, getByteUnchecked, getEstimatedDataSizeForStats, getInt, getIntUnchecked, getLong, getLong, getLongUnchecked, getLongUnchecked, getOffsetBase, getPositionsSizeInBytes, getRegion, getRegionSizeInBytes, getShort, getShortUnchecked, getSingleValueBlock, getSlice, getSliceLength, getSliceLengthUnchecked, getSliceUnchecked, hash, isNull, isNullUnchecked, writeBytesTo, writeBytesTo, writePositionTo, writePositionToclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitbeginDirectEntry, getPositionsbytesCompare, bytesEqual, compareTo, copyPositions, copyRegion, equals, getApproximateRegionLogicalSizeInBytes, getBlock, getByte, getEstimatedDataSizeForStats, getInt, getLoadedBlock, getLogicalSizeInBytes, getLong, getLong, getPositionsSizeInBytes, getRegion, getRegionLogicalSizeInBytes, getRegionSizeInBytes, getShort, getSingleValueBlock, getSlice, getSliceLength, hash, isNull, mayHaveNull, writeBytesTo, writeBytesTo, writePositionTo, writePositionTogetBlockUnchecked, getByteUnchecked, getIntUnchecked, getLongUnchecked, getLongUnchecked, getOffsetBase, getShortUnchecked, getSliceLengthUnchecked, getSliceUnchecked, isNullUncheckedpublic long getSizeInBytes()
BlockgetSizeInBytes in interface Blockpublic OptionalInt fixedSizeInBytesPerPosition()
BlockBlock.getSizeInBytes()) required per position
that this block contains, assuming that the number of bytes required is a known static quantity
and not dependent on any particular specific position. This allows for some complex block wrappings
to potentially avoid having to call Block.getPositionsSizeInBytes(boolean[], int) which
would require computing the specific positions selectedfixedSizeInBytesPerPosition in interface Blockpublic long getRetainedSizeInBytes()
BlockgetRetainedSizeInBytes in interface Blockpublic void retainedBytesForEachPart(ObjLongConsumer<Object> consumer)
Blockconsumer 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 Blockpublic BlockBuilder writeByte(int value)
BlockBuilderwriteByte in interface BlockBuilderpublic BlockBuilder writeShort(int value)
BlockBuilderwriteShort in interface BlockBuilderpublic BlockBuilder writeInt(int value)
BlockBuilderwriteInt in interface BlockBuilderpublic BlockBuilder writeLong(long value)
BlockBuilderwriteLong in interface BlockBuilderpublic BlockBuilder writeBytes(io.airlift.slice.Slice source, int sourceIndex, int length)
BlockBuilderwriteBytes in interface BlockBuilderpublic BlockBuilder appendStructure(Block block)
BlockBuilderappendStructure in interface BlockBuilderpublic BlockBuilder appendStructureInternal(Block block, int position)
BlockBuilderappendStructureInternal in interface BlockBuilderpublic BlockBuilder beginBlockEntry()
BlockBuilderbeginBlockEntry in interface BlockBuilderpublic BlockBuilder appendNull()
BlockBuilderappendNull in interface BlockappendNull in interface BlockBuilderpublic BlockBuilder readPositionFrom(io.airlift.slice.SliceInput input)
BlockBuilderreadPositionFrom in interface BlockBuilderpublic BlockBuilder closeEntry()
BlockBuildercloseEntry in interface BlockBuilderpublic int getPositionCount()
BlockgetPositionCount in interface Blockpublic String getEncodingName()
BlockgetEncodingName in interface Blockpublic Block build()
BlockBuilderbuild in interface BlockBuilderpublic BlockBuilder newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus)
BlockBuildernewBlockBuilderLike in interface BlockBuilderpublic BlockBuilder newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus, int expectedEntries)
BlockBuildernewBlockBuilderLike in interface BlockBuilderCopyright © 2012–2022. All rights reserved.