Search in sources :

Example 6 with SelectResultValue

use of io.druid.query.select.SelectResultValue in project druid by druid-io.

the class SelectBenchmark method queryIncrementalIndex.

@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void queryIncrementalIndex(Blackhole blackhole) throws Exception {
    SelectQuery queryCopy = query.withPagingSpec(PagingSpec.newSpec(pagingThreshold));
    String segmentId = "incIndex";
    QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, segmentId, new IncrementalIndexSegment(incIndexes.get(0), segmentId));
    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) SelectResultValue(io.druid.query.select.SelectResultValue) IncrementalIndexSegment(io.druid.segment.IncrementalIndexSegment) InputRow(io.druid.data.input.InputRow) Row(io.druid.data.input.Row) 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 7 with SelectResultValue

use of io.druid.query.select.SelectResultValue 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 8 with SelectResultValue

use of io.druid.query.select.SelectResultValue in project druid by druid-io.

the class MapVirtualColumnTest method checkSelectQuery.

private void checkSelectQuery(SelectQuery searchQuery, List<Map> expected) throws Exception {
    List<Result<SelectResultValue>> results = Sequences.toList(runner.run(searchQuery, ImmutableMap.of()), Lists.<Result<SelectResultValue>>newArrayList());
    Assert.assertEquals(1, results.size());
    List<EventHolder> events = results.get(0).getValue().getEvents();
    Assert.assertEquals(expected.size(), events.size());
    for (int i = 0; i < events.size(); i++) {
        Map event = events.get(i).getEvent();
        event.remove(EventHolder.timestampKey);
        Assert.assertEquals(expected.get(i), event);
    }
}
Also used : SelectResultValue(io.druid.query.select.SelectResultValue) EventHolder(io.druid.query.select.EventHolder) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Result(io.druid.query.Result)

Aggregations

Result (io.druid.query.Result)8 SelectResultValue (io.druid.query.select.SelectResultValue)8 EventHolder (io.druid.query.select.EventHolder)6 SelectQuery (io.druid.query.select.SelectQuery)4 Sequence (io.druid.java.util.common.guava.Sequence)3 Map (java.util.Map)3 Benchmark (org.openjdk.jmh.annotations.Benchmark)3 BenchmarkMode (org.openjdk.jmh.annotations.BenchmarkMode)3 OutputTimeUnit (org.openjdk.jmh.annotations.OutputTimeUnit)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 QueryableIndexSegment (io.druid.segment.QueryableIndexSegment)2 DateTime (org.joda.time.DateTime)2 Test (org.junit.Test)2 InputRow (io.druid.data.input.InputRow)1 Row (io.druid.data.input.Row)1 ISE (io.druid.java.util.common.ISE)1 FinalizeResultsQueryRunner (io.druid.query.FinalizeResultsQueryRunner)1 QueryRunner (io.druid.query.QueryRunner)1 QueryToolChest (io.druid.query.QueryToolChest)1 AggregationTestHelper (io.druid.query.aggregation.AggregationTestHelper)1