use of org.apache.druid.query.groupby.ResultRow in project druid by druid-io.
the class GroupByBenchmark method queryMultiQueryableIndexWithSpillingTTFR.
/**
* Measure the time to produce the first ResultRow unlike {@link #queryMultiQueryableIndexWithSpilling} measures
* total query processing time. This measure is useful since the Broker can start merging as soon as the first
* result is returned.
*/
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void queryMultiQueryableIndexWithSpillingTTFR(Blackhole blackhole, QueryableIndexState state) throws IOException {
QueryToolChest<ResultRow, GroupByQuery> toolChest = factory.getToolchest();
QueryRunner<ResultRow> theRunner = new FinalizeResultsQueryRunner<>(toolChest.mergeResults(factory.mergeRunners(state.executorService, makeMultiRunners(state))), (QueryToolChest) toolChest);
final GroupByQuery spillingQuery = query.withOverriddenContext(ImmutableMap.of("bufferGrouperMaxSize", 4000));
Sequence<ResultRow> queryResult = theRunner.run(QueryPlus.wrap(spillingQuery), ResponseContext.createEmpty());
Yielder<ResultRow> yielder = Yielders.each(queryResult);
yielder.close();
}
use of org.apache.druid.query.groupby.ResultRow in project druid by druid-io.
the class GroupByBenchmark method makeMultiRunners.
private List<QueryRunner<ResultRow>> makeMultiRunners(QueryableIndexState state) {
List<QueryRunner<ResultRow>> runners = new ArrayList<>();
for (int i = 0; i < state.numSegments; i++) {
String segmentName = "qIndex " + i;
QueryRunner<ResultRow> runner = QueryBenchmarkUtil.makeQueryRunner(factory, SegmentId.dummy(segmentName), new QueryableIndexSegment(state.queryableIndexes.get(i), SegmentId.dummy(segmentName)));
runners.add(factory.getToolchest().preMergeQueryDecoration(runner));
}
return runners;
}
use of org.apache.druid.query.groupby.ResultRow in project druid by druid-io.
the class SqlVsNativeBenchmark method queryNative.
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void queryNative(Blackhole blackhole) {
final Sequence<ResultRow> resultSequence = QueryPlus.wrap(groupByQuery).run(walker, ResponseContext.createEmpty());
final ResultRow lastRow = resultSequence.accumulate(null, (accumulated, in) -> in);
blackhole.consume(lastRow);
}
use of org.apache.druid.query.groupby.ResultRow in project druid by druid-io.
the class GroupByTypeInterfaceBenchmark method querySingleQueryableIndexStringOnly.
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndexStringOnly(Blackhole blackhole) {
QueryRunner<ResultRow> runner = QueryBenchmarkUtil.makeQueryRunner(factory, Q_INDEX_SEGMENT_ID, new QueryableIndexSegment(queryableIndexes.get(0), Q_INDEX_SEGMENT_ID));
List<ResultRow> results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, stringQuery);
for (ResultRow result : results) {
blackhole.consume(result);
}
}
use of org.apache.druid.query.groupby.ResultRow in project druid by druid-io.
the class GroupByTypeInterfaceBenchmark method querySingleQueryableIndexStringThenNumeric.
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndexStringThenNumeric(Blackhole blackhole) {
QueryRunner<ResultRow> runner = QueryBenchmarkUtil.makeQueryRunner(factory, Q_INDEX_SEGMENT_ID, new QueryableIndexSegment(queryableIndexes.get(0), Q_INDEX_SEGMENT_ID));
List<ResultRow> results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, stringQuery);
for (ResultRow result : results) {
blackhole.consume(result);
}
runner = QueryBenchmarkUtil.makeQueryRunner(factory, Q_INDEX_SEGMENT_ID, new QueryableIndexSegment(queryableIndexes.get(0), Q_INDEX_SEGMENT_ID));
results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, longFloatQuery);
for (ResultRow result : results) {
blackhole.consume(result);
}
}
Aggregations