Package io.trino.spi.block
Class AbstractRowBlock
java.lang.Object
io.trino.spi.block.AbstractRowBlock
- All Implemented Interfaces:
Block
- Direct Known Subclasses:
RowBlock,RowBlockBuilder
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopyPositions(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.final OptionalIntReturns the number of bytes (in terms ofBlock.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.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.final intgetFieldBlockOffset(int position) protected abstract int[]<T> TGets an object in the value atposition.protected abstract intfinal longgetPositionsSizeInBytes(boolean[] positions, int selectedRowPositions) Returns the size of all positions marked true in the positions array.protected abstract Block[]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).protected abstract boolean[]getSingleValueBlock(int position) Gets the value at the specified position as a single element block.booleanisNull(int position) Is the specified position null?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
bytesCompare, bytesEqual, compareTo, copyWithAppendedNull, equals, getByte, getInt, getLoadedBlock, getLogicalSizeInBytes, getLong, getPositionCount, getPositions, getRetainedSizeInBytes, getShort, getSizeInBytes, getSlice, getSliceLength, hash, isLoaded, mayHaveNull, retainedBytesForEachPart, writeBytesTo
-
Field Details
-
numFields
protected final int numFields
-
-
Constructor Details
-
AbstractRowBlock
protected AbstractRowBlock(int numFields)
-
-
Method Details
-
getChildren
Description copied from interface:BlockGets the direct child blocks of this block.- Specified by:
getChildrenin interfaceBlock
-
getRawFieldBlocks
-
getFieldBlockOffsets
@Nullable protected abstract int[] getFieldBlockOffsets() -
getOffsetBase
protected abstract int getOffsetBase() -
getRowIsNull
@Nullable protected abstract boolean[] getRowIsNull()- Returns:
- the underlying rowIsNull array, or null when all rows are guaranteed to be non-null
-
getFieldBlockOffset
public final int getFieldBlockOffset(int position) -
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.
-
fixedSizeInBytesPerPosition
Description copied from interface:BlockReturns the number of bytes (in terms ofBlock.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 callBlock.getPositionsSizeInBytes(boolean[], int)which would require computing the specific positions selected- Specified by:
fixedSizeInBytesPerPositionin interfaceBlock- Returns:
- The size in bytes, per position, if this block type does not require specific position information to compute its size
-
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 final long getPositionsSizeInBytes(boolean[] positions, int selectedRowPositions) 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
-
getObject
Description copied from interface:BlockGets an object in the value atposition. -
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?
-