Search in sources :

Example 11 with CloseableStupidPool

use of org.apache.druid.collections.CloseableStupidPool 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 CloseableStupidPool

use of org.apache.druid.collections.CloseableStupidPool 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

ByteBuffer (java.nio.ByteBuffer)12 CloseableStupidPool (org.apache.druid.collections.CloseableStupidPool)12 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 CloseableDefaultBlockingPool (org.apache.druid.collections.CloseableDefaultBlockingPool)4 MapBasedInputRow (org.apache.druid.data.input.MapBasedInputRow)4 LongSumAggregatorFactory (org.apache.druid.query.aggregation.LongSumAggregatorFactory)4 GroupByQueryConfig (org.apache.druid.query.groupby.GroupByQueryConfig)4 GroupByStrategySelector (org.apache.druid.query.groupby.strategy.GroupByStrategySelector)4 GroupByStrategyV1 (org.apache.druid.query.groupby.strategy.GroupByStrategyV1)4 GroupByStrategyV2 (org.apache.druid.query.groupby.strategy.GroupByStrategyV2)4 TopNQueryConfig (org.apache.druid.query.topn.TopNQueryConfig)4 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)4 Interval (org.joda.time.Interval)4 Test (org.junit.Test)4 SmileFactory (com.fasterxml.jackson.dataformat.smile.SmileFactory)3 MapBasedRow (org.apache.druid.data.input.MapBasedRow)3 Row (org.apache.druid.data.input.Row)3 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)3 Closer (org.apache.druid.java.util.common.io.Closer)3 DruidProcessingConfig (org.apache.druid.query.DruidProcessingConfig)3