Search in sources :

Example 41 with QueryableIndexSegment

use of io.druid.segment.QueryableIndexSegment in project druid by druid-io.

the class DumpSegment method executeQuery.

private static <T> Sequence<T> executeQuery(final Injector injector, final QueryableIndex index, final Query<T> query) {
    final QueryRunnerFactoryConglomerate conglomerate = injector.getInstance(QueryRunnerFactoryConglomerate.class);
    final QueryRunnerFactory factory = conglomerate.findFactory(query);
    final QueryRunner<T> runner = factory.createRunner(new QueryableIndexSegment("segment", index));
    final Sequence results = factory.getToolchest().mergeResults(factory.mergeRunners(MoreExecutors.sameThreadExecutor(), ImmutableList.<QueryRunner>of(runner))).run(query, Maps.<String, Object>newHashMap());
    return (Sequence<T>) results;
}
Also used : QueryableIndexSegment(io.druid.segment.QueryableIndexSegment) QueryRunnerFactoryConglomerate(io.druid.query.QueryRunnerFactoryConglomerate) QueryRunnerFactory(io.druid.query.QueryRunnerFactory) Sequence(io.druid.java.util.common.guava.Sequence)

Example 42 with QueryableIndexSegment

use of io.druid.segment.QueryableIndexSegment in project druid by druid-io.

the class GroupByBenchmark method makeMultiRunners.

private List<QueryRunner<Row>> makeMultiRunners() {
    List<QueryRunner<Row>> runners = Lists.newArrayList();
    for (int i = 0; i < numSegments; i++) {
        String segmentName = "qIndex" + i;
        QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, segmentName, new QueryableIndexSegment(segmentName, queryableIndexes.get(i)));
        runners.add(factory.getToolchest().preMergeQueryDecoration(runner));
    }
    return runners;
}
Also used : QueryableIndexSegment(io.druid.segment.QueryableIndexSegment) InputRow(io.druid.data.input.InputRow) Row(io.druid.data.input.Row) FinalizeResultsQueryRunner(io.druid.query.FinalizeResultsQueryRunner) QueryRunner(io.druid.query.QueryRunner)

Example 43 with QueryableIndexSegment

use of io.druid.segment.QueryableIndexSegment in project druid by druid-io.

the class SearchBenchmark method querySingleQueryableIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndex(Blackhole blackhole) throws Exception {
    final QueryRunner<Result<SearchResultValue>> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex", new QueryableIndexSegment("qIndex", qIndexes.get(0)));
    List<Result<SearchResultValue>> results = SearchBenchmark.runQuery(factory, runner, query);
    List<SearchHit> hits = results.get(0).getValue().getValue();
    for (SearchHit hit : hits) {
        blackhole.consume(hit);
    }
}
Also used : QueryableIndexSegment(io.druid.segment.QueryableIndexSegment) SearchHit(io.druid.query.search.search.SearchHit) Result(io.druid.query.Result) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 44 with QueryableIndexSegment

use of io.druid.segment.QueryableIndexSegment in project druid by druid-io.

the class SelectBenchmark method queryQueryableIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void queryQueryableIndex(Blackhole blackhole) throws Exception {
    SelectQuery queryCopy = query.withPagingSpec(PagingSpec.newSpec(pagingThreshold));
    String segmentId = "qIndex";
    QueryRunner<Result<SelectResultValue>> runner = QueryBenchmarkUtil.makeQueryRunner(factory, segmentId, new QueryableIndexSegment(segmentId, qIndexes.get(0)));
    boolean done = false;
    while (!done) {
        List<Result<SelectResultValue>> results = SelectBenchmark.runQuery(factory, runner, queryCopy);
        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 : SelectQuery(io.druid.query.select.SelectQuery) QueryableIndexSegment(io.druid.segment.QueryableIndexSegment) SelectResultValue(io.druid.query.select.SelectResultValue) EventHolder(io.druid.query.select.EventHolder) Result(io.druid.query.Result) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Example 45 with QueryableIndexSegment

use of io.druid.segment.QueryableIndexSegment in project druid by druid-io.

the class TimeseriesBenchmark method queryFilteredSingleQueryableIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void queryFilteredSingleQueryableIndex(Blackhole blackhole) throws Exception {
    final QueryRunner<Result<TimeseriesResultValue>> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex", new QueryableIndexSegment("qIndex", qIndexes.get(0)));
    DimFilter filter = new SelectorDimFilter("dimSequential", "399", null);
    Query filteredQuery = query.withDimFilter(filter);
    List<Result<TimeseriesResultValue>> results = TimeseriesBenchmark.runQuery(factory, runner, filteredQuery);
    for (Result<TimeseriesResultValue> result : results) {
        blackhole.consume(result);
    }
}
Also used : QueryableIndexSegment(io.druid.segment.QueryableIndexSegment) TimeseriesResultValue(io.druid.query.timeseries.TimeseriesResultValue) TimeseriesQuery(io.druid.query.timeseries.TimeseriesQuery) Query(io.druid.query.Query) SelectorDimFilter(io.druid.query.filter.SelectorDimFilter) BoundDimFilter(io.druid.query.filter.BoundDimFilter) SelectorDimFilter(io.druid.query.filter.SelectorDimFilter) DimFilter(io.druid.query.filter.DimFilter) Result(io.druid.query.Result) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit)

Aggregations

QueryableIndexSegment (io.druid.segment.QueryableIndexSegment)56 Benchmark (org.openjdk.jmh.annotations.Benchmark)37 BenchmarkMode (org.openjdk.jmh.annotations.BenchmarkMode)37 OutputTimeUnit (org.openjdk.jmh.annotations.OutputTimeUnit)37 Result (io.druid.query.Result)22 Row (io.druid.data.input.Row)19 InputRow (io.druid.data.input.InputRow)16 TopNResultValue (io.druid.query.topn.TopNResultValue)15 IncrementalIndexSegment (io.druid.segment.IncrementalIndexSegment)9 QueryRunner (io.druid.query.QueryRunner)7 FinalizeResultsQueryRunner (io.druid.query.FinalizeResultsQueryRunner)5 DefaultDimensionSpec (io.druid.query.dimension.DefaultDimensionSpec)5 QueryableIndex (io.druid.segment.QueryableIndex)5 Test (org.junit.Test)5 QueryToolChest (io.druid.query.QueryToolChest)4 CountAggregatorFactory (io.druid.query.aggregation.CountAggregatorFactory)4 SelectorDimFilter (io.druid.query.filter.SelectorDimFilter)4 GroupByQueryRunnerTest (io.druid.query.groupby.GroupByQueryRunnerTest)4 TimeseriesResultValue (io.druid.query.timeseries.TimeseriesResultValue)4 IndexSpec (io.druid.segment.IndexSpec)4