Search in sources :

Example 1 with QueryPreparer

use of io.prestosql.execution.QueryPreparer in project hetu-core by openlookeng.

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);
    assertFormattedSql(sqlParser, createParsingOptions(session), preparedQuery.getStatement());
    return createPlan(session, sql, getPlanOptimizers(forceSingleNode), stage, warningCollector);
}
Also used : QueryPreparer(io.prestosql.execution.QueryPreparer) PreparedQuery(io.prestosql.execution.QueryPreparer.PreparedQuery)

Example 2 with QueryPreparer

use of io.prestosql.execution.QueryPreparer in project hetu-core by openlookeng.

the class LocalQueryRunner method createPlan.

public Plan createPlan(Session session, @Language("SQL") String sql, List<PlanOptimizer> optimizers, LogicalPlanner.Stage stage, WarningCollector warningCollector) {
    PreparedQuery preparedQuery = new QueryPreparer(sqlParser).prepareQuery(session, sql);
    assertFormattedSql(sqlParser, createParsingOptions(session), preparedQuery.getStatement());
    PlanNodeIdAllocator idAllocator = new PlanNodeIdAllocator();
    QueryExplainer queryExplainer = new QueryExplainer(optimizers, planFragmenter, metadata, accessControl, sqlParser, statsCalculator, costCalculator, dataDefinitionTask, heuristicIndexerManager, cubeManager);
    Analyzer analyzer = new Analyzer(session, metadata, sqlParser, accessControl, Optional.of(queryExplainer), preparedQuery.getParameters(), warningCollector, heuristicIndexerManager, cubeManager);
    LogicalPlanner logicalPlanner = new LogicalPlanner(session, optimizers, new PlanSanityChecker(true), idAllocator, metadata, new TypeAnalyzer(sqlParser, metadata), statsCalculator, costCalculator, warningCollector);
    Analysis analysis = analyzer.analyze(preparedQuery.getStatement());
    return logicalPlanner.plan(analysis, false, stage);
}
Also used : QueryPreparer(io.prestosql.execution.QueryPreparer) QueryExplainer(io.prestosql.sql.analyzer.QueryExplainer) LogicalPlanner(io.prestosql.sql.planner.LogicalPlanner) PlanNodeIdAllocator(io.prestosql.spi.plan.PlanNodeIdAllocator) Analysis(io.prestosql.sql.analyzer.Analysis) PreparedQuery(io.prestosql.execution.QueryPreparer.PreparedQuery) PlanSanityChecker(io.prestosql.sql.planner.sanity.PlanSanityChecker) TypeAnalyzer(io.prestosql.sql.planner.TypeAnalyzer) Analyzer(io.prestosql.sql.analyzer.Analyzer) TypeAnalyzer(io.prestosql.sql.planner.TypeAnalyzer)

Aggregations

QueryPreparer (io.prestosql.execution.QueryPreparer)2 PreparedQuery (io.prestosql.execution.QueryPreparer.PreparedQuery)2 PlanNodeIdAllocator (io.prestosql.spi.plan.PlanNodeIdAllocator)1 Analysis (io.prestosql.sql.analyzer.Analysis)1 Analyzer (io.prestosql.sql.analyzer.Analyzer)1 QueryExplainer (io.prestosql.sql.analyzer.QueryExplainer)1 LogicalPlanner (io.prestosql.sql.planner.LogicalPlanner)1 TypeAnalyzer (io.prestosql.sql.planner.TypeAnalyzer)1 PlanSanityChecker (io.prestosql.sql.planner.sanity.PlanSanityChecker)1