Module org.elasticsearch.compute
Class LongIntAdaptiveBlockHash
java.lang.Object
org.elasticsearch.compute.aggregation.blockhash.BlockHash
org.elasticsearch.compute.aggregation.blockhash.LongIntAdaptiveBlockHash
- All Implemented Interfaces:
Closeable,AutoCloseable,SeenGroupIds,org.elasticsearch.core.Releasable
An
AdaptiveBlockHash between LongLongHash and PackedValuesBlockHash.
If all inputs are vectors, it uses a LongIntAdaptiveBlockHash.LongIntVectorOnlyBlockHash, otherwise it migrates to a PackedValuesBlockHash.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.compute.aggregation.blockhash.BlockHash
BlockHash.CategorizeDef, BlockHash.GroupSpec, BlockHash.TopNDefNested classes/interfaces inherited from interface org.elasticsearch.compute.aggregation.SeenGroupIds
SeenGroupIds.Empty, SeenGroupIds.Range -
Field Summary
FieldsFields inherited from class org.elasticsearch.compute.aggregation.blockhash.BlockHash
blockFactory -
Constructor Summary
ConstructorsConstructorDescriptionLongIntAdaptiveBlockHash(List<BlockHash.GroupSpec> specs, BlockFactory blockFactory, int emitBatchSize, boolean reverseOutput) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidadd(Page page, GroupingAggregatorFunction.AddInput addInput) Add all values for the "group by" columns in the page to the hash and pass the ordinals to the providedGroupingAggregatorFunction.AddInput.voidclose()final Block[]Returns an array ofBlocks containing keys.final org.elasticsearch.core.ReleasableIterator<IntBlock> lookup(Page page, ByteSizeValue targetBlockSize) Lookup all values for the "group by" columns in the page to the hash and return anIteratorof the values.final IntVectornonEmpty()The grouping ids that are not empty.final intnumKeys()The number of unique keys in the hash.protected voidprepareAddInput(Page page) Prepare the delegate block hash to add input from the given page.protected voidprepareForLookup(Page page) Prepare the delegate block hash for a lookup on the given page.final BitArrayseenGroupIds(BigArrays bigArrays) The grouping ids that have been seen already.toString()Methods inherited from class org.elasticsearch.compute.aggregation.blockhash.BlockHash
build, buildCategorizeBlockHash, buildPackedValuesBlockHash, hashOrdToGroup, hashOrdToGroupNullReserved
-
Field Details
-
specs
-
current
-
-
Constructor Details
-
LongIntAdaptiveBlockHash
public LongIntAdaptiveBlockHash(List<BlockHash.GroupSpec> specs, BlockFactory blockFactory, int emitBatchSize, boolean reverseOutput)
-
-
Method Details
-
prepareAddInput
Prepare the delegate block hash to add input from the given page. -
prepareForLookup
Prepare the delegate block hash for a lookup on the given page. -
add
Description copied from class:BlockHashAdd all values for the "group by" columns in the page to the hash and pass the ordinals to the providedGroupingAggregatorFunction.AddInput.This call will not
Releasable.close()addInput. -
lookup
public final org.elasticsearch.core.ReleasableIterator<IntBlock> lookup(Page page, ByteSizeValue targetBlockSize) Description copied from class:BlockHashLookup all values for the "group by" columns in the page to the hash and return anIteratorof the values. The sum ofBlock.getPositionCount()for all blocks returned by the iterator will equalPage.getPositionCount()but will "target" a size oftargetBlockSize.The returned
ReleasableIteratormay retain a reference toBlocks inside thePage. Close it to release those references. -
getKeys
Description copied from class:BlockHashReturns an array ofBlocks containing keys.- Specified by:
getKeysin classBlockHash- Parameters:
selected- The groupIds to include in the results. These are the same groupIds returned byBlockHash.nonEmpty()and fed into aggregations as part ofBlockHash.add(org.elasticsearch.compute.data.Page, org.elasticsearch.compute.aggregation.GroupingAggregatorFunction.AddInput).
-
nonEmpty
Description copied from class:BlockHashThe grouping ids that are not empty. We use this because some block hashes reserve space for grouping ids and then don't end up using them. For example,BooleanBlockHashdoes this by always assigningfalseto0andtrueto1. It's only after collection when we know if there actually were anytrueorfalsevalues received. -
numKeys
public final int numKeys()Description copied from class:BlockHashThe number of unique keys in the hash. -
seenGroupIds
Description copied from interface:SeenGroupIdsThe grouping ids that have been seen already. ThisBitArrayis kept and mutated by the caller so make a copy if it's something you need your own copy of it.- Specified by:
seenGroupIdsin interfaceSeenGroupIds- Specified by:
seenGroupIdsin classBlockHash
-
close
public void close() -
toString
-