public class AggregateTopNMetricFirstAlgorithm extends Object implements TopNAlgorithm<int[],TopNParams>
TopNAlgorithm
is tailored to processing aggregates on high cardility columns which are likely to have
larger result sets. Internally it uses a 2 phase approach to compute the top-n result using the
PooledTopNAlgorithm
for each phase. The first phase is to process the segment with only the order-by
aggregator to compute which values constitute the top 'n' results. With this information, a actual result set
is computed by a second run of the PooledTopNAlgorithm
, this time with all aggregators, but only considering
the values from the 'n' results to avoid performing any aggregations that would have been thrown away for results
that didn't make the top-n.EMPTY_ARRAY, INIT_POSITION_VALUE, SKIP_POSITION_VALUE
Constructor and Description |
---|
AggregateTopNMetricFirstAlgorithm(StorageAdapter storageAdapter,
TopNQuery query,
NonBlockingPool<ByteBuffer> bufferPool) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup(TopNParams params) |
TopNParams |
makeInitParams(ColumnSelectorPlus selectorPlus,
Cursor cursor) |
void |
run(TopNParams params,
TopNResultBuilder resultBuilder,
int[] ints,
TopNQueryMetrics queryMetrics) |
public AggregateTopNMetricFirstAlgorithm(StorageAdapter storageAdapter, TopNQuery query, NonBlockingPool<ByteBuffer> bufferPool)
public TopNParams makeInitParams(ColumnSelectorPlus selectorPlus, Cursor cursor)
makeInitParams
in interface TopNAlgorithm<int[],TopNParams>
public void run(TopNParams params, TopNResultBuilder resultBuilder, int[] ints, @Nullable TopNQueryMetrics queryMetrics)
run
in interface TopNAlgorithm<int[],TopNParams>
public void cleanup(TopNParams params)
cleanup
in interface TopNAlgorithm<int[],TopNParams>
Copyright © 2011–2021 The Apache Software Foundation. All rights reserved.