Search in sources :

Example 1 with ScanQueryRunnerFactory

use of org.apache.druid.query.scan.ScanQueryRunnerFactory in project druid by druid-io.

the class QueryStackTests method createQueryRunnerFactoryConglomerate.

public static QueryRunnerFactoryConglomerate createQueryRunnerFactoryConglomerate(final Closer closer, final DruidProcessingConfig processingConfig, final Supplier<Integer> minTopNThresholdSupplier) {
    final CloseableStupidPool<ByteBuffer> stupidPool = new CloseableStupidPool<>("TopNQueryRunnerFactory-bufferPool", () -> ByteBuffer.allocate(COMPUTE_BUFFER_SIZE));
    closer.register(stupidPool);
    final Pair<GroupByQueryRunnerFactory, Closer> factoryCloserPair = GroupByQueryRunnerTest.makeQueryRunnerFactory(GroupByQueryRunnerTest.DEFAULT_MAPPER, new GroupByQueryConfig() {

        @Override
        public String getDefaultStrategy() {
            return GroupByStrategySelector.STRATEGY_V2;
        }
    }, processingConfig);
    final GroupByQueryRunnerFactory groupByQueryRunnerFactory = factoryCloserPair.lhs;
    closer.register(factoryCloserPair.rhs);
    final QueryRunnerFactoryConglomerate conglomerate = new DefaultQueryRunnerFactoryConglomerate(ImmutableMap.<Class<? extends Query>, QueryRunnerFactory>builder().put(SegmentMetadataQuery.class, new SegmentMetadataQueryRunnerFactory(new SegmentMetadataQueryQueryToolChest(new SegmentMetadataQueryConfig("P1W")), QueryRunnerTestHelper.NOOP_QUERYWATCHER)).put(ScanQuery.class, new ScanQueryRunnerFactory(new ScanQueryQueryToolChest(new ScanQueryConfig(), new DefaultGenericQueryMetricsFactory()), new ScanQueryEngine(), new ScanQueryConfig())).put(TimeseriesQuery.class, new TimeseriesQueryRunnerFactory(new TimeseriesQueryQueryToolChest(), new TimeseriesQueryEngine(), QueryRunnerTestHelper.NOOP_QUERYWATCHER)).put(TopNQuery.class, new TopNQueryRunnerFactory(stupidPool, new TopNQueryQueryToolChest(new TopNQueryConfig() {

        @Override
        public int getMinTopNThreshold() {
            return minTopNThresholdSupplier.get();
        }
    }), QueryRunnerTestHelper.NOOP_QUERYWATCHER)).put(GroupByQuery.class, groupByQueryRunnerFactory).build());
    return conglomerate;
}
Also used : ScanQueryConfig(org.apache.druid.query.scan.ScanQueryConfig) ScanQuery(org.apache.druid.query.scan.ScanQuery) TimeseriesQueryQueryToolChest(org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest) QueryRunnerFactoryConglomerate(org.apache.druid.query.QueryRunnerFactoryConglomerate) DefaultQueryRunnerFactoryConglomerate(org.apache.druid.query.DefaultQueryRunnerFactoryConglomerate) TimeseriesQueryEngine(org.apache.druid.query.timeseries.TimeseriesQueryEngine) SegmentMetadataQueryRunnerFactory(org.apache.druid.query.metadata.SegmentMetadataQueryRunnerFactory) TopNQuery(org.apache.druid.query.topn.TopNQuery) TopNQueryRunnerFactory(org.apache.druid.query.topn.TopNQueryRunnerFactory) TopNQueryQueryToolChest(org.apache.druid.query.topn.TopNQueryQueryToolChest) DefaultGenericQueryMetricsFactory(org.apache.druid.query.DefaultGenericQueryMetricsFactory) SegmentMetadataQueryConfig(org.apache.druid.query.metadata.SegmentMetadataQueryConfig) ScanQueryRunnerFactory(org.apache.druid.query.scan.ScanQueryRunnerFactory) Closer(org.apache.druid.java.util.common.io.Closer) GroupByQueryRunnerFactory(org.apache.druid.query.groupby.GroupByQueryRunnerFactory) GroupByQueryConfig(org.apache.druid.query.groupby.GroupByQueryConfig) DefaultQueryRunnerFactoryConglomerate(org.apache.druid.query.DefaultQueryRunnerFactoryConglomerate) ScanQueryEngine(org.apache.druid.query.scan.ScanQueryEngine) CloseableStupidPool(org.apache.druid.collections.CloseableStupidPool) ByteBuffer(java.nio.ByteBuffer) TimeseriesQueryRunnerFactory(org.apache.druid.query.timeseries.TimeseriesQueryRunnerFactory) ScanQueryQueryToolChest(org.apache.druid.query.scan.ScanQueryQueryToolChest) TopNQueryConfig(org.apache.druid.query.topn.TopNQueryConfig) SegmentMetadataQueryQueryToolChest(org.apache.druid.query.metadata.SegmentMetadataQueryQueryToolChest)

Example 2 with ScanQueryRunnerFactory

use of org.apache.druid.query.scan.ScanQueryRunnerFactory in project druid by druid-io.

the class ScanBenchmark method setup.

/**
 * Setup everything common for benchmarking both the incremental-index and the queriable-index.
 */
@Setup
public void setup() {
    log.info("SETUP CALLED AT " + +System.currentTimeMillis());
    ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde());
    setupQueries();
    String[] schemaQuery = schemaAndQuery.split("\\.");
    String schemaName = schemaQuery[0];
    String queryName = schemaQuery[1];
    schemaInfo = GeneratorBasicSchemas.SCHEMA_MAP.get(schemaName);
    queryBuilder = SCHEMA_QUERY_MAP.get(schemaName).get(queryName);
    queryBuilder.limit(limit);
    query = queryBuilder.build();
    generator = new DataGenerator(schemaInfo.getColumnSchemas(), System.currentTimeMillis(), schemaInfo.getDataInterval(), rowsPerSegment);
    final ScanQueryConfig config = new ScanQueryConfig().setLegacy(false);
    factory = new ScanQueryRunnerFactory(new ScanQueryQueryToolChest(config, DefaultGenericQueryMetricsFactory.instance()), new ScanQueryEngine(), new ScanQueryConfig());
}
Also used : ScanQueryConfig(org.apache.druid.query.scan.ScanQueryConfig) ScanQueryQueryToolChest(org.apache.druid.query.scan.ScanQueryQueryToolChest) DataGenerator(org.apache.druid.segment.generator.DataGenerator) HyperUniquesSerde(org.apache.druid.query.aggregation.hyperloglog.HyperUniquesSerde) ScanQueryEngine(org.apache.druid.query.scan.ScanQueryEngine) ScanQueryRunnerFactory(org.apache.druid.query.scan.ScanQueryRunnerFactory) Setup(org.openjdk.jmh.annotations.Setup)

Example 3 with ScanQueryRunnerFactory

use of org.apache.druid.query.scan.ScanQueryRunnerFactory in project druid by druid-io.

the class AggregationTestHelper method createScanQueryAggregationTestHelper.

public static AggregationTestHelper createScanQueryAggregationTestHelper(List<? extends Module> jsonModulesToRegister, TemporaryFolder tempFolder) {
    ObjectMapper mapper = TestHelper.makeJsonMapper();
    ScanQueryQueryToolChest toolchest = new ScanQueryQueryToolChest(new ScanQueryConfig(), DefaultGenericQueryMetricsFactory.instance());
    final Closer resourceCloser = Closer.create();
    ScanQueryRunnerFactory factory = new ScanQueryRunnerFactory(toolchest, new ScanQueryEngine(), new ScanQueryConfig());
    IndexIO indexIO = new IndexIO(mapper, new ColumnConfig() {

        @Override
        public int columnCacheSizeBytes() {
            return 0;
        }
    });
    return new AggregationTestHelper(mapper, new IndexMergerV9(mapper, indexIO, OffHeapMemorySegmentWriteOutMediumFactory.instance()), indexIO, toolchest, factory, tempFolder, jsonModulesToRegister, resourceCloser, Collections.emptyMap());
}
Also used : Closer(org.apache.druid.java.util.common.io.Closer) ScanQueryConfig(org.apache.druid.query.scan.ScanQueryConfig) ScanQueryQueryToolChest(org.apache.druid.query.scan.ScanQueryQueryToolChest) IndexIO(org.apache.druid.segment.IndexIO) ColumnConfig(org.apache.druid.segment.column.ColumnConfig) IndexMergerV9(org.apache.druid.segment.IndexMergerV9) ScanQueryEngine(org.apache.druid.query.scan.ScanQueryEngine) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ScanQueryRunnerFactory(org.apache.druid.query.scan.ScanQueryRunnerFactory)

Aggregations

ScanQueryConfig (org.apache.druid.query.scan.ScanQueryConfig)3 ScanQueryEngine (org.apache.druid.query.scan.ScanQueryEngine)3 ScanQueryQueryToolChest (org.apache.druid.query.scan.ScanQueryQueryToolChest)3 ScanQueryRunnerFactory (org.apache.druid.query.scan.ScanQueryRunnerFactory)3 Closer (org.apache.druid.java.util.common.io.Closer)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ByteBuffer (java.nio.ByteBuffer)1 CloseableStupidPool (org.apache.druid.collections.CloseableStupidPool)1 DefaultGenericQueryMetricsFactory (org.apache.druid.query.DefaultGenericQueryMetricsFactory)1 DefaultQueryRunnerFactoryConglomerate (org.apache.druid.query.DefaultQueryRunnerFactoryConglomerate)1 QueryRunnerFactoryConglomerate (org.apache.druid.query.QueryRunnerFactoryConglomerate)1 HyperUniquesSerde (org.apache.druid.query.aggregation.hyperloglog.HyperUniquesSerde)1 GroupByQueryConfig (org.apache.druid.query.groupby.GroupByQueryConfig)1 GroupByQueryRunnerFactory (org.apache.druid.query.groupby.GroupByQueryRunnerFactory)1 SegmentMetadataQueryConfig (org.apache.druid.query.metadata.SegmentMetadataQueryConfig)1 SegmentMetadataQueryQueryToolChest (org.apache.druid.query.metadata.SegmentMetadataQueryQueryToolChest)1 SegmentMetadataQueryRunnerFactory (org.apache.druid.query.metadata.SegmentMetadataQueryRunnerFactory)1 ScanQuery (org.apache.druid.query.scan.ScanQuery)1 TimeseriesQueryEngine (org.apache.druid.query.timeseries.TimeseriesQueryEngine)1 TimeseriesQueryQueryToolChest (org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest)1