Search in sources :

Example 6 with DruidPlanner

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

the class DruidStatement method prepare.

public DruidStatement prepare(final PlannerFactory plannerFactory, final String query, final long maxRowCount) {
    try (final DruidPlanner planner = plannerFactory.createPlanner(queryContext)) {
        synchronized (lock) {
            ensure(State.NEW);
            this.plannerResult = planner.plan(query);
            this.maxRowCount = maxRowCount;
            this.query = query;
            this.signature = Meta.Signature.create(createColumnMetaData(plannerResult.rowType()), query, new ArrayList<AvaticaParameter>(), Meta.CursorFactory.ARRAY, // We only support SELECT
            Meta.StatementType.SELECT);
            this.state = State.PREPARED;
        }
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
    return this;
}
Also used : DruidPlanner(io.druid.sql.calcite.planner.DruidPlanner) ArrayList(java.util.ArrayList) IOException(java.io.IOException)

Aggregations

DruidPlanner (io.druid.sql.calcite.planner.DruidPlanner)6 PlannerResult (io.druid.sql.calcite.planner.PlannerResult)5 FilteredAggregatorFactory (io.druid.query.aggregation.FilteredAggregatorFactory)2 PostAggregator (io.druid.query.aggregation.PostAggregator)2 QuantilePostAggregator (io.druid.query.aggregation.histogram.QuantilePostAggregator)2 NotDimFilter (io.druid.query.filter.NotDimFilter)2 SelectorDimFilter (io.druid.query.filter.SelectorDimFilter)2 MultipleIntervalSegmentSpec (io.druid.query.spec.MultipleIntervalSegmentSpec)2 IOException (java.io.IOException)2 Test (org.junit.Test)2 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 ISE (io.druid.java.util.common.ISE)1 QueryInterruptedException (io.druid.query.QueryInterruptedException)1 ApproximateHistogramAggregatorFactory (io.druid.query.aggregation.histogram.ApproximateHistogramAggregatorFactory)1 ApproximateHistogramFoldingAggregatorFactory (io.druid.query.aggregation.histogram.ApproximateHistogramFoldingAggregatorFactory)1 DruidOperatorTable (io.druid.sql.calcite.planner.DruidOperatorTable)1 PlannerConfig (io.druid.sql.calcite.planner.PlannerConfig)1 PlannerFactory (io.druid.sql.calcite.planner.PlannerFactory)1 DruidSchema (io.druid.sql.calcite.schema.DruidSchema)1 OutputStream (java.io.OutputStream)1