Package org.apache.druid.query.topn
Class TopNQueryEngine
- java.lang.Object
-
- org.apache.druid.query.topn.TopNQueryEngine
-
public class TopNQueryEngine extends Object
-
-
Constructor Summary
Constructors Constructor Description TopNQueryEngine(NonBlockingPool<ByteBuffer> bufferPool)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancanApplyExtractionInPost(TopNQuery query)ExtractionFnwhich are one to one may have their execution deferred until as late as possible, since which value is used as the grouping key itself doesn't particularly matter.Sequence<Result<TopNResultValue>>query(TopNQuery query, StorageAdapter adapter, TopNQueryMetrics queryMetrics)Do the thing - process aStorageAdapterinto aSequenceofTopNResultValue, with one of the fineTopNAlgorithmavailable chosen based on the type of column being aggregated.
-
-
-
Constructor Detail
-
TopNQueryEngine
public TopNQueryEngine(NonBlockingPool<ByteBuffer> bufferPool)
-
-
Method Detail
-
query
public Sequence<Result<TopNResultValue>> query(TopNQuery query, StorageAdapter adapter, @Nullable TopNQueryMetrics queryMetrics)
Do the thing - process aStorageAdapterinto aSequenceofTopNResultValue, with one of the fineTopNAlgorithmavailable chosen based on the type of column being aggregated. The algorithm provides a mapping function to process rows from the adapterCursorto applyAggregatorFactoryand create or updateTopNResultValue
-
canApplyExtractionInPost
public static boolean canApplyExtractionInPost(TopNQuery query)
ExtractionFnwhich are one to one may have their execution deferred until as late as possible, since which value is used as the grouping key itself doesn't particularly matter. For top-n, this method allows the query to be transformed inTopNQueryQueryToolChest.preMergeQueryDecoration(org.apache.druid.query.QueryRunner<org.apache.druid.query.Result<org.apache.druid.query.topn.TopNResultValue>>)to strip off theExtractionFnon the broker, so that a more optimized algorithm (e.g.PooledTopNAlgorithm) can be chosen for processing segments, and then added back and evaluated against the final merged result sets on the broker viaTopNQueryQueryToolChest.postMergeQueryDecoration(org.apache.druid.query.QueryRunner<org.apache.druid.query.Result<org.apache.druid.query.topn.TopNResultValue>>).
-
-