Search in sources :

Example 16 with FinalizeResultsQueryRunner

use of io.druid.query.FinalizeResultsQueryRunner in project druid by druid-io.

the class TimeseriesBenchmark method runQuery.

private static <T> List<T> runQuery(QueryRunnerFactory factory, QueryRunner runner, Query<T> query) {
    QueryToolChest toolChest = factory.getToolchest();
    QueryRunner<T> theRunner = new FinalizeResultsQueryRunner<>(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner)), toolChest);
    Sequence<T> queryResult = theRunner.run(query, Maps.<String, Object>newHashMap());
    return Sequences.toList(queryResult, Lists.<T>newArrayList());
}
Also used : FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) TimeseriesQueryQueryToolChest(io.druid.query.timeseries.TimeseriesQueryQueryToolChest) QueryToolChest(io.druid.query.QueryToolChest)

Example 17 with FinalizeResultsQueryRunner

use of io.druid.query.FinalizeResultsQueryRunner in project druid by druid-io.

the class GroupByBenchmark method runQuery.

private static <T> List<T> runQuery(QueryRunnerFactory factory, QueryRunner runner, Query<T> query) {
    QueryToolChest toolChest = factory.getToolchest();
    QueryRunner<T> theRunner = new FinalizeResultsQueryRunner<>(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner)), toolChest);
    Sequence<T> queryResult = theRunner.run(query, Maps.<String, Object>newHashMap());
    return Sequences.toList(queryResult, Lists.<T>newArrayList());
}
Also used : FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) GroupByQueryQueryToolChest(io.druid.query.groupby.GroupByQueryQueryToolChest) QueryToolChest(io.druid.query.QueryToolChest)

Example 18 with FinalizeResultsQueryRunner

use of io.druid.query.FinalizeResultsQueryRunner in project druid by druid-io.

the class SearchBenchmark method runQuery.

private static <T> List<T> runQuery(QueryRunnerFactory factory, QueryRunner runner, Query<T> query) {
    QueryToolChest toolChest = factory.getToolchest();
    QueryRunner<T> theRunner = new FinalizeResultsQueryRunner<>(toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner)), toolChest);
    Sequence<T> queryResult = theRunner.run(query, Maps.<String, Object>newHashMap());
    return Sequences.toList(queryResult, Lists.<T>newArrayList());
}
Also used : FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) SearchQueryQueryToolChest(io.druid.query.search.SearchQueryQueryToolChest) QueryToolChest(io.druid.query.QueryToolChest)

Example 19 with FinalizeResultsQueryRunner

use of io.druid.query.FinalizeResultsQueryRunner in project druid by druid-io.

the class SearchBenchmark method queryMultiQueryableIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void queryMultiQueryableIndex(Blackhole blackhole) throws Exception {
    List<QueryRunner<Row>> singleSegmentRunners = Lists.newArrayList();
    QueryToolChest toolChest = factory.getToolchest();
    for (int i = 0; i < numSegments; i++) {
        String segmentName = "qIndex" + i;
        final QueryRunner<Result<SearchResultValue>> runner = QueryBenchmarkUtil.makeQueryRunner(factory, segmentName, new QueryableIndexSegment(segmentName, qIndexes.get(i)));
        singleSegmentRunners.add(toolChest.preMergeQueryDecoration(runner));
    }
    QueryRunner theRunner = toolChest.postMergeQueryDecoration(new FinalizeResultsQueryRunner<>(toolChest.mergeResults(factory.mergeRunners(executorService, singleSegmentRunners)), toolChest));
    Sequence<Result<SearchResultValue>> queryResult = theRunner.run(query, Maps.<String, Object>newHashMap());
    List<Result<SearchResultValue>> results = Sequences.toList(queryResult, Lists.<Result<SearchResultValue>>newArrayList());
    for (Result<SearchResultValue> result : results) {
        List<SearchHit> hits = result.getValue().getValue();
        for (SearchHit hit : hits) {
            blackhole.consume(hit);
        }
    }
}
Also used : QueryableIndexSegment(io.druid.segment.QueryableIndexSegment) SearchHit(io.druid.query.search.search.SearchHit) SearchQueryQueryToolChest(io.druid.query.search.SearchQueryQueryToolChest) QueryToolChest(io.druid.query.QueryToolChest) FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) QueryRunner(io.druid.query.QueryRunner) Result(io.druid.query.Result) SearchResultValue(io.druid.query.search.SearchResultValue) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 20 with FinalizeResultsQueryRunner

use of io.druid.query.FinalizeResultsQueryRunner in project druid by druid-io.

the class SelectBenchmark method queryMultiQueryableIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void queryMultiQueryableIndex(Blackhole blackhole) throws Exception {
    SelectQuery queryCopy = query.withPagingSpec(PagingSpec.newSpec(pagingThreshold));
    String segmentName;
    List<QueryRunner<Result<SelectResultValue>>> singleSegmentRunners = Lists.newArrayList();
    QueryToolChest toolChest = factory.getToolchest();
    for (int i = 0; i < numSegments; i++) {
        segmentName = "qIndex" + i;
        QueryRunner<Result<SelectResultValue>> runner = QueryBenchmarkUtil.makeQueryRunner(factory, segmentName, new QueryableIndexSegment(segmentName, qIndexes.get(i)));
        singleSegmentRunners.add(toolChest.preMergeQueryDecoration(runner));
    }
    QueryRunner theRunner = toolChest.postMergeQueryDecoration(new FinalizeResultsQueryRunner<>(toolChest.mergeResults(factory.mergeRunners(executorService, singleSegmentRunners)), toolChest));
    boolean done = false;
    while (!done) {
        Sequence<Result<SelectResultValue>> queryResult = theRunner.run(queryCopy, Maps.<String, Object>newHashMap());
        List<Result<SelectResultValue>> results = Sequences.toList(queryResult, Lists.<Result<SelectResultValue>>newArrayList());
        SelectResultValue result = results.get(0).getValue();
        if (result.getEvents().size() == 0) {
            done = true;
        } else {
            for (EventHolder eh : result.getEvents()) {
                blackhole.consume(eh);
            }
            queryCopy = incrementQueryPagination(queryCopy, result);
        }
    }
}
Also used : QueryableIndexSegment(io.druid.segment.QueryableIndexSegment) SelectResultValue(io.druid.query.select.SelectResultValue) SelectQueryQueryToolChest(io.druid.query.select.SelectQueryQueryToolChest) QueryToolChest(io.druid.query.QueryToolChest) FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) QueryRunner(io.druid.query.QueryRunner) Result(io.druid.query.Result) SelectQuery(io.druid.query.select.SelectQuery) EventHolder(io.druid.query.select.EventHolder) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Aggregations

FinalizeResultsQueryRunner (io.druid.query.FinalizeResultsQueryRunner)61 QueryRunner (io.druid.query.QueryRunner)46 Test (org.junit.Test)41 Interval (org.joda.time.Interval)34 DateTime (org.joda.time.DateTime)29 QueryToolChest (io.druid.query.QueryToolChest)27 Result (io.druid.query.Result)22 TimeseriesQueryQueryToolChest (io.druid.query.timeseries.TimeseriesQueryQueryToolChest)22 HashMap (java.util.HashMap)19 LongSumAggregatorFactory (io.druid.query.aggregation.LongSumAggregatorFactory)17 GroupByQueryRunnerTest (io.druid.query.groupby.GroupByQueryRunnerTest)17 TimeseriesResultValue (io.druid.query.timeseries.TimeseriesResultValue)15 TimeseriesQuery (io.druid.query.timeseries.TimeseriesQuery)14 AggregatorFactory (io.druid.query.aggregation.AggregatorFactory)13 CountAggregatorFactory (io.druid.query.aggregation.CountAggregatorFactory)13 ExecutorService (java.util.concurrent.ExecutorService)13 TimeseriesQueryEngine (io.druid.query.timeseries.TimeseriesQueryEngine)12 TimeseriesQueryRunnerFactory (io.druid.query.timeseries.TimeseriesQueryRunnerFactory)12 Druids (io.druid.query.Druids)11 ArrayList (java.util.ArrayList)11