Search in sources :

Example 6 with RemoveRedundantIdentityProjections

use of io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections 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)

Example 7 with RemoveRedundantIdentityProjections

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

the class BasePlanTest method assertMinimallyOptimizedPlan.

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

Aggregations

RuleStatsRecorder (io.trino.sql.planner.RuleStatsRecorder)7 RemoveRedundantIdentityProjections (io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections)7 IterativeOptimizer (io.trino.sql.planner.iterative.IterativeOptimizer)6 Rule (io.trino.sql.planner.iterative.Rule)2 PlanOptimizer (io.trino.sql.planner.optimizations.PlanOptimizer)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Session (io.trino.Session)1 TaskCountEstimator (io.trino.cost.TaskCountEstimator)1 WarningCollector (io.trino.execution.warnings.WarningCollector)1 Captures (io.trino.matching.Captures)1 Pattern (io.trino.matching.Pattern)1 TpchConnectorFactory (io.trino.plugin.tpch.TpchConnectorFactory)1 OPTIMIZER_TIMEOUT (io.trino.spi.StandardErrorCode.OPTIMIZER_TIMEOUT)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