Search in sources :

Example 1 with InputExtractor

use of io.prestosql.sql.planner.InputExtractor in project hetu-core by openlookeng.

the class SqlQueryExecution method doAnalyzeQuery.

private PlanRoot doAnalyzeQuery() {
    // time analysis phase
    stateMachine.beginAnalysis();
    stateMachine.beginLogicalPlan();
    // plan query
    PlanNodeIdAllocator idAllocator = new PlanNodeIdAllocator();
    Plan plan = createPlan(analysis, stateMachine.getSession(), planOptimizers, idAllocator, metadata, new TypeAnalyzer(sqlParser, metadata), statsCalculator, costCalculator, stateMachine.getWarningCollector());
    queryPlan.set(plan);
    // extract inputs
    List<Input> inputs = new InputExtractor(metadata, stateMachine.getSession()).extractInputs(plan.getRoot());
    stateMachine.setInputs(inputs);
    // extract output
    stateMachine.setOutput(analysis.getTarget());
    stateMachine.endLogicalPlan();
    // fragment the plan
    SubPlan fragmentedPlan = planFragmenter.createSubPlans(stateMachine.getSession(), plan, false, stateMachine.getWarningCollector());
    // record analysis time
    stateMachine.endAnalysis();
    boolean explainAnalyze = analysis.getStatement() instanceof Explain && ((Explain) analysis.getStatement()).isAnalyze();
    if (SystemSessionProperties.isSnapshotEnabled(getSession())) {
        checkSnapshotSupport(getSession());
    }
    return new PlanRoot(fragmentedPlan, !explainAnalyze, extractConnectors(analysis));
}
Also used : PlanNodeIdAllocator(io.prestosql.spi.plan.PlanNodeIdAllocator) Explain(io.prestosql.sql.tree.Explain) InputExtractor(io.prestosql.sql.planner.InputExtractor) SubPlan(io.prestosql.sql.planner.SubPlan) Plan(io.prestosql.sql.planner.Plan) StageExecutionPlan(io.prestosql.sql.planner.StageExecutionPlan) CachedSqlQueryExecutionPlan(io.prestosql.query.CachedSqlQueryExecutionPlan) TypeAnalyzer(io.prestosql.sql.planner.TypeAnalyzer) SubPlan(io.prestosql.sql.planner.SubPlan)

Aggregations

CachedSqlQueryExecutionPlan (io.prestosql.query.CachedSqlQueryExecutionPlan)1 PlanNodeIdAllocator (io.prestosql.spi.plan.PlanNodeIdAllocator)1 InputExtractor (io.prestosql.sql.planner.InputExtractor)1 Plan (io.prestosql.sql.planner.Plan)1 StageExecutionPlan (io.prestosql.sql.planner.StageExecutionPlan)1 SubPlan (io.prestosql.sql.planner.SubPlan)1 TypeAnalyzer (io.prestosql.sql.planner.TypeAnalyzer)1 Explain (io.prestosql.sql.tree.Explain)1