Package org.apache.druid.query.topn
Class HeapBasedTopNAlgorithm
- java.lang.Object
-
- org.apache.druid.query.topn.BaseTopNAlgorithm<Aggregator[][],TopNColumnAggregatesProcessor,TopNParams>
-
- org.apache.druid.query.topn.HeapBasedTopNAlgorithm
-
- All Implemented Interfaces:
TopNAlgorithm<Aggregator[][],TopNParams>
public class HeapBasedTopNAlgorithm extends BaseTopNAlgorithm<Aggregator[][],TopNColumnAggregatesProcessor,TopNParams>
Heap based topn algorithm that handles aggregates on dimension extractions and numeric typed dimension columns. This has to be its own strategy because the pooled topn algorithm assumes each index is unique, and cannot handle multiple index numerals referencing the same dimension value.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.druid.query.topn.BaseTopNAlgorithm
BaseTopNAlgorithm.AggregatorArrayProvider, BaseTopNAlgorithm.BaseArrayProvider<T>
-
-
Field Summary
-
Fields inherited from class org.apache.druid.query.topn.BaseTopNAlgorithm
storageAdapter
-
Fields inherited from interface org.apache.druid.query.topn.TopNAlgorithm
EMPTY_ARRAY, INIT_POSITION_VALUE, SKIP_POSITION_VALUE
-
-
Constructor Summary
Constructors Constructor Description HeapBasedTopNAlgorithm(StorageAdapter storageAdapter, TopNQuery query)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup(TopNParams params)protected voidcloseAggregators(TopNColumnAggregatesProcessor processor)protected TopNColumnAggregatesProcessormakeDimValAggregateStore(TopNParams params)protected Aggregator[][]makeDimValSelector(TopNParams params, int numProcessed, int numToProcess)TopNParamsmakeInitParams(ColumnSelectorPlus<TopNColumnAggregatesProcessor> selectorPlus, Cursor cursor)protected longscanAndAggregate(TopNParams params, Aggregator[][] rowSelector, TopNColumnAggregatesProcessor processor)Returns the number of processed rows (i.protected Aggregator[][]updateDimValSelector(Aggregator[][] aggregators, int numProcessed, int numToProcess)protected voidupdateResults(TopNParams params, Aggregator[][] aggregators, TopNColumnAggregatesProcessor processor, TopNResultBuilder resultBuilder)-
Methods inherited from class org.apache.druid.query.topn.BaseTopNAlgorithm
computeNewLength, makeAggregators, makeBufferAggregators, makeResultBuilder, run
-
-
-
-
Constructor Detail
-
HeapBasedTopNAlgorithm
public HeapBasedTopNAlgorithm(StorageAdapter storageAdapter, TopNQuery query)
-
-
Method Detail
-
makeInitParams
public TopNParams makeInitParams(ColumnSelectorPlus<TopNColumnAggregatesProcessor> selectorPlus, Cursor cursor)
-
makeDimValSelector
protected Aggregator[][] makeDimValSelector(TopNParams params, int numProcessed, int numToProcess)
- Specified by:
makeDimValSelectorin classBaseTopNAlgorithm<Aggregator[][],TopNColumnAggregatesProcessor,TopNParams>
-
updateDimValSelector
protected Aggregator[][] updateDimValSelector(Aggregator[][] aggregators, int numProcessed, int numToProcess)
- Specified by:
updateDimValSelectorin classBaseTopNAlgorithm<Aggregator[][],TopNColumnAggregatesProcessor,TopNParams>
-
makeDimValAggregateStore
protected TopNColumnAggregatesProcessor makeDimValAggregateStore(TopNParams params)
- Specified by:
makeDimValAggregateStorein classBaseTopNAlgorithm<Aggregator[][],TopNColumnAggregatesProcessor,TopNParams>
-
scanAndAggregate
protected long scanAndAggregate(TopNParams params, Aggregator[][] rowSelector, TopNColumnAggregatesProcessor processor)
Description copied from class:BaseTopNAlgorithmReturns the number of processed rows (i. e. after postFilters are applied inside the cursor being processed).- Specified by:
scanAndAggregatein classBaseTopNAlgorithm<Aggregator[][],TopNColumnAggregatesProcessor,TopNParams>
-
updateResults
protected void updateResults(TopNParams params, Aggregator[][] aggregators, TopNColumnAggregatesProcessor processor, TopNResultBuilder resultBuilder)
- Specified by:
updateResultsin classBaseTopNAlgorithm<Aggregator[][],TopNColumnAggregatesProcessor,TopNParams>
-
closeAggregators
protected void closeAggregators(TopNColumnAggregatesProcessor processor)
- Specified by:
closeAggregatorsin classBaseTopNAlgorithm<Aggregator[][],TopNColumnAggregatesProcessor,TopNParams>
-
cleanup
public void cleanup(TopNParams params)
-
-