Package io.trino.operator.aggregation
Class TypedSet
java.lang.Object
io.trino.operator.aggregation.TypedSet
A set of unique SQL values stored in a
Block.
Depending on the factory method used, the values' equality may be
determined using SQL equality or IS DISTINCT FROM semantics.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd the value at the givenpositionin the givenblockto this set.booleanReturn whether this set contains the value at the givenpositionin the givenblock.static TypedSetcreateDistinctTypedSet(Type elementType, BlockTypeOperators.BlockPositionIsDistinctFrom elementDistinctFromOperator, BlockTypeOperators.BlockPositionHashCode elementHashCodeOperator, int expectedSize, String functionName) Create aTypedSetthat compares its elements using the semantics ofIS DISTINCT.static TypedSetcreateDistinctTypedSet(Type elementType, BlockTypeOperators.BlockPositionIsDistinctFrom elementDistinctFromOperator, BlockTypeOperators.BlockPositionHashCode elementHashCodeOperator, BlockBuilder elementBlock, int expectedSize, String functionName) Create aTypedSetthat compares its elements using the semantics ofIS DISTINCT.static TypedSetcreateEqualityTypedSet(Type elementType, BlockTypeOperators.BlockPositionEqual elementEqualOperator, BlockTypeOperators.BlockPositionHashCode elementHashCodeOperator, int expectedSize, String functionName) Create aTypedSetthat compares its elements using SQL equality comparison.static TypedSetcreateEqualityTypedSet(Type elementType, BlockTypeOperators.BlockPositionEqual elementEqualOperator, BlockTypeOperators.BlockPositionHashCode elementHashCodeOperator, BlockBuilder elementBlock, int expectedSize, String functionName) Create aTypedSetthat compares its elements using SQL equality comparison.static TypedSetcreateUnboundedEqualityTypedSet(Type elementType, BlockTypeOperators.BlockPositionEqual elementEqualOperator, BlockTypeOperators.BlockPositionHashCode elementHashCodeOperator, BlockBuilder elementBlock, int expectedSize, String functionName) Create aTypedSetwith no size limit that compares its elements using SQL equality comparison.longReturns the retained size of this block in memory, including over-allocations.intpositionOf(Block block, int position) Return the position in this set'sBlockBuilderof the value at the givenpositionin the givenblock, or -1 if the value is not in this set.intsize()Returns the number of elements in this set.
-
Field Details
-
MAX_FUNCTION_MEMORY
public static final io.airlift.units.DataSize MAX_FUNCTION_MEMORY
-
-
Method Details
-
createEqualityTypedSet
public static TypedSet createEqualityTypedSet(Type elementType, BlockTypeOperators.BlockPositionEqual elementEqualOperator, BlockTypeOperators.BlockPositionHashCode elementHashCodeOperator, int expectedSize, String functionName) Create aTypedSetthat compares its elements using SQL equality comparison. -
createEqualityTypedSet
public static TypedSet createEqualityTypedSet(Type elementType, BlockTypeOperators.BlockPositionEqual elementEqualOperator, BlockTypeOperators.BlockPositionHashCode elementHashCodeOperator, BlockBuilder elementBlock, int expectedSize, String functionName) Create aTypedSetthat compares its elements using SQL equality comparison.The elements of the set will be written in the given
BlockBuilder. If theBlockBuilderis modified by the caller, the set will stop functioning correctly. -
createUnboundedEqualityTypedSet
public static TypedSet createUnboundedEqualityTypedSet(Type elementType, BlockTypeOperators.BlockPositionEqual elementEqualOperator, BlockTypeOperators.BlockPositionHashCode elementHashCodeOperator, BlockBuilder elementBlock, int expectedSize, String functionName) Create aTypedSetwith no size limit that compares its elements using SQL equality comparison.The elements of the set will be written in the given
BlockBuilder. If theBlockBuilderis modified by the caller, the set will stop functioning correctly. -
createDistinctTypedSet
public static TypedSet createDistinctTypedSet(Type elementType, BlockTypeOperators.BlockPositionIsDistinctFrom elementDistinctFromOperator, BlockTypeOperators.BlockPositionHashCode elementHashCodeOperator, int expectedSize, String functionName) Create aTypedSetthat compares its elements using the semantics ofIS DISTINCT. -
createDistinctTypedSet
public static TypedSet createDistinctTypedSet(Type elementType, BlockTypeOperators.BlockPositionIsDistinctFrom elementDistinctFromOperator, BlockTypeOperators.BlockPositionHashCode elementHashCodeOperator, BlockBuilder elementBlock, int expectedSize, String functionName) Create aTypedSetthat compares its elements using the semantics ofIS DISTINCT.The elements of the set will be written in the given
BlockBuilder. If theBlockBuilderis modified by the caller, the set will stop functioning correctly. -
getRetainedSizeInBytes
public long getRetainedSizeInBytes()Returns the retained size of this block in memory, including over-allocations. This method is called from the innermost execution loop and must be fast. -
contains
Return whether this set contains the value at the givenpositionin the givenblock. -
add
Add the value at the givenpositionin the givenblockto this set.- Returns:
trueif the value was added, orfalseif it was already in this set.
-
size
public int size()Returns the number of elements in this set. -
positionOf
Return the position in this set'sBlockBuilderof the value at the givenpositionin the givenblock, or -1 if the value is not in this set.
-