Search in sources :

Example 6 with PlannerConfig

use of io.druid.sql.calcite.planner.PlannerConfig in project druid by druid-io.

the class SqlResourceTest method setUp.

@Before
public void setUp() throws Exception {
    Calcites.setSystemProperties();
    walker = CalciteTests.createMockWalker(temporaryFolder.newFolder());
    final PlannerConfig plannerConfig = new PlannerConfig();
    final SchemaPlus rootSchema = Calcites.createRootSchema(CalciteTests.createMockSchema(walker, plannerConfig));
    final DruidOperatorTable operatorTable = CalciteTests.createOperatorTable();
    resource = new SqlResource(JSON_MAPPER, new PlannerFactory(rootSchema, walker, operatorTable, plannerConfig));
}
Also used : PlannerConfig(io.druid.sql.calcite.planner.PlannerConfig) SchemaPlus(org.apache.calcite.schema.SchemaPlus) SqlResource(io.druid.sql.http.SqlResource) PlannerFactory(io.druid.sql.calcite.planner.PlannerFactory) DruidOperatorTable(io.druid.sql.calcite.planner.DruidOperatorTable) Before(org.junit.Before)

Example 7 with PlannerConfig

use of io.druid.sql.calcite.planner.PlannerConfig in project druid by druid-io.

the class QuantileSqlAggregatorTest method setUp.

@Before
public void setUp() throws Exception {
    Calcites.setSystemProperties();
    // Note: this is needed in order to properly register the serde for Histogram.
    new ApproximateHistogramDruidModule().configure(null);
    final QueryableIndex index = IndexBuilder.create().tmpDir(temporaryFolder.newFolder()).indexMerger(TestHelper.getTestIndexMergerV9()).schema(new IncrementalIndexSchema.Builder().withMetrics(new AggregatorFactory[] { new CountAggregatorFactory("cnt"), new DoubleSumAggregatorFactory("m1", "m1"), new ApproximateHistogramAggregatorFactory("hist_m1", "m1", null, null, null, null) }).withRollup(false).build()).rows(CalciteTests.ROWS1).buildMMappedIndex();
    walker = new SpecificSegmentsQuerySegmentWalker(CalciteTests.queryRunnerFactoryConglomerate()).add(DataSegment.builder().dataSource(DATA_SOURCE).interval(index.getDataInterval()).version("1").shardSpec(new LinearShardSpec(0)).build(), index);
    final PlannerConfig plannerConfig = new PlannerConfig();
    final SchemaPlus rootSchema = Calcites.createRootSchema(CalciteTests.createMockSchema(walker, plannerConfig));
    final DruidOperatorTable operatorTable = new DruidOperatorTable(ImmutableSet.<SqlAggregator>of(new QuantileSqlAggregator()), ImmutableSet.<SqlExtractionOperator>of());
    plannerFactory = new PlannerFactory(rootSchema, walker, operatorTable, plannerConfig);
}
Also used : DoubleSumAggregatorFactory(io.druid.query.aggregation.DoubleSumAggregatorFactory) ApproximateHistogramDruidModule(io.druid.query.aggregation.histogram.ApproximateHistogramDruidModule) LinearShardSpec(io.druid.timeline.partition.LinearShardSpec) IndexBuilder(io.druid.segment.IndexBuilder) SchemaPlus(org.apache.calcite.schema.SchemaPlus) AggregatorFactory(io.druid.query.aggregation.AggregatorFactory) CountAggregatorFactory(io.druid.query.aggregation.CountAggregatorFactory) ApproximateHistogramFoldingAggregatorFactory(io.druid.query.aggregation.histogram.ApproximateHistogramFoldingAggregatorFactory) FilteredAggregatorFactory(io.druid.query.aggregation.FilteredAggregatorFactory) ApproximateHistogramAggregatorFactory(io.druid.query.aggregation.histogram.ApproximateHistogramAggregatorFactory) DoubleSumAggregatorFactory(io.druid.query.aggregation.DoubleSumAggregatorFactory) DruidOperatorTable(io.druid.sql.calcite.planner.DruidOperatorTable) CountAggregatorFactory(io.druid.query.aggregation.CountAggregatorFactory) SpecificSegmentsQuerySegmentWalker(io.druid.sql.calcite.util.SpecificSegmentsQuerySegmentWalker) QueryableIndex(io.druid.segment.QueryableIndex) PlannerConfig(io.druid.sql.calcite.planner.PlannerConfig) PlannerFactory(io.druid.sql.calcite.planner.PlannerFactory) ApproximateHistogramAggregatorFactory(io.druid.query.aggregation.histogram.ApproximateHistogramAggregatorFactory) Before(org.junit.Before)

Aggregations

PlannerConfig (io.druid.sql.calcite.planner.PlannerConfig)7 PlannerFactory (io.druid.sql.calcite.planner.PlannerFactory)6 DruidOperatorTable (io.druid.sql.calcite.planner.DruidOperatorTable)5 SchemaPlus (org.apache.calcite.schema.SchemaPlus)5 Before (org.junit.Before)4 AggregatorFactory (io.druid.query.aggregation.AggregatorFactory)2 CountAggregatorFactory (io.druid.query.aggregation.CountAggregatorFactory)2 QueryableIndex (io.druid.segment.QueryableIndex)2 SpecificSegmentsQuerySegmentWalker (io.druid.sql.calcite.util.SpecificSegmentsQuerySegmentWalker)2 LinearShardSpec (io.druid.timeline.partition.LinearShardSpec)2 BenchmarkDataGenerator (io.druid.benchmark.datagen.BenchmarkDataGenerator)1 BenchmarkSchemaInfo (io.druid.benchmark.datagen.BenchmarkSchemaInfo)1 InputRow (io.druid.data.input.InputRow)1 QueryRunnerFactoryConglomerate (io.druid.query.QueryRunnerFactoryConglomerate)1 TableDataSource (io.druid.query.TableDataSource)1 DoubleSumAggregatorFactory (io.druid.query.aggregation.DoubleSumAggregatorFactory)1 FilteredAggregatorFactory (io.druid.query.aggregation.FilteredAggregatorFactory)1 ApproximateHistogramAggregatorFactory (io.druid.query.aggregation.histogram.ApproximateHistogramAggregatorFactory)1 ApproximateHistogramDruidModule (io.druid.query.aggregation.histogram.ApproximateHistogramDruidModule)1 ApproximateHistogramFoldingAggregatorFactory (io.druid.query.aggregation.histogram.ApproximateHistogramFoldingAggregatorFactory)1