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 boolean
canApplyExtractionInPost(TopNQuery query)
ExtractionFn
which 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.static CursorBuildSpec
makeCursorBuildSpec(TopNQuery query, QueryMetrics<?> queryMetrics)
Sequence<Result<TopNResultValue>>
query(TopNQuery query, Segment segment, TopNQueryMetrics queryMetrics)
Do the thing - process aSegment
into aSequence
ofTopNResultValue
, with one of the fineTopNAlgorithm
available 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, Segment segment, @Nullable TopNQueryMetrics queryMetrics)
Do the thing - process aSegment
into aSequence
ofTopNResultValue
, with one of the fineTopNAlgorithm
available chosen based on the type of column being aggregated. The algorithm provides a mapping function to process rows from the adapterCursor
to applyAggregatorFactory
and create or updateTopNResultValue
-
makeCursorBuildSpec
public static CursorBuildSpec makeCursorBuildSpec(TopNQuery query, @Nullable QueryMetrics<?> queryMetrics)
-
canApplyExtractionInPost
public static boolean canApplyExtractionInPost(TopNQuery query)
ExtractionFn
which 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 theExtractionFn
on 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>>)
.
-
-