Search in sources :

Example 6 with RuleStatsRecorder

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

the class TestOptimizeMixedDistinctAggregations method assertUnitPlan.

private void assertUnitPlan(String sql, PlanMatchPattern pattern) {
    List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getMetadata().getFunctionAndTypeManager()), new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections(), new SingleDistinctAggregationToGroupBy(), new MultipleDistinctAggregationToMarkDistinct())), new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), new TranslateExpressions(getQueryRunner().getMetadata(), getQueryRunner().getSqlParser()).rules()), new OptimizeMixedDistinctAggregations(getQueryRunner().getMetadata()), new PruneUnreferencedOutputs());
    assertPlan(sql, pattern, optimizers);
}
Also used : RuleStatsRecorder(com.facebook.presto.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) MultipleDistinctAggregationToMarkDistinct(com.facebook.presto.sql.planner.iterative.rule.MultipleDistinctAggregationToMarkDistinct) IterativeOptimizer(com.facebook.presto.sql.planner.iterative.IterativeOptimizer) TranslateExpressions(com.facebook.presto.sql.planner.iterative.rule.TranslateExpressions) SingleDistinctAggregationToGroupBy(com.facebook.presto.sql.planner.iterative.rule.SingleDistinctAggregationToGroupBy)

Example 7 with RuleStatsRecorder

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

the class TestSetFlatteningOptimizer method assertPlan.

public void assertPlan(String sql, PlanMatchPattern pattern) {
    List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getMetadata().getFunctionAndTypeManager()), new PruneUnreferencedOutputs(), new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections())), new SetFlatteningOptimizer());
    assertPlan(sql, pattern, optimizers);
}
Also used : RuleStatsRecorder(com.facebook.presto.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) IterativeOptimizer(com.facebook.presto.sql.planner.iterative.IterativeOptimizer)

Example 8 with RuleStatsRecorder

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

the class TestEliminateSorts method assertUnitPlan.

public void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
    List<PlanOptimizer> optimizers = ImmutableList.of(new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), new TranslateExpressions(getMetadata(), new SqlParser()).rules()), new AddExchanges(getQueryRunner().getMetadata(), new SqlParser(), new PartitioningProviderManager()), new UnaliasSymbolReferences(getMetadata().getFunctionAndTypeManager()), new PruneUnreferencedOutputs(), new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections())));
    assertPlan(sql, pattern, optimizers);
}
Also used : RuleStatsRecorder(com.facebook.presto.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) PartitioningProviderManager(com.facebook.presto.sql.planner.PartitioningProviderManager) IterativeOptimizer(com.facebook.presto.sql.planner.iterative.IterativeOptimizer) SqlParser(com.facebook.presto.sql.parser.SqlParser) TranslateExpressions(com.facebook.presto.sql.planner.iterative.rule.TranslateExpressions)

Aggregations

RuleStatsRecorder (com.facebook.presto.sql.planner.RuleStatsRecorder)8 IterativeOptimizer (com.facebook.presto.sql.planner.iterative.IterativeOptimizer)7 RemoveRedundantIdentityProjections (com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections)6 TranslateExpressions (com.facebook.presto.sql.planner.iterative.rule.TranslateExpressions)5 SqlParser (com.facebook.presto.sql.parser.SqlParser)3 PlanOptimizer (com.facebook.presto.sql.planner.optimizations.PlanOptimizer)3 PrestoException (com.facebook.presto.spi.PrestoException)1 PartitioningProviderManager (com.facebook.presto.sql.planner.PartitioningProviderManager)1 GatherAndMergeWindows (com.facebook.presto.sql.planner.iterative.rule.GatherAndMergeWindows)1 MultipleDistinctAggregationToMarkDistinct (com.facebook.presto.sql.planner.iterative.rule.MultipleDistinctAggregationToMarkDistinct)1 SingleDistinctAggregationToGroupBy (com.facebook.presto.sql.planner.iterative.rule.SingleDistinctAggregationToGroupBy)1 PruneUnreferencedOutputs (com.facebook.presto.sql.planner.optimizations.PruneUnreferencedOutputs)1 UnaliasSymbolReferences (com.facebook.presto.sql.planner.optimizations.UnaliasSymbolReferences)1 Test (org.testng.annotations.Test)1