Search in sources :

Example 11 with TopNQueryRunnerFactory

use of org.apache.druid.query.topn.TopNQueryRunnerFactory in project druid by druid-io.

the class FixedBucketsHistogramTopNQueryTest method constructorFeeder.

@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> constructorFeeder() {
    final CloseableStupidPool<ByteBuffer> defaultPool = TestQueryRunners.createDefaultNonBlockingPool();
    final CloseableStupidPool<ByteBuffer> customPool = new CloseableStupidPool<>("TopNQueryRunnerFactory-bufferPool", () -> ByteBuffer.allocate(2000));
    RESOURCE_CLOSER.register(defaultPool);
    RESOURCE_CLOSER.register(customPool);
    return QueryRunnerTestHelper.transformToConstructionFeeder(Iterables.concat(QueryRunnerTestHelper.makeQueryRunners(new TopNQueryRunnerFactory(defaultPool, new TopNQueryQueryToolChest(new TopNQueryConfig()), QueryRunnerTestHelper.NOOP_QUERYWATCHER)), QueryRunnerTestHelper.makeQueryRunners(new TopNQueryRunnerFactory(customPool, new TopNQueryQueryToolChest(new TopNQueryConfig()), QueryRunnerTestHelper.NOOP_QUERYWATCHER))));
}
Also used : TopNQueryConfig(org.apache.druid.query.topn.TopNQueryConfig) TopNQueryRunnerFactory(org.apache.druid.query.topn.TopNQueryRunnerFactory) TopNQueryQueryToolChest(org.apache.druid.query.topn.TopNQueryQueryToolChest) CloseableStupidPool(org.apache.druid.collections.CloseableStupidPool) ByteBuffer(java.nio.ByteBuffer)

Example 12 with TopNQueryRunnerFactory

use of org.apache.druid.query.topn.TopNQueryRunnerFactory in project druid by druid-io.

the class AggregationTestHelper method createTopNQueryAggregationTestHelper.

public static AggregationTestHelper createTopNQueryAggregationTestHelper(List<? extends Module> jsonModulesToRegister, TemporaryFolder tempFolder) {
    ObjectMapper mapper = TestHelper.makeJsonMapper();
    TopNQueryQueryToolChest toolchest = new TopNQueryQueryToolChest(new TopNQueryConfig());
    final CloseableStupidPool<ByteBuffer> pool = new CloseableStupidPool<>("TopNQueryRunnerFactory-bufferPool", new Supplier<ByteBuffer>() {

        @Override
        public ByteBuffer get() {
            return ByteBuffer.allocate(10 * 1024 * 1024);
        }
    });
    final Closer resourceCloser = Closer.create();
    TopNQueryRunnerFactory factory = new TopNQueryRunnerFactory(pool, toolchest, QueryRunnerTestHelper.NOOP_QUERYWATCHER);
    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) ColumnConfig(org.apache.druid.segment.column.ColumnConfig) IndexMergerV9(org.apache.druid.segment.IndexMergerV9) CloseableStupidPool(org.apache.druid.collections.CloseableStupidPool) ByteBuffer(java.nio.ByteBuffer) TopNQueryConfig(org.apache.druid.query.topn.TopNQueryConfig) IndexIO(org.apache.druid.segment.IndexIO) TopNQueryRunnerFactory(org.apache.druid.query.topn.TopNQueryRunnerFactory) TopNQueryQueryToolChest(org.apache.druid.query.topn.TopNQueryQueryToolChest) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

TopNQueryConfig (org.apache.druid.query.topn.TopNQueryConfig)12 TopNQueryQueryToolChest (org.apache.druid.query.topn.TopNQueryQueryToolChest)12 TopNQueryRunnerFactory (org.apache.druid.query.topn.TopNQueryRunnerFactory)12 ByteBuffer (java.nio.ByteBuffer)7 TopNQuery (org.apache.druid.query.topn.TopNQuery)5 CloseableStupidPool (org.apache.druid.collections.CloseableStupidPool)4 TopNQueryBuilder (org.apache.druid.query.topn.TopNQueryBuilder)4 StupidPool (org.apache.druid.collections.StupidPool)3 OffheapBufferGenerator (org.apache.druid.offheap.OffheapBufferGenerator)3 CountAggregatorFactory (org.apache.druid.query.aggregation.CountAggregatorFactory)3 DefaultDimensionSpec (org.apache.druid.query.dimension.DefaultDimensionSpec)3 GroupByQueryRunnerTest (org.apache.druid.query.groupby.GroupByQueryRunnerTest)3 TimeseriesQueryEngine (org.apache.druid.query.timeseries.TimeseriesQueryEngine)3 TimeseriesQueryQueryToolChest (org.apache.druid.query.timeseries.TimeseriesQueryQueryToolChest)3 TimeseriesQueryRunnerFactory (org.apache.druid.query.timeseries.TimeseriesQueryRunnerFactory)3 TopNResultValue (org.apache.druid.query.topn.TopNResultValue)3 QueryableIndexSegment (org.apache.druid.segment.QueryableIndexSegment)3 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)3 Test (org.junit.Test)3 Setup (org.openjdk.jmh.annotations.Setup)3