Search in sources :

Example 1 with PlanOptimizers

use of com.facebook.presto.sql.planner.PlanOptimizers in project presto by prestodb.

the class LocalQueryRunner method createPlan.

public Plan createPlan(Session session, @Language("SQL") String sql, LogicalPlanner.Stage stage) {
    Statement statement = unwrapExecuteStatement(sqlParser.createStatement(sql), sqlParser, session);
    assertFormattedSql(sqlParser, statement);
    FeaturesConfig featuresConfig = new FeaturesConfig().setDistributedIndexJoinsEnabled(false).setOptimizeHashGeneration(true);
    PlanOptimizers planOptimizers = new PlanOptimizers(metadata, sqlParser, featuresConfig, true, new MBeanExporter(new TestingMBeanServer()));
    return createPlan(session, sql, planOptimizers.get(), stage);
}
Also used : TestingMBeanServer(org.weakref.jmx.testing.TestingMBeanServer) SqlQueryManager.unwrapExecuteStatement(com.facebook.presto.execution.SqlQueryManager.unwrapExecuteStatement) Statement(com.facebook.presto.sql.tree.Statement) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) MBeanExporter(org.weakref.jmx.MBeanExporter) PlanOptimizers(com.facebook.presto.sql.planner.PlanOptimizers)

Example 2 with PlanOptimizers

use of com.facebook.presto.sql.planner.PlanOptimizers in project presto by prestodb.

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);
    List<PlanOptimizer> optimizers = new PlanOptimizers(metadata, sqlParser, forceSingleNode, new MBeanExporter(new TestingMBeanServer()), queryRunner.getSplitManager(), queryRunner.getPlanOptimizerManager(), queryRunner.getPageSourceManager(), queryRunner.getStatsCalculator(), costCalculator, new CostCalculatorWithEstimatedExchanges(costCalculator, taskCountEstimator), new CostComparator(featuresConfig), taskCountEstimator, new PartitioningProviderManager()).getPlanningTimeOptimizers();
    return new QueryExplainer(optimizers, new PlanFragmenter(metadata, queryRunner.getNodePartitioningManager(), new QueryManagerConfig(), sqlParser, new FeaturesConfig()), metadata, queryRunner.getAccessControl(), sqlParser, queryRunner.getStatsCalculator(), costCalculator, ImmutableMap.of(), new PlanChecker(new FeaturesConfig(), false));
}
Also used : TaskCountEstimator(com.facebook.presto.cost.TaskCountEstimator) CostComparator(com.facebook.presto.cost.CostComparator) PlanOptimizer(com.facebook.presto.sql.planner.optimizations.PlanOptimizer) TestingMBeanServer(org.weakref.jmx.testing.TestingMBeanServer) QueryExplainer(com.facebook.presto.sql.analyzer.QueryExplainer) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) MBeanExporter(org.weakref.jmx.MBeanExporter) PartitioningProviderManager(com.facebook.presto.sql.planner.PartitioningProviderManager) Metadata(com.facebook.presto.metadata.Metadata) PlanFragmenter(com.facebook.presto.sql.planner.PlanFragmenter) CostCalculator(com.facebook.presto.cost.CostCalculator) PlanChecker(com.facebook.presto.sql.planner.sanity.PlanChecker) PlanOptimizers(com.facebook.presto.sql.planner.PlanOptimizers) QueryManagerConfig(com.facebook.presto.execution.QueryManagerConfig) CostCalculatorUsingExchanges(com.facebook.presto.cost.CostCalculatorUsingExchanges) CostCalculatorWithEstimatedExchanges(com.facebook.presto.cost.CostCalculatorWithEstimatedExchanges)

Aggregations

FeaturesConfig (com.facebook.presto.sql.analyzer.FeaturesConfig)2 PlanOptimizers (com.facebook.presto.sql.planner.PlanOptimizers)2 MBeanExporter (org.weakref.jmx.MBeanExporter)2 TestingMBeanServer (org.weakref.jmx.testing.TestingMBeanServer)2 CostCalculator (com.facebook.presto.cost.CostCalculator)1 CostCalculatorUsingExchanges (com.facebook.presto.cost.CostCalculatorUsingExchanges)1 CostCalculatorWithEstimatedExchanges (com.facebook.presto.cost.CostCalculatorWithEstimatedExchanges)1 CostComparator (com.facebook.presto.cost.CostComparator)1 TaskCountEstimator (com.facebook.presto.cost.TaskCountEstimator)1 QueryManagerConfig (com.facebook.presto.execution.QueryManagerConfig)1 SqlQueryManager.unwrapExecuteStatement (com.facebook.presto.execution.SqlQueryManager.unwrapExecuteStatement)1 Metadata (com.facebook.presto.metadata.Metadata)1 QueryExplainer (com.facebook.presto.sql.analyzer.QueryExplainer)1 PartitioningProviderManager (com.facebook.presto.sql.planner.PartitioningProviderManager)1 PlanFragmenter (com.facebook.presto.sql.planner.PlanFragmenter)1 PlanOptimizer (com.facebook.presto.sql.planner.optimizations.PlanOptimizer)1 PlanChecker (com.facebook.presto.sql.planner.sanity.PlanChecker)1 Statement (com.facebook.presto.sql.tree.Statement)1