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;
}
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;
}
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);
}
}
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);
}
}
}
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);
}
}
Aggregations