public class Int128ArrayBlockBuilder extends Object implements BlockBuilder
| Constructor and Description |
|---|
Int128ArrayBlockBuilder(BlockBuilderStatus blockBuilderStatus,
int expectedEntries) |
| Modifier and Type | Method and Description |
|---|---|
BlockBuilder |
appendNull()
Appends a null value to the block.
|
Block |
build()
Builds the block.
|
boolean |
bytesEqual(int position,
int offset,
io.airlift.slice.Slice otherSlice,
int otherOffset,
int length)
Is the byte sequences at the
position + offset position in the 128-bit values of length bytes equal
to the byte sequence at otherOffset in otherSlice. |
BlockBuilder |
closeEntry()
Closes the current entry.
|
Block |
copyPositions(int[] positions,
int offset,
int length)
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.
|
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.
|
long |
getEstimatedDataSizeForStats(int position)
Returns the estimated in memory data size for stats of position.
|
long |
getLong(int position,
int offset)
Gets a little endian long at
offset in the value at position. |
long |
getLongUnchecked(int internalPosition,
int offset)
Gets a little endian long at
offset in the value at internalPosition - getOffsetBase(). |
int |
getOffsetBase() |
int |
getPositionCount()
Returns the number of positions in this block.
|
long |
getPositionsSizeInBytes(boolean[] usedPositions,
int usedPositionCount)
Returns the size of all positions marked true in the positions array.
|
Block |
getRegion(int positionOffset,
int length)
Returns a block starting at the specified position and extends for the
specified length.
|
long |
getRegionSizeInBytes(int position,
int length)
Returns the size of
block.getRegion(position, length). |
long |
getRetainedSizeInBytes()
Returns the retained size of this block in memory, including over-allocations.
|
Block |
getSingleValueBlock(int position)
Gets the value at the specified position as a single element block.
|
long |
getSizeInBytes()
Returns the size of this block as if it was compacted, ignoring any over-allocations.
|
io.airlift.slice.Slice |
getSlice(int position,
int offset,
int length)
Get the Slice starting at
this.positionOffset + offset in the value at position with length bytes. |
int |
getSliceLength(int position)
Gets the length of the value at the
position. |
int |
getSliceLengthUnchecked(int position)
Gets the length of the slice value at
internalPosition - getOffsetBase(). |
io.airlift.slice.Slice |
getSliceUnchecked(int internalPosition,
int offset,
int length)
Get the Slice starting at
offset in the value at internalPosition with length bytes. |
boolean |
isNull(int position)
Is the specified position null?
|
boolean |
isNullUnchecked(int internalPosition) |
boolean |
mayHaveNull()
Is it possible the block may have a null value? If false, the block can not contain
a null, but if true, the block may or may not have a null.
|
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 |
writeLong(long value)
Write a long to the current entry;
|
void |
writePositionTo(int position,
BlockBuilder blockBuilder)
Appends the value at
position to blockBuilder and close the entry. |
void |
writePositionTo(int position,
io.airlift.slice.SliceOutput output)
Appends the value at
position to output. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitappendStructure, appendStructureInternal, beginBlockEntry, beginDirectEntry, getPositions, writeByte, writeBytes, writeInt, writeShortbytesCompare, compareTo, equals, getApproximateRegionLogicalSizeInBytes, getBlock, getByte, getInt, getLoadedBlock, getLogicalSizeInBytes, getLong, getRegionLogicalSizeInBytes, getShort, hash, writeBytesTo, writeBytesTogetBlockUnchecked, getByteUnchecked, getIntUnchecked, getLongUnchecked, getShortUncheckedpublic Int128ArrayBlockBuilder(@Nullable BlockBuilderStatus blockBuilderStatus, int expectedEntries)
public BlockBuilder writeLong(long value)
BlockBuilderwriteLong in interface BlockBuilderpublic BlockBuilder closeEntry()
BlockBuildercloseEntry in interface BlockBuilderpublic BlockBuilder appendNull()
BlockBuilderappendNull in interface BlockappendNull in interface BlockBuilderpublic Block build()
BlockBuilderbuild in interface BlockBuilderpublic BlockBuilder newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus)
BlockBuildernewBlockBuilderLike in interface BlockBuilderpublic BlockBuilder newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus, int expectedEntries)
BlockBuildernewBlockBuilderLike in interface BlockBuilderpublic 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 getRegionSizeInBytes(int position,
int length)
Blockblock.getRegion(position, length).
The method can be expensive. Do not use it outside an implementation of Block.getRegionSizeInBytes in interface Blockpublic long getPositionsSizeInBytes(boolean[] usedPositions,
int usedPositionCount)
Blockblock.getRegionSizeInBytes(position, length)
where you mark all positions for the regions first.getPositionsSizeInBytes in interface Blockpublic long getRetainedSizeInBytes()
BlockgetRetainedSizeInBytes in interface Blockpublic long getEstimatedDataSizeForStats(int position)
BlockgetEstimatedDataSizeForStats 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 int getPositionCount()
BlockgetPositionCount in interface Blockpublic long getLong(int position,
int offset)
Blockoffset in the value at position.public io.airlift.slice.Slice getSlice(int position,
int offset,
int length)
this.positionOffset + offset in the value at position with length bytes.getSlice in interface Blockposition - The logical position of the 128-bit integer in the values array.
For example, position = 0 refers to the 128-bit integer at values[2] and values[3] if this.positionOffset = 1.offset - The offset to the position in the unit of 128-bit integers.
For example, offset = 1 means the next position (one 128-bit integer or 16 bytes) to the specified position.
This means we always compare bytes starting at 128-bit integer boundaries.length - The length in bytes. It has to be a multiple of 16.public int getSliceLength(int position)
Blockposition.
This method must be implemented if @{code getSlice} is implemented.getSliceLength in interface Blockpublic io.airlift.slice.Slice getSliceUnchecked(int internalPosition,
int offset,
int length)
offset in the value at internalPosition with length bytes.getSliceUnchecked in interface UncheckedBlockinternalPosition - The physical position of the 128-bit integer in the values array.
For example, internalPosition = 1 refers to the 128-bit integer at values[2] and values[3]offset - The offset to the position in the unit of 128-bit integers.
For example, offset = 1 means the next position (one 128-bit integer or 16 bytes) to the specified position.
This means we always compare bytes starting at 128-bit integer boundaries.length - The length in bytes. It has to be a multiple of 16.public int getSliceLengthUnchecked(int position)
UncheckedBlockinternalPosition - getOffsetBase().
This method must be implemented if getSliceUnchecked is implemented.getSliceLengthUnchecked in interface UncheckedBlockpublic boolean bytesEqual(int position,
int offset,
io.airlift.slice.Slice otherSlice,
int otherOffset,
int length)
position + offset position in the 128-bit values of length bytes equal
to the byte sequence at otherOffset in otherSlice.bytesEqual in interface Blockposition - The position of 128-bit integer.offset - The offset to the position in the unit of 128-bit integers.
For example, offset = 1 means the next position (one 128-bit integer or 16 bytes) to the specified position.
This means we always compare starting at 128-bit integer boundaries.otherSlice - The slice to compare to.otherOffset - The offset in bytes to the start of otherSlice.length - The length to compare in bytes. It has to be a multiple of 16.public boolean mayHaveNull()
BlockmayHaveNull in interface Blockpublic boolean isNull(int position)
Blockpublic void writePositionTo(int position,
BlockBuilder blockBuilder)
Blockposition to blockBuilder and close the entry.writePositionTo in interface Blockpublic void writePositionTo(int position,
io.airlift.slice.SliceOutput output)
Blockposition to output.writePositionTo in interface Blockpublic BlockBuilder readPositionFrom(io.airlift.slice.SliceInput input)
BlockBuilderreadPositionFrom in interface BlockBuilderpublic Block getSingleValueBlock(int position)
BlockThis method is useful for operators that hold on to a single value without holding on to the entire block.
getSingleValueBlock in interface Blockpublic Block copyPositions(int[] positions, int offset, int length)
Blockpositions array
that starts at offset and has length of length.
All specified positions must be valid for this block.
The returned block must be a compact representation of the original block.
copyPositions in interface Blockpublic Block getRegion(int positionOffset, int length)
BlockThe 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)
BlockThe 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 Blockpublic String getEncodingName()
BlockgetEncodingName in interface Blockpublic long getLongUnchecked(int internalPosition,
int offset)
UncheckedBlockoffset in the value at internalPosition - getOffsetBase().getLongUnchecked in interface UncheckedBlockpublic boolean isNullUnchecked(int internalPosition)
isNullUnchecked in interface UncheckedBlockinternalPosition - getOffsetBase() is nullpublic int getOffsetBase()
getOffsetBase in interface UncheckedBlockCopyright © 2012–2022. All rights reserved.