use of com.facebook.presto.sql.planner.InputExtractor in project presto by prestodb.
the class SqlQueryExecution method doAnalyzeQuery.
private PlanRoot doAnalyzeQuery() {
// time analysis phase
long analysisStart = System.nanoTime();
// analyze query
Analyzer analyzer = new Analyzer(stateMachine.getSession(), metadata, sqlParser, accessControl, Optional.of(queryExplainer), parameters);
Analysis analysis = analyzer.analyze(statement);
stateMachine.setUpdateType(analysis.getUpdateType());
// plan query
PlanNodeIdAllocator idAllocator = new PlanNodeIdAllocator();
LogicalPlanner logicalPlanner = new LogicalPlanner(stateMachine.getSession(), planOptimizers, idAllocator, metadata, sqlParser);
Plan plan = logicalPlanner.plan(analysis);
// extract inputs
List<Input> inputs = new InputExtractor(metadata, stateMachine.getSession()).extractInputs(plan.getRoot());
stateMachine.setInputs(inputs);
// extract output
Optional<Output> output = new OutputExtractor().extractOutput(plan.getRoot());
stateMachine.setOutput(output);
// fragment the plan
SubPlan subplan = PlanFragmenter.createSubPlans(stateMachine.getSession(), metadata, plan);
// record analysis time
stateMachine.recordAnalysisTime(analysisStart);
boolean explainAnalyze = analysis.getStatement() instanceof Explain && ((Explain) analysis.getStatement()).isAnalyze();
return new PlanRoot(subplan, !explainAnalyze, extractConnectors(analysis));
}
Aggregations