Module org.elasticsearch.compute
Class TimeSeriesBlockHash
java.lang.Object
org.elasticsearch.compute.aggregation.blockhash.BlockHash
org.elasticsearch.compute.aggregation.blockhash.TimeSeriesBlockHash
- All Implemented Interfaces:
Closeable,AutoCloseable,SeenGroupIds,org.elasticsearch.core.Releasable
An optimized block hash that receives two blocks: tsid and timestamp, which are sorted.
Since the incoming data is sorted, this block hash appends the incoming data to the internal arrays without lookup.
-
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
Fields inherited from class org.elasticsearch.compute.aggregation.blockhash.BlockHash
blockFactory -
Constructor Summary
ConstructorsConstructorDescriptionTimeSeriesBlockHash(int tsHashChannel, int timestampIntervalChannel, BlockFactory blockFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(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()Block[]getKeys()Returns aBlockthat contains all the keys that are inserted byBlockHash.add(org.elasticsearch.compute.data.Page, org.elasticsearch.compute.aggregation.GroupingAggregatorFunction.AddInput).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.nonEmpty()The grouping ids that are not empty.seenGroupIds(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
-
Constructor Details
-
TimeSeriesBlockHash
public TimeSeriesBlockHash(int tsHashChannel, int timestampIntervalChannel, BlockFactory blockFactory)
-
-
Method Details
-
close
public void close() -
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 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 aBlockthat contains all the keys that are inserted byBlockHash.add(org.elasticsearch.compute.data.Page, org.elasticsearch.compute.aggregation.GroupingAggregatorFunction.AddInput).Keys must be in the same order as the IDs returned by
BlockHash.nonEmpty(). -
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.IDs must be in the same order as the keys returned by
BlockHash.getKeys(). -
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
-
toString
-