Search in sources :

Example 1 with RemoveRedundantIdentityProjections

use of com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections in project presto by prestodb.

the class TestMergeWindows method assertUnitPlan.

private void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
    List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getMetadata().getFunctionAndTypeManager()), new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), new TranslateExpressions(getQueryRunner().getMetadata(), new SqlParser()).rules()), new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), ImmutableSet.<Rule<?>>builder().add(new RemoveRedundantIdentityProjections()).addAll(GatherAndMergeWindows.rules()).build()), new PruneUnreferencedOutputs());
    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) SqlParser(com.facebook.presto.sql.parser.SqlParser) TranslateExpressions(com.facebook.presto.sql.planner.iterative.rule.TranslateExpressions)

Example 2 with RemoveRedundantIdentityProjections

use of com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections in project presto by prestodb.

the class BasePlanTest method assertMinimallyOptimizedPlan.

protected void assertMinimallyOptimizedPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
    List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(queryRunner.getMetadata().getFunctionAndTypeManager()), new PruneUnreferencedOutputs(), new IterativeOptimizer(new RuleStatsRecorder(), queryRunner.getStatsCalculator(), queryRunner.getCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections())), // To avoid assert plan failure not printing out plan (#12885)
    getExpressionTranslator());
    assertPlan(sql, queryRunner.getDefaultSession(), LogicalPlanner.Stage.OPTIMIZED, pattern, optimizers);
}
Also used : PlanOptimizer(com.facebook.presto.sql.planner.optimizations.PlanOptimizer) RuleStatsRecorder(com.facebook.presto.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) PruneUnreferencedOutputs(com.facebook.presto.sql.planner.optimizations.PruneUnreferencedOutputs) IterativeOptimizer(com.facebook.presto.sql.planner.iterative.IterativeOptimizer) UnaliasSymbolReferences(com.facebook.presto.sql.planner.optimizations.UnaliasSymbolReferences)

Example 3 with RemoveRedundantIdentityProjections

use of com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections in project presto by prestodb.

the class TestReorderWindows method assertUnitPlan.

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

Example 4 with RemoveRedundantIdentityProjections

use of com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections 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 5 with RemoveRedundantIdentityProjections

use of com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections 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)

Aggregations

RuleStatsRecorder (com.facebook.presto.sql.planner.RuleStatsRecorder)6 IterativeOptimizer (com.facebook.presto.sql.planner.iterative.IterativeOptimizer)6 RemoveRedundantIdentityProjections (com.facebook.presto.sql.planner.iterative.rule.RemoveRedundantIdentityProjections)6 TranslateExpressions (com.facebook.presto.sql.planner.iterative.rule.TranslateExpressions)4 SqlParser (com.facebook.presto.sql.parser.SqlParser)3 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 PlanOptimizer (com.facebook.presto.sql.planner.optimizations.PlanOptimizer)1 PruneUnreferencedOutputs (com.facebook.presto.sql.planner.optimizations.PruneUnreferencedOutputs)1 UnaliasSymbolReferences (com.facebook.presto.sql.planner.optimizations.UnaliasSymbolReferences)1