Search in sources :

Example 16 with GroupByQueryConfig

use of org.apache.druid.query.groupby.GroupByQueryConfig in project druid by druid-io.

the class TimestampGroupByAggregationTest method constructorFeeder.

@Parameterized.Parameters(name = "{index}: Test for {0}, config = {1}")
public static Iterable<Object[]> constructorFeeder() {
    final List<Object[]> constructors = new ArrayList<>();
    final List<List<Object>> partialConstructors = ImmutableList.of(ImmutableList.of("timeMin", "tmin", "time_min", DateTimes.of("2011-01-12T01:00:00.000Z")), ImmutableList.of("timeMax", "tmax", "time_max", DateTimes.of("2011-01-31T01:00:00.000Z")));
    for (final List<Object> partialConstructor : partialConstructors) {
        for (GroupByQueryConfig config : GroupByQueryRunnerTest.testConfigs()) {
            final List<Object> constructor = Lists.newArrayList(partialConstructor);
            constructor.add(config);
            constructors.add(constructor.toArray());
        }
    }
    return constructors;
}
Also used : GroupByQueryConfig(org.apache.druid.query.groupby.GroupByQueryConfig) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List)

Example 17 with GroupByQueryConfig

use of org.apache.druid.query.groupby.GroupByQueryConfig in project druid by druid-io.

the class CachingClusteredClientBenchmark method makeGroupByQueryRunnerFactory.

private static GroupByQueryRunnerFactory makeGroupByQueryRunnerFactory(final ObjectMapper mapper, final GroupByQueryConfig config, final DruidProcessingConfig processingConfig) {
    final Supplier<GroupByQueryConfig> configSupplier = Suppliers.ofInstance(config);
    final Supplier<ByteBuffer> bufferSupplier = () -> ByteBuffer.allocateDirect(processingConfig.intermediateComputeSizeBytes());
    final NonBlockingPool<ByteBuffer> bufferPool = new StupidPool<>("GroupByQueryEngine-bufferPool", bufferSupplier);
    final BlockingPool<ByteBuffer> mergeBufferPool = new DefaultBlockingPool<>(bufferSupplier, processingConfig.getNumMergeBuffers());
    final GroupByStrategySelector strategySelector = new GroupByStrategySelector(configSupplier, new GroupByStrategyV1(configSupplier, new GroupByQueryEngine(configSupplier, bufferPool), QueryRunnerTestHelper.NOOP_QUERYWATCHER), new GroupByStrategyV2(processingConfig, configSupplier, bufferPool, mergeBufferPool, mapper, QueryRunnerTestHelper.NOOP_QUERYWATCHER));
    final GroupByQueryQueryToolChest toolChest = new GroupByQueryQueryToolChest(strategySelector);
    return new GroupByQueryRunnerFactory(strategySelector, toolChest);
}
Also used : GroupByStrategySelector(org.apache.druid.query.groupby.strategy.GroupByStrategySelector) GroupByQueryRunnerFactory(org.apache.druid.query.groupby.GroupByQueryRunnerFactory) GroupByQueryConfig(org.apache.druid.query.groupby.GroupByQueryConfig) ByteBuffer(java.nio.ByteBuffer) GroupByQueryQueryToolChest(org.apache.druid.query.groupby.GroupByQueryQueryToolChest) GroupByStrategyV1(org.apache.druid.query.groupby.strategy.GroupByStrategyV1) GroupByStrategyV2(org.apache.druid.query.groupby.strategy.GroupByStrategyV2) DefaultBlockingPool(org.apache.druid.collections.DefaultBlockingPool) StupidPool(org.apache.druid.collections.StupidPool) GroupByQueryEngine(org.apache.druid.query.groupby.GroupByQueryEngine)

Example 18 with GroupByQueryConfig

use of org.apache.druid.query.groupby.GroupByQueryConfig in project druid by druid-io.

the class GroupByBenchmark method setup.

/**
 * Setup everything common for benchmarking both the incremental-index and the queriable-index.
 */
@Setup(Level.Trial)
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);
    query = SCHEMA_QUERY_MAP.get(schemaName).get(queryName);
    generator = new DataGenerator(schemaInfo.getColumnSchemas(), RNG_SEED, schemaInfo.getDataInterval(), rowsPerSegment);
    NonBlockingPool<ByteBuffer> bufferPool = new StupidPool<>("GroupByBenchmark-computeBufferPool", new OffheapBufferGenerator("compute", 250_000_000), 0, Integer.MAX_VALUE);
    // limit of 2 is required since we simulate both historical merge and broker merge in the same process
    BlockingPool<ByteBuffer> mergePool = new DefaultBlockingPool<>(new OffheapBufferGenerator("merge", 250_000_000), 2);
    final GroupByQueryConfig config = new GroupByQueryConfig() {

        @Override
        public String getDefaultStrategy() {
            return defaultStrategy;
        }

        @Override
        public int getBufferGrouperInitialBuckets() {
            return initialBuckets;
        }

        @Override
        public long getMaxOnDiskStorage() {
            return 1_000_000_000L;
        }
    };
    config.setSingleThreaded(false);
    config.setMaxIntermediateRows(Integer.MAX_VALUE);
    config.setMaxResults(Integer.MAX_VALUE);
    DruidProcessingConfig druidProcessingConfig = new DruidProcessingConfig() {

        @Override
        public int getNumThreads() {
            // Used by "v2" strategy for concurrencyHint
            return numProcessingThreads;
        }

        @Override
        public String getFormatString() {
            return null;
        }
    };
    final Supplier<GroupByQueryConfig> configSupplier = Suppliers.ofInstance(config);
    final GroupByStrategySelector strategySelector = new GroupByStrategySelector(configSupplier, new GroupByStrategyV1(configSupplier, new GroupByQueryEngine(configSupplier, bufferPool), QueryBenchmarkUtil.NOOP_QUERYWATCHER), new GroupByStrategyV2(druidProcessingConfig, configSupplier, bufferPool, mergePool, new ObjectMapper(new SmileFactory()), QueryBenchmarkUtil.NOOP_QUERYWATCHER));
    factory = new GroupByQueryRunnerFactory(strategySelector, new GroupByQueryQueryToolChest(strategySelector));
}
Also used : GroupByStrategySelector(org.apache.druid.query.groupby.strategy.GroupByStrategySelector) GroupByQueryRunnerFactory(org.apache.druid.query.groupby.GroupByQueryRunnerFactory) GroupByQueryConfig(org.apache.druid.query.groupby.GroupByQueryConfig) HyperUniquesSerde(org.apache.druid.query.aggregation.hyperloglog.HyperUniquesSerde) ByteBuffer(java.nio.ByteBuffer) GroupByQueryQueryToolChest(org.apache.druid.query.groupby.GroupByQueryQueryToolChest) SmileFactory(com.fasterxml.jackson.dataformat.smile.SmileFactory) OffheapBufferGenerator(org.apache.druid.offheap.OffheapBufferGenerator) GroupByStrategyV1(org.apache.druid.query.groupby.strategy.GroupByStrategyV1) GroupByStrategyV2(org.apache.druid.query.groupby.strategy.GroupByStrategyV2) DefaultBlockingPool(org.apache.druid.collections.DefaultBlockingPool) DataGenerator(org.apache.druid.segment.generator.DataGenerator) StupidPool(org.apache.druid.collections.StupidPool) DruidProcessingConfig(org.apache.druid.query.DruidProcessingConfig) GroupByQueryEngine(org.apache.druid.query.groupby.GroupByQueryEngine) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Setup(org.openjdk.jmh.annotations.Setup)

Example 19 with GroupByQueryConfig

use of org.apache.druid.query.groupby.GroupByQueryConfig in project druid by druid-io.

the class DistinctCountGroupByQueryTest method setup.

@Before
public void setup() {
    final GroupByQueryConfig config = new GroupByQueryConfig();
    config.setMaxIntermediateRows(10000);
    final Pair<GroupByQueryRunnerFactory, Closer> factoryCloserPair = GroupByQueryRunnerTest.makeQueryRunnerFactory(config);
    factory = factoryCloserPair.lhs;
    resourceCloser = factoryCloserPair.rhs;
}
Also used : Closer(org.apache.druid.java.util.common.io.Closer) GroupByQueryRunnerFactory(org.apache.druid.query.groupby.GroupByQueryRunnerFactory) GroupByQueryConfig(org.apache.druid.query.groupby.GroupByQueryConfig) Before(org.junit.Before)

Example 20 with GroupByQueryConfig

use of org.apache.druid.query.groupby.GroupByQueryConfig in project druid by druid-io.

the class MultiValuedDimensionTest method constructorFeeder.

@Parameterized.Parameters(name = "groupby: {0} forceHashAggregation: {2} ({1})")
public static Collection<?> constructorFeeder() {
    final List<Object[]> constructors = new ArrayList<>();
    for (GroupByQueryConfig config : GroupByQueryRunnerTest.testConfigs()) {
        constructors.add(new Object[] { config, TmpFileSegmentWriteOutMediumFactory.instance(), false });
        constructors.add(new Object[] { config, OffHeapMemorySegmentWriteOutMediumFactory.instance(), false });
        constructors.add(new Object[] { config, TmpFileSegmentWriteOutMediumFactory.instance(), true });
        constructors.add(new Object[] { config, OffHeapMemorySegmentWriteOutMediumFactory.instance(), true });
    }
    return constructors;
}
Also used : GroupByQueryConfig(org.apache.druid.query.groupby.GroupByQueryConfig) ArrayList(java.util.ArrayList)

Aggregations

GroupByQueryConfig (org.apache.druid.query.groupby.GroupByQueryConfig)22 ByteBuffer (java.nio.ByteBuffer)11 GroupByQueryRunnerFactory (org.apache.druid.query.groupby.GroupByQueryRunnerFactory)10 Closer (org.apache.druid.java.util.common.io.Closer)7 ArrayList (java.util.ArrayList)6 GroupByQuery (org.apache.druid.query.groupby.GroupByQuery)6 GroupByQueryEngine (org.apache.druid.query.groupby.GroupByQueryEngine)6 List (java.util.List)5 StupidPool (org.apache.druid.collections.StupidPool)5 GroupByQueryQueryToolChest (org.apache.druid.query.groupby.GroupByQueryQueryToolChest)5 ResultRow (org.apache.druid.query.groupby.ResultRow)5 Interval (org.joda.time.Interval)5 CloseableStupidPool (org.apache.druid.collections.CloseableStupidPool)4 MapBasedInputRow (org.apache.druid.data.input.MapBasedInputRow)4 Row (org.apache.druid.data.input.Row)4 Accumulator (org.apache.druid.java.util.common.guava.Accumulator)4 DruidProcessingConfig (org.apache.druid.query.DruidProcessingConfig)4 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)4 Before (org.junit.Before)4 Test (org.junit.Test)4