Search in sources :

Example 1 with SearchQueryRunnerFactory

use of io.druid.query.search.SearchQueryRunnerFactory in project druid by druid-io.

the class TestQueryRunners method makeSearchQueryRunner.

public static <T> QueryRunner<T> makeSearchQueryRunner(Segment adapter) {
    final SearchQueryConfig config = new SearchQueryConfig();
    QueryRunnerFactory factory = new SearchQueryRunnerFactory(new SearchStrategySelector(Suppliers.ofInstance(config)), new SearchQueryQueryToolChest(config, QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator()), QueryRunnerTestHelper.NOOP_QUERYWATCHER);
    return new FinalizeResultsQueryRunner<T>(factory.createRunner(adapter), factory.getToolchest());
}
Also used : SearchQueryQueryToolChest(io.druid.query.search.SearchQueryQueryToolChest) SearchQueryConfig(io.druid.query.search.search.SearchQueryConfig) SearchQueryRunnerFactory(io.druid.query.search.SearchQueryRunnerFactory) TopNQueryRunnerFactory(io.druid.query.topn.TopNQueryRunnerFactory) TimeBoundaryQueryRunnerFactory(io.druid.query.timeboundary.TimeBoundaryQueryRunnerFactory) TimeseriesQueryRunnerFactory(io.druid.query.timeseries.TimeseriesQueryRunnerFactory) SearchQueryRunnerFactory(io.druid.query.search.SearchQueryRunnerFactory) SearchStrategySelector(io.druid.query.search.SearchStrategySelector)

Example 2 with SearchQueryRunnerFactory

use of io.druid.query.search.SearchQueryRunnerFactory in project druid by druid-io.

the class SearchBenchmark method setup.

@Setup
public void setup() throws IOException {
    log.info("SETUP CALLED AT " + +System.currentTimeMillis());
    if (ComplexMetrics.getSerdeForType("hyperUnique") == null) {
        ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde(HyperLogLogHash.getDefault()));
    }
    executorService = Execs.multiThreaded(numSegments, "SearchThreadPool");
    setupQueries();
    String[] schemaQuery = schemaAndQuery.split("\\.");
    String schemaName = schemaQuery[0];
    String queryName = schemaQuery[1];
    schemaInfo = BenchmarkSchemas.SCHEMA_MAP.get(schemaName);
    queryBuilder = SCHEMA_QUERY_MAP.get(schemaName).get(queryName);
    queryBuilder.limit(limit);
    query = queryBuilder.build();
    incIndexes = new ArrayList<>();
    for (int i = 0; i < numSegments; i++) {
        log.info("Generating rows for segment " + i);
        BenchmarkDataGenerator gen = new BenchmarkDataGenerator(schemaInfo.getColumnSchemas(), System.currentTimeMillis(), schemaInfo.getDataInterval(), rowsPerSegment);
        IncrementalIndex incIndex = makeIncIndex();
        for (int j = 0; j < rowsPerSegment; j++) {
            InputRow row = gen.nextRow();
            if (j % 10000 == 0) {
                log.info(j + " rows generated.");
            }
            incIndex.add(row);
        }
        incIndexes.add(incIndex);
    }
    tmpDir = Files.createTempDir();
    log.info("Using temp dir: " + tmpDir.getAbsolutePath());
    qIndexes = new ArrayList<>();
    for (int i = 0; i < numSegments; i++) {
        File indexFile = INDEX_MERGER_V9.persist(incIndexes.get(i), tmpDir, new IndexSpec());
        QueryableIndex qIndex = INDEX_IO.loadIndex(indexFile);
        qIndexes.add(qIndex);
    }
    final SearchQueryConfig config = new SearchQueryConfig().withOverrides(query);
    factory = new SearchQueryRunnerFactory(new SearchStrategySelector(Suppliers.ofInstance(config)), new SearchQueryQueryToolChest(config, QueryBenchmarkUtil.NoopIntervalChunkingQueryRunnerDecorator()), QueryBenchmarkUtil.NOOP_QUERYWATCHER);
}
Also used : IndexSpec(io.druid.segment.IndexSpec) SearchQueryConfig(io.druid.query.search.search.SearchQueryConfig) IncrementalIndex(io.druid.segment.incremental.IncrementalIndex) OnheapIncrementalIndex(io.druid.segment.incremental.OnheapIncrementalIndex) BenchmarkDataGenerator(io.druid.benchmark.datagen.BenchmarkDataGenerator) HyperUniquesSerde(io.druid.query.aggregation.hyperloglog.HyperUniquesSerde) SearchQueryRunnerFactory(io.druid.query.search.SearchQueryRunnerFactory) SearchStrategySelector(io.druid.query.search.SearchStrategySelector) SearchQueryQueryToolChest(io.druid.query.search.SearchQueryQueryToolChest) QueryableIndex(io.druid.segment.QueryableIndex) InputRow(io.druid.data.input.InputRow) File(java.io.File) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

SearchQueryQueryToolChest (io.druid.query.search.SearchQueryQueryToolChest)2 SearchQueryRunnerFactory (io.druid.query.search.SearchQueryRunnerFactory)2 SearchStrategySelector (io.druid.query.search.SearchStrategySelector)2 SearchQueryConfig (io.druid.query.search.search.SearchQueryConfig)2 BenchmarkDataGenerator (io.druid.benchmark.datagen.BenchmarkDataGenerator)1 InputRow (io.druid.data.input.InputRow)1 HyperUniquesSerde (io.druid.query.aggregation.hyperloglog.HyperUniquesSerde)1 TimeBoundaryQueryRunnerFactory (io.druid.query.timeboundary.TimeBoundaryQueryRunnerFactory)1 TimeseriesQueryRunnerFactory (io.druid.query.timeseries.TimeseriesQueryRunnerFactory)1 TopNQueryRunnerFactory (io.druid.query.topn.TopNQueryRunnerFactory)1 IndexSpec (io.druid.segment.IndexSpec)1 QueryableIndex (io.druid.segment.QueryableIndex)1 IncrementalIndex (io.druid.segment.incremental.IncrementalIndex)1 OnheapIncrementalIndex (io.druid.segment.incremental.OnheapIncrementalIndex)1 File (java.io.File)1 Setup (org.openjdk.jmh.annotations.Setup)1