Package org.apache.druid.query.topn
Class TopNQueryEngine
java.lang.Object
org.apache.druid.query.topn.TopNQueryEngine
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanExtractionFnwhich 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 CursorBuildSpecmakeCursorBuildSpec(TopNQuery query, QueryMetrics<?> queryMetrics) query(TopNQuery query, Segment segment, TopNQueryMetrics queryMetrics) Do the thing - process aSegmentinto aSequenceofTopNResultValue, with one of the fineTopNAlgorithmavailable chosen based on the type of column being aggregated.
-
Constructor Details
-
TopNQueryEngine
-
-
Method Details
-
query
public Sequence<Result<TopNResultValue>> query(TopNQuery query, Segment segment, @Nullable TopNQueryMetrics queryMetrics) Do the thing - process aSegmentinto 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 -
makeCursorBuildSpec
public static CursorBuildSpec makeCursorBuildSpec(TopNQuery query, @Nullable QueryMetrics<?> queryMetrics) -
canApplyExtractionInPost
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>>).
-