Search in sources :

Example 1 with QueryPreparer

use of com.facebook.presto.execution.QueryPreparer in project presto by prestodb.

the class LocalQueryRunner method createPlan.

public Plan createPlan(Session session, @Language("SQL") String sql, List<PlanOptimizer> optimizers, LogicalPlanner.Stage stage, WarningCollector warningCollector) {
    Statement wrappedStatement = sqlParser.createStatement(sql, createParsingOptions(session, warningCollector));
    PreparedQuery preparedQuery = new QueryPreparer(sqlParser).prepareQuery(session, wrappedStatement, warningCollector);
    assertFormattedSql(sqlParser, createParsingOptions(session), preparedQuery.getStatement());
    PlanNodeIdAllocator idAllocator = new PlanNodeIdAllocator();
    QueryExplainer queryExplainer = new QueryExplainer(optimizers, planFragmenter, metadata, accessControl, sqlParser, statsCalculator, costCalculator, dataDefinitionTask, distributedPlanChecker);
    Analyzer analyzer = new Analyzer(session, metadata, sqlParser, accessControl, Optional.of(queryExplainer), preparedQuery.getParameters(), warningCollector);
    LogicalPlanner logicalPlanner = new LogicalPlanner(wrappedStatement instanceof Explain, session, optimizers, singleNodePlanChecker, idAllocator, metadata, sqlParser, statsCalculator, costCalculator, warningCollector);
    Analysis analysis = analyzer.analyze(preparedQuery.getStatement());
    return logicalPlanner.plan(analysis, stage);
}
Also used : QueryPreparer(com.facebook.presto.execution.QueryPreparer) QueryExplainer(com.facebook.presto.sql.analyzer.QueryExplainer) LogicalPlanner(com.facebook.presto.sql.planner.LogicalPlanner) PlanNodeIdAllocator(com.facebook.presto.spi.plan.PlanNodeIdAllocator) Statement(com.facebook.presto.sql.tree.Statement) Analysis(com.facebook.presto.sql.analyzer.Analysis) Explain(com.facebook.presto.sql.tree.Explain) PreparedQuery(com.facebook.presto.execution.QueryPreparer.PreparedQuery) Analyzer(com.facebook.presto.sql.analyzer.Analyzer)

Example 2 with QueryPreparer

use of com.facebook.presto.execution.QueryPreparer in project presto by prestodb.

the class LocalQueryRunner method createPlan.

public Plan createPlan(Session session, @Language("SQL") String sql, LogicalPlanner.Stage stage, boolean forceSingleNode, WarningCollector warningCollector) {
    PreparedQuery preparedQuery = new QueryPreparer(sqlParser).prepareQuery(session, sql, warningCollector);
    assertFormattedSql(sqlParser, createParsingOptions(session), preparedQuery.getStatement());
    return createPlan(session, sql, getPlanOptimizers(forceSingleNode), stage, warningCollector);
}
Also used : QueryPreparer(com.facebook.presto.execution.QueryPreparer) PreparedQuery(com.facebook.presto.execution.QueryPreparer.PreparedQuery)

Aggregations

QueryPreparer (com.facebook.presto.execution.QueryPreparer)2 PreparedQuery (com.facebook.presto.execution.QueryPreparer.PreparedQuery)2 PlanNodeIdAllocator (com.facebook.presto.spi.plan.PlanNodeIdAllocator)1 Analysis (com.facebook.presto.sql.analyzer.Analysis)1 Analyzer (com.facebook.presto.sql.analyzer.Analyzer)1 QueryExplainer (com.facebook.presto.sql.analyzer.QueryExplainer)1 LogicalPlanner (com.facebook.presto.sql.planner.LogicalPlanner)1 Explain (com.facebook.presto.sql.tree.Explain)1 Statement (com.facebook.presto.sql.tree.Statement)1