public static <T> QueryRunner<T> makeTopNQueryRunner(Segment adapter, NonBlockingPool<ByteBuffer> pool) { QueryRunnerFactory factory = new TopNQueryRunnerFactory( pool, new TopNQueryQueryToolChest( topNConfig, QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator() ), QueryRunnerTestHelper.NOOP_QUERYWATCHER ); return new FinalizeResultsQueryRunner<T>( factory.createRunner(adapter), factory.getToolchest() ); }
public TopNLexicographicResultBuilder( DateTime timestamp, DimensionSpec dimSpec, int threshold, String previousStop, final Comparator comparator, List<AggregatorFactory> aggFactories ) { this.timestamp = timestamp; this.dimSpec = dimSpec; this.previousStop = previousStop; this.comparator = comparator; this.aggFactoryNames = TopNQueryQueryToolChest.extractFactoryName(aggFactories); this.threshold = threshold; this.pQueue = new PriorityQueue<>( threshold + 1, (o1, o2) -> comparator.compare(o2.getDimValue(), o1.getDimValue()) ); }
private Sequence<Result<TopNResultValue>> runWithPreMergeAndMerge(TopNQuery query, Map<String, Object> context) { final TopNQueryQueryToolChest chest = new TopNQueryQueryToolChest( new TopNQueryConfig(), QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator() ); final QueryRunner<Result<TopNResultValue>> Runner = new FinalizeResultsQueryRunner( chest.mergeResults(chest.preMergeQueryDecoration(runner)), chest ); return Runner.run(QueryPlus.wrap(query), context); }
private Sequence<Result<TopNResultValue>> runWithMerge(TopNQuery query, Map<String, Object> context) { final TopNQueryQueryToolChest chest = new TopNQueryQueryToolChest( new TopNQueryConfig(), QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator() ); final QueryRunner<Result<TopNResultValue>> mergeRunner = new FinalizeResultsQueryRunner( chest.mergeResults(runner), chest ); return mergeRunner.run(QueryPlus.wrap(query), context); }
private void doTestCacheStrategy(final ValueType valueType, final Object dimValue) throws IOException new TopNQueryQueryToolChest(null, null).getCacheStrategy( new TopNQuery( new TableDataSource("dummy"),
); final CacheStrategy<Result<TopNResultValue>, Object, TopNQuery> strategy1 = new TopNQueryQueryToolChest( null, null ).getCacheStrategy(query1); final CacheStrategy<Result<TopNResultValue>, Object, TopNQuery> strategy2 = new TopNQueryQueryToolChest( null, null ).getCacheStrategy(query2);
Integer.MAX_VALUE ), new TopNQueryQueryToolChest(new TopNQueryConfig(), QueryBenchmarkUtil.NoopIntervalChunkingQueryRunnerDecorator()), QueryBenchmarkUtil.NOOP_QUERYWATCHER );
public TopNNumericResultBuilder( DateTime timestamp, DimensionSpec dimSpec, String metricName, int threshold, final Comparator comparator, List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { this.timestamp = timestamp; this.dimSpec = dimSpec; this.metricName = metricName; this.aggFactoryNames = TopNQueryQueryToolChest.extractFactoryName(aggFactories); this.postAggs = AggregatorUtil.pruneDependentPostAgg(postAggs, this.metricName); this.threshold = threshold; this.metricComparator = comparator; final Comparator<DimValHolder> dimValHolderComparator = (d1, d2) -> { //noinspection unchecked int retVal = metricComparator.compare(d1.getTopNMetricVal(), d2.getTopNMetricVal()); if (retVal == 0) { retVal = dimValueComparator.compare(d1.getDimValue(), d2.getDimValue()); } return retVal; }; // The logic in addEntry first adds, then removes if needed. So it can at any point have up to threshold + 1 entries. pQueue = new PriorityQueue<>(this.threshold + 1, dimValHolderComparator); }
Integer.MAX_VALUE ), new TopNQueryQueryToolChest(new TopNQueryConfig(), QueryBenchmarkUtil.NoopIntervalChunkingQueryRunnerDecorator()), QueryBenchmarkUtil.NOOP_QUERYWATCHER );
private final AggregatorFactory[] aggregatorFactories = query.getAggregatorSpecs() .toArray(new AggregatorFactory[0]); private final String[] aggFactoryNames = extractFactoryName(query.getAggregatorSpecs());
new TopNQueryRunnerFactory( defaultPool, new TopNQueryQueryToolChest( new TopNQueryConfig(), QueryRunnerTestHelper.sameThreadIntervalChunkingQueryRunnerDecorator() new TopNQueryRunnerFactory( customPool, new TopNQueryQueryToolChest( new TopNQueryConfig(), QueryRunnerTestHelper.sameThreadIntervalChunkingQueryRunnerDecorator()
private final AggregatorFactory[] aggregatorFactories = query.getAggregatorSpecs() .toArray(new AggregatorFactory[0]); private final String[] aggFactoryNames = extractFactoryName(query.getAggregatorSpecs()); private final PostAggregator[] postAggregators = query.getPostAggregatorSpecs().toArray(new PostAggregator[0]);
new TopNQueryRunnerFactory( defaultPool, new TopNQueryQueryToolChest( new TopNQueryConfig(), QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator() new TopNQueryRunnerFactory( customPool, new TopNQueryQueryToolChest( new TopNQueryConfig(), QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator()
public TopNLexicographicResultBuilder( DateTime timestamp, DimensionSpec dimSpec, int threshold, String previousStop, final Comparator comparator, List<AggregatorFactory> aggFactories ) { this.timestamp = timestamp; this.dimSpec = dimSpec; this.previousStop = previousStop; this.comparator = comparator; this.aggFactoryNames = TopNQueryQueryToolChest.extractFactoryName(aggFactories); this.threshold = threshold; this.pQueue = new PriorityQueue<>( threshold + 1, (o1, o2) -> comparator.compare(o2.getDimValue(), o1.getDimValue()) ); }
new TopNQueryRunnerFactory( defaultPool, new TopNQueryQueryToolChest( new TopNQueryConfig(), QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator() new TopNQueryRunnerFactory( customPool, new TopNQueryQueryToolChest( new TopNQueryConfig(), QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator()
public TopNNumericResultBuilder( DateTime timestamp, DimensionSpec dimSpec, String metricName, int threshold, final Comparator comparator, List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { this.timestamp = timestamp; this.dimSpec = dimSpec; this.metricName = metricName; this.aggFactoryNames = TopNQueryQueryToolChest.extractFactoryName(aggFactories); this.postAggs = AggregatorUtil.pruneDependentPostAgg(postAggs, this.metricName); this.threshold = threshold; this.metricComparator = comparator; final Comparator<DimValHolder> dimValHolderComparator = (d1, d2) -> { //noinspection unchecked int retVal = metricComparator.compare(d1.getTopNMetricVal(), d2.getTopNMetricVal()); if (retVal == 0) { retVal = dimValueComparator.compare(d1.getDimValue(), d2.getDimValue()); } return retVal; }; // The logic in addEntry first adds, then removes if needed. So it can at any point have up to threshold + 1 entries. pQueue = new PriorityQueue<>(this.threshold + 1, dimValHolderComparator); }
new TopNQueryRunnerFactory( defaultPool, new TopNQueryQueryToolChest( new TopNQueryConfig(), QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator() new TopNQueryRunnerFactory( customPool, new TopNQueryQueryToolChest( new TopNQueryConfig(), QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator()
private final AggregatorFactory[] aggregatorFactories = query.getAggregatorSpecs() .toArray(new AggregatorFactory[0]); private final String[] aggFactoryNames = extractFactoryName(query.getAggregatorSpecs()); private final PostAggregator[] postAggregators = query.getPostAggregatorSpecs().toArray(new PostAggregator[0]);
Integer.MAX_VALUE ), new TopNQueryQueryToolChest(new TopNQueryConfig(), QueryBenchmarkUtil.NoopIntervalChunkingQueryRunnerDecorator()), QueryBenchmarkUtil.NOOP_QUERYWATCHER );
private final AggregatorFactory[] aggregatorFactories = query.getAggregatorSpecs() .toArray(new AggregatorFactory[0]); private final String[] aggFactoryNames = extractFactoryName(query.getAggregatorSpecs());