Search in sources :

Example 1 with QueryExplainer

use of io.prestosql.sql.analyzer.QueryExplainer in project boostkit-bigdata by kunpengcompute.

the class OmniLocalQueryRunner 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)

Example 2 with QueryExplainer

use of io.prestosql.sql.analyzer.QueryExplainer 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)

Example 3 with QueryExplainer

use of io.prestosql.sql.analyzer.QueryExplainer in project hetu-core by openlookeng.

the class AbstractTestQueryFramework method getQueryExplainer.

private QueryExplainer getQueryExplainer() {
    Metadata metadata = queryRunner.getMetadata();
    FeaturesConfig featuresConfig = new FeaturesConfig().setOptimizeHashGeneration(true);
    boolean forceSingleNode = queryRunner.getNodeCount() == 1;
    TaskCountEstimator taskCountEstimator = new TaskCountEstimator(queryRunner::getNodeCount);
    CostCalculator costCalculator = new CostCalculatorUsingExchanges(taskCountEstimator);
    HetuMetaStoreManager hetuMetaStoreManager = new HetuMetaStoreManager();
    List<PlanOptimizer> optimizers = new PlanOptimizers(metadata, new TypeAnalyzer(sqlParser, metadata), featuresConfig, new TaskManagerConfig(), forceSingleNode, new MBeanExporter(new TestingMBeanServer()), queryRunner.getSplitManager(), queryRunner.getPlanOptimizerManager(), queryRunner.getPageSourceManager(), queryRunner.getStatsCalculator(), costCalculator, new CostCalculatorWithEstimatedExchanges(costCalculator, taskCountEstimator), new CostComparator(featuresConfig), taskCountEstimator, new CubeManager(featuresConfig, hetuMetaStoreManager)).get();
    return new QueryExplainer(optimizers, new PlanFragmenter(metadata, queryRunner.getNodePartitioningManager(), new QueryManagerConfig()), metadata, queryRunner.getAccessControl(), sqlParser, queryRunner.getStatsCalculator(), costCalculator, ImmutableMap.of(), new HeuristicIndexerManager(null, null), new CubeManager(featuresConfig, hetuMetaStoreManager));
}
Also used : TaskCountEstimator(io.prestosql.cost.TaskCountEstimator) CostComparator(io.prestosql.cost.CostComparator) PlanOptimizer(io.prestosql.sql.planner.optimizations.PlanOptimizer) TestingMBeanServer(org.weakref.jmx.testing.TestingMBeanServer) QueryExplainer(io.prestosql.sql.analyzer.QueryExplainer) FeaturesConfig(io.prestosql.sql.analyzer.FeaturesConfig) MBeanExporter(org.weakref.jmx.MBeanExporter) HeuristicIndexerManager(io.prestosql.heuristicindex.HeuristicIndexerManager) Metadata(io.prestosql.metadata.Metadata) PlanFragmenter(io.prestosql.sql.planner.PlanFragmenter) TaskManagerConfig(io.prestosql.execution.TaskManagerConfig) TypeAnalyzer(io.prestosql.sql.planner.TypeAnalyzer) CubeManager(io.prestosql.cube.CubeManager) CostCalculator(io.prestosql.cost.CostCalculator) PlanOptimizers(io.prestosql.sql.planner.PlanOptimizers) QueryManagerConfig(io.prestosql.execution.QueryManagerConfig) CostCalculatorUsingExchanges(io.prestosql.cost.CostCalculatorUsingExchanges) CostCalculatorWithEstimatedExchanges(io.prestosql.cost.CostCalculatorWithEstimatedExchanges) HetuMetaStoreManager(io.prestosql.metastore.HetuMetaStoreManager)

Aggregations

QueryExplainer (io.prestosql.sql.analyzer.QueryExplainer)3 TypeAnalyzer (io.prestosql.sql.planner.TypeAnalyzer)3 QueryPreparer (io.prestosql.execution.QueryPreparer)2 PreparedQuery (io.prestosql.execution.QueryPreparer.PreparedQuery)2 PlanNodeIdAllocator (io.prestosql.spi.plan.PlanNodeIdAllocator)2 Analysis (io.prestosql.sql.analyzer.Analysis)2 Analyzer (io.prestosql.sql.analyzer.Analyzer)2 LogicalPlanner (io.prestosql.sql.planner.LogicalPlanner)2 PlanSanityChecker (io.prestosql.sql.planner.sanity.PlanSanityChecker)2 CostCalculator (io.prestosql.cost.CostCalculator)1 CostCalculatorUsingExchanges (io.prestosql.cost.CostCalculatorUsingExchanges)1 CostCalculatorWithEstimatedExchanges (io.prestosql.cost.CostCalculatorWithEstimatedExchanges)1 CostComparator (io.prestosql.cost.CostComparator)1 TaskCountEstimator (io.prestosql.cost.TaskCountEstimator)1 CubeManager (io.prestosql.cube.CubeManager)1 QueryManagerConfig (io.prestosql.execution.QueryManagerConfig)1 TaskManagerConfig (io.prestosql.execution.TaskManagerConfig)1 HeuristicIndexerManager (io.prestosql.heuristicindex.HeuristicIndexerManager)1 Metadata (io.prestosql.metadata.Metadata)1 HetuMetaStoreManager (io.prestosql.metastore.HetuMetaStoreManager)1