Package io.trino.spi.block
Class SingleMapBlock
java.lang.Object
io.trino.spi.block.AbstractSingleMapBlock
io.trino.spi.block.SingleMapBlock
- All Implemented Interfaces:
Block
-
Method Summary
Modifier and TypeMethodDescriptionReturns a block that contains a copy of the contents of the current block, and an appended null at the end.Returns 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.Get the encoding for this block.Returns a fully loaded block that assures all data is in memory.intintReturns the number of positions in this block.longReturns the retained size of this block in memory, including over-allocations.longReturns the size of this block as if it was compacted, ignoring any over-allocations and any unloaded nested blocks.booleanisLoaded()Returns true if block data is fully loaded into memory.voidretainedBytesForEachPart(ObjLongConsumer<Object> consumer) consumervisits each of the internal data container and accepts the size for it.intseekKey(MethodHandle keyEqualOperator, MethodHandle keyHashOperator, Block targetKeyBlock, int targetKeyPosition) intintseekKeyExact(boolean nativeValue) intseekKeyExact(double nativeValue) intseekKeyExact(long nativeValue) intseekKeyExact(Object nativeValue) toString()Optional<int[]>Methods inherited from class io.trino.spi.block.AbstractSingleMapBlock
bytesCompare, bytesEqual, compareTo, copyPositions, copyRegion, equals, getByte, getChildren, getEstimatedDataSizeForStats, getInt, getLong, getObject, getPositionsSizeInBytes, getRegion, getRegionSizeInBytes, getShort, getSingleValueBlock, getSlice, getSliceLength, hash, isNull, writeBytesToMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.trino.spi.block.Block
getLogicalSizeInBytes, getPositions, mayHaveNull
-
Method Details
-
getMapType
-
getPositionCount
public int getPositionCount()Description copied from interface:BlockReturns the number of positions in this block. -
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- Returns:
- The size in bytes, per position, if this block type does not require specific position information to compute its size
-
getSizeInBytes
public long getSizeInBytes()Description copied from interface:BlockReturns the size of this block as if it was compacted, ignoring any over-allocations and any unloaded nested blocks. For example, in dictionary blocks, this only counts each dictionary entry once, rather than each time a value is referenced. -
getRetainedSizeInBytes
public long getRetainedSizeInBytes()Description copied from interface:BlockReturns the retained size of this block in memory, including over-allocations. This method is called from the inner most execution loop and must be fast. -
retainedBytesForEachPart
Description copied from interface:Blockconsumervisits 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 blocksconsumershould be called at least once with the current block and must include the instance size of the current block -
getEncodingName
Description copied from interface:BlockGet the encoding for this block. -
getOffset
public int getOffset() -
copyWithAppendedNull
Description copied from interface:BlockReturns a block that contains a copy of the contents of the current block, and an appended null at the end. The original block will not be modified. The purpose of this method is to leverage the contents of a block and the structure of the implementation to efficiently produce a copy of the block with a NULL element inserted - so that it can be used as a dictionary. This method is expected to be invoked on completely builtBlockinstances i.e. not on in-progress block builders. -
toString
-
isLoaded
public boolean isLoaded()Description copied from interface:BlockReturns true if block data is fully loaded into memory. -
getLoadedBlock
Description copied from interface:BlockReturns a fully loaded block that assures all data is in memory. Neither the returned block nor any nested block will be aLazyBlock. The same block will be returned if neither the current block nor any nested blocks areLazyBlock,This allows streaming data sources to skip sections that are not accessed in a query.
-
tryGetHashTable
-
seekKey
- Returns:
- position of the value under
nativeValuekey. -1 when key is not found.
-
seekKey
public int seekKey(MethodHandle keyEqualOperator, MethodHandle keyHashOperator, Block targetKeyBlock, int targetKeyPosition) -
seekKeyExact
public int seekKeyExact(long nativeValue) -
seekKeyExact
public int seekKeyExact(boolean nativeValue) -
seekKeyExact
public int seekKeyExact(double nativeValue) -
seekKeyExact
-