Package io.trino.spi.block
Class AbstractSingleArrayBlock
java.lang.Object
io.trino.spi.block.AbstractSingleArrayBlock
- All Implemented Interfaces:
Block
- Direct Known Subclasses:
SingleArrayBlockWriter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbytesCompare(int position, int offset, int length, io.airlift.slice.Slice otherSlice, int otherOffset, int otherLength) Compares the byte sequences atoffsetin the value atpositionto the byte sequence atotherOffsetinotherSlice.booleanbytesEqual(int position, int offset, io.airlift.slice.Slice otherSlice, int otherOffset, int length) Is the byte sequences atoffsetin the value atpositionequal to the byte sequence atotherOffsetinotherSlice.intcompareTo(int leftPosition, int leftOffset, int leftLength, Block rightBlock, int rightPosition, int rightOffset, int rightLength) Compares the byte sequences atoffsetin the value atpositionto the byte sequence atotherOffsetin the value atotherPositioninotherBlock.copyPositions(int[] positions, int offset, int length) Returns a block containing the specified positions.copyRegion(int position, int length) Returns a block starting at the specified position and extends for the specified length.booleanIs the byte sequences atoffsetin the value atpositionequal to the byte sequence atotherOffsetin the value atotherPositioninotherBlock.protected abstract BlockgetBlock()bytegetByte(int position, int offset) Gets a byte atoffsetin the value atposition.Gets the direct child blocks of this block.Get the encoding for this block.longgetEstimatedDataSizeForStats(int position) Returns the estimated in memory data size for stats of position.intgetInt(int position, int offset) Gets a little endian int atoffsetin the value atposition.longgetLong(int position, int offset) Gets a little endian long atoffsetin the value atposition.<T> TGets an object in the value atposition.longgetPositionsSizeInBytes(boolean[] positions, int selectedPositionsCount) Returns the size of all positions marked true in the positions array.getRegion(int position, int length) Returns a block starting at the specified position and extends for the specified length.longgetRegionSizeInBytes(int position, int length) Returns the size ofblock.getRegion(position, length).shortgetShort(int position, int offset) Gets a little endian short atoffsetin the value atposition.getSingleValueBlock(int position) Gets the value at the specified position as a single element block.io.airlift.slice.SlicegetSlice(int position, int offset, int length) Gets a slice atoffsetin the value atposition.intgetSliceLength(int position) Gets the length of the value at theposition.longhash(int position, int offset, int length) Calculates the hash code the byte sequences atoffsetin the value atposition.booleanisNull(int position) Is the specified position null?voidwriteBytesTo(int position, int offset, int length, BlockBuilder blockBuilder) Appends the byte sequences atoffsetin the value atpositiontoblockBuilder.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.trino.spi.block.Block
copyWithAppendedNull, fixedSizeInBytesPerPosition, getLoadedBlock, getLogicalSizeInBytes, getPositionCount, getPositions, getRetainedSizeInBytes, getSizeInBytes, isLoaded, mayHaveNull, retainedBytesForEachPart
-
Field Details
-
start
protected final int start
-
-
Constructor Details
-
AbstractSingleArrayBlock
protected AbstractSingleArrayBlock(int start)
-
-
Method Details
-
getChildren
Description copied from interface:BlockGets the direct child blocks of this block.- Specified by:
getChildrenin interfaceBlock
-
getBlock
-
getSliceLength
public int getSliceLength(int position) Description copied from interface:BlockGets the length of the value at theposition. This method must be implemented if @{code getSlice} is implemented.- Specified by:
getSliceLengthin interfaceBlock
-
getByte
public byte getByte(int position, int offset) Description copied from interface:BlockGets a byte atoffsetin the value atposition. -
getShort
public short getShort(int position, int offset) Description copied from interface:BlockGets a little endian short atoffsetin the value atposition. -
getInt
public int getInt(int position, int offset) Description copied from interface:BlockGets a little endian int atoffsetin the value atposition. -
getLong
public long getLong(int position, int offset) Description copied from interface:BlockGets a little endian long atoffsetin the value atposition. -
getSlice
public io.airlift.slice.Slice getSlice(int position, int offset, int length) Description copied from interface:BlockGets a slice atoffsetin the value atposition. -
getObject
Description copied from interface:BlockGets an object in the value atposition. -
bytesEqual
public boolean bytesEqual(int position, int offset, io.airlift.slice.Slice otherSlice, int otherOffset, int length) Description copied from interface:BlockIs the byte sequences atoffsetin the value atpositionequal to the byte sequence atotherOffsetinotherSlice. This method must be implemented if @{code getSlice} is implemented.- Specified by:
bytesEqualin interfaceBlock
-
bytesCompare
public int bytesCompare(int position, int offset, int length, io.airlift.slice.Slice otherSlice, int otherOffset, int otherLength) Description copied from interface:BlockCompares the byte sequences atoffsetin the value atpositionto the byte sequence atotherOffsetinotherSlice. This method must be implemented if @{code getSlice} is implemented.- Specified by:
bytesComparein interfaceBlock
-
writeBytesTo
Description copied from interface:BlockAppends the byte sequences atoffsetin the value atpositiontoblockBuilder. This method must be implemented if @{code getSlice} is implemented.- Specified by:
writeBytesToin interfaceBlock
-
equals
public boolean equals(int position, int offset, Block otherBlock, int otherPosition, int otherOffset, int length) Description copied from interface:BlockIs the byte sequences atoffsetin the value atpositionequal to the byte sequence atotherOffsetin the value atotherPositioninotherBlock. This method must be implemented if @{code getSlice} is implemented. -
hash
public long hash(int position, int offset, int length) Description copied from interface:BlockCalculates the hash code the byte sequences atoffsetin the value atposition. This method must be implemented if @{code getSlice} is implemented. -
compareTo
public int compareTo(int leftPosition, int leftOffset, int leftLength, Block rightBlock, int rightPosition, int rightOffset, int rightLength) Description copied from interface:BlockCompares the byte sequences atoffsetin the value atpositionto the byte sequence atotherOffsetin the value atotherPositioninotherBlock. This method must be implemented if @{code getSlice} is implemented. -
getSingleValueBlock
Description copied from interface:BlockGets the value at the specified position as a single element block. The method must copy the data into a new block.This method is useful for operators that hold on to a single value without holding on to the entire block.
- Specified by:
getSingleValueBlockin interfaceBlock
-
getEstimatedDataSizeForStats
public long getEstimatedDataSizeForStats(int position) Description copied from interface:BlockReturns the estimated in memory data size for stats of position. Do not use it for other purpose.- Specified by:
getEstimatedDataSizeForStatsin interfaceBlock
-
isNull
public boolean isNull(int position) Description copied from interface:BlockIs the specified position null? -
getEncodingName
Description copied from interface:BlockGet the encoding for this block.- Specified by:
getEncodingNamein interfaceBlock
-
copyPositions
Description copied from interface:BlockReturns a block containing the specified positions. Positions to copy are stored in a subarray withinpositionsarray that starts atoffsetand has length oflength. All specified positions must be valid for this block.The returned block must be a compact representation of the original block.
- Specified by:
copyPositionsin interfaceBlock
-
getRegion
Description copied from interface:BlockReturns a block starting at the specified position and extends for the specified length. The specified region must be entirely contained within this 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.
-
getRegionSizeInBytes
public long getRegionSizeInBytes(int position, int length) Description copied from interface:BlockReturns the size ofblock.getRegion(position, length). The method can be expensive. Do not use it outside an implementation of Block.- Specified by:
getRegionSizeInBytesin interfaceBlock
-
getPositionsSizeInBytes
public long getPositionsSizeInBytes(boolean[] positions, int selectedPositionsCount) Description copied from interface:BlockReturns the size of all positions marked true in the positions array. This is equivalent to multiple calls ofblock.getRegionSizeInBytes(position, length)where you mark all positions for the regions first. The 'selectedPositionsCount' variable may be used to skip iterating through the positions array in case this is a fixed-width block- Specified by:
getPositionsSizeInBytesin interfaceBlock
-
copyRegion
Description copied from interface:BlockReturns a block starting at the specified position and extends for the specified length. The specified region must be entirely contained within this 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.
- Specified by:
copyRegionin interfaceBlock
-