Search in sources :

Example 1 with IterativeOptimizer

use of io.trino.sql.planner.iterative.IterativeOptimizer in project trino by trinodb.

the class TestOptimizeMixedDistinctAggregations method assertUnitPlan.

private void assertUnitPlan(String sql, PlanMatchPattern pattern) {
    List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getQueryRunner().getMetadata()), new IterativeOptimizer(getQueryRunner().getPlannerContext(), new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections(), new SingleDistinctAggregationToGroupBy(), new MultipleDistinctAggregationToMarkDistinct())), new OptimizeMixedDistinctAggregations(getQueryRunner().getMetadata()), new IterativeOptimizer(getQueryRunner().getPlannerContext(), new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), ImmutableSet.<Rule<?>>builder().add(new RemoveRedundantIdentityProjections()).addAll(columnPruningRules(getQueryRunner().getMetadata())).build()));
    assertPlan(sql, pattern, optimizers);
}
Also used : RuleStatsRecorder(io.trino.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) MultipleDistinctAggregationToMarkDistinct(io.trino.sql.planner.iterative.rule.MultipleDistinctAggregationToMarkDistinct) IterativeOptimizer(io.trino.sql.planner.iterative.IterativeOptimizer) SingleDistinctAggregationToGroupBy(io.trino.sql.planner.iterative.rule.SingleDistinctAggregationToGroupBy)

Example 2 with IterativeOptimizer

use of io.trino.sql.planner.iterative.IterativeOptimizer in project trino by trinodb.

the class TestEliminateSorts method assertUnitPlan.

private void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
    TypeAnalyzer typeAnalyzer = createTestingTypeAnalyzer(getQueryRunner().getPlannerContext());
    List<PlanOptimizer> optimizers = ImmutableList.of(new IterativeOptimizer(getQueryRunner().getPlannerContext(), new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections(), new DetermineTableScanNodePartitioning(getQueryRunner().getMetadata(), getQueryRunner().getNodePartitioningManager(), new TaskCountEstimator(() -> 10)))), new AddExchanges(getQueryRunner().getPlannerContext(), typeAnalyzer, getQueryRunner().getStatsCalculator()));
    assertPlan(sql, pattern, optimizers);
}
Also used : TaskCountEstimator(io.trino.cost.TaskCountEstimator) RuleStatsRecorder(io.trino.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) IterativeOptimizer(io.trino.sql.planner.iterative.IterativeOptimizer) DetermineTableScanNodePartitioning(io.trino.sql.planner.iterative.rule.DetermineTableScanNodePartitioning) TypeAnalyzer.createTestingTypeAnalyzer(io.trino.sql.planner.TypeAnalyzer.createTestingTypeAnalyzer) TypeAnalyzer(io.trino.sql.planner.TypeAnalyzer)

Example 3 with IterativeOptimizer

use of io.trino.sql.planner.iterative.IterativeOptimizer in project trino by trinodb.

the class TestSetFlattening method assertPlan.

@Override
protected void assertPlan(String sql, PlanMatchPattern pattern) {
    List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getQueryRunner().getMetadata()), new IterativeOptimizer(getQueryRunner().getPlannerContext(), new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), ImmutableSet.<Rule<?>>builder().add(new RemoveRedundantIdentityProjections()).add(new MergeUnion()).add(new MergeIntersect()).add(new MergeExcept()).add(new PruneDistinctAggregation()).addAll(columnPruningRules(getQueryRunner().getMetadata())).build()));
    assertPlan(sql, pattern, optimizers);
}
Also used : MergeExcept(io.trino.sql.planner.iterative.rule.MergeExcept) RuleStatsRecorder(io.trino.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) PruneDistinctAggregation(io.trino.sql.planner.iterative.rule.PruneDistinctAggregation) IterativeOptimizer(io.trino.sql.planner.iterative.IterativeOptimizer) MergeIntersect(io.trino.sql.planner.iterative.rule.MergeIntersect) MergeUnion(io.trino.sql.planner.iterative.rule.MergeUnion)

Example 4 with IterativeOptimizer

use of io.trino.sql.planner.iterative.IterativeOptimizer in project trino by trinodb.

the class TestMergeWindows method assertUnitPlan.

private void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
    List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getQueryRunner().getMetadata()), new IterativeOptimizer(getQueryRunner().getPlannerContext(), new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), ImmutableSet.<Rule<?>>builder().add(new RemoveRedundantIdentityProjections()).addAll(GatherAndMergeWindows.rules()).addAll(columnPruningRules(getQueryRunner().getMetadata())).build()));
    assertPlan(sql, pattern, optimizers);
}
Also used : RuleStatsRecorder(io.trino.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) IterativeOptimizer(io.trino.sql.planner.iterative.IterativeOptimizer) Rule(io.trino.sql.planner.iterative.Rule)

Example 5 with IterativeOptimizer

use of io.trino.sql.planner.iterative.IterativeOptimizer in project trino by trinodb.

the class TestReorderWindows method assertUnitPlan.

private void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
    List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getQueryRunner().getMetadata()), new PredicatePushDown(getQueryRunner().getPlannerContext(), createTestingTypeAnalyzer(getQueryRunner().getPlannerContext()), false, false), new IterativeOptimizer(getQueryRunner().getPlannerContext(), new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), ImmutableSet.<Rule<?>>builder().add(new RemoveRedundantIdentityProjections()).add(new GatherAndMergeWindows.SwapAdjacentWindowsBySpecifications(0)).add(new GatherAndMergeWindows.SwapAdjacentWindowsBySpecifications(1)).add(new GatherAndMergeWindows.SwapAdjacentWindowsBySpecifications(2)).addAll(columnPruningRules(getQueryRunner().getMetadata())).build()));
    assertPlan(sql, pattern, optimizers);
}
Also used : GatherAndMergeWindows(io.trino.sql.planner.iterative.rule.GatherAndMergeWindows) RuleStatsRecorder(io.trino.sql.planner.RuleStatsRecorder) RemoveRedundantIdentityProjections(io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections) IterativeOptimizer(io.trino.sql.planner.iterative.IterativeOptimizer) Rule(io.trino.sql.planner.iterative.Rule)

Aggregations

RuleStatsRecorder (io.trino.sql.planner.RuleStatsRecorder)6 IterativeOptimizer (io.trino.sql.planner.iterative.IterativeOptimizer)6 RemoveRedundantIdentityProjections (io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections)6 Rule (io.trino.sql.planner.iterative.Rule)2 TaskCountEstimator (io.trino.cost.TaskCountEstimator)1 TypeAnalyzer (io.trino.sql.planner.TypeAnalyzer)1 TypeAnalyzer.createTestingTypeAnalyzer (io.trino.sql.planner.TypeAnalyzer.createTestingTypeAnalyzer)1 DetermineTableScanNodePartitioning (io.trino.sql.planner.iterative.rule.DetermineTableScanNodePartitioning)1 GatherAndMergeWindows (io.trino.sql.planner.iterative.rule.GatherAndMergeWindows)1 MergeExcept (io.trino.sql.planner.iterative.rule.MergeExcept)1 MergeIntersect (io.trino.sql.planner.iterative.rule.MergeIntersect)1 MergeUnion (io.trino.sql.planner.iterative.rule.MergeUnion)1 MultipleDistinctAggregationToMarkDistinct (io.trino.sql.planner.iterative.rule.MultipleDistinctAggregationToMarkDistinct)1 PruneDistinctAggregation (io.trino.sql.planner.iterative.rule.PruneDistinctAggregation)1 SingleDistinctAggregationToGroupBy (io.trino.sql.planner.iterative.rule.SingleDistinctAggregationToGroupBy)1 PlanOptimizer (io.trino.sql.planner.optimizations.PlanOptimizer)1 UnaliasSymbolReferences (io.trino.sql.planner.optimizations.UnaliasSymbolReferences)1