use of io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections in project trino by trinodb.
the class TestIterativeOptimizer method optimizerTimeoutsOnNonConvergingPlan.
@Test(timeOut = 10_000)
public void optimizerTimeoutsOnNonConvergingPlan() {
PlanOptimizer optimizer = new IterativeOptimizer(queryRunner.getPlannerContext(), new RuleStatsRecorder(), queryRunner.getStatsCalculator(), queryRunner.getCostCalculator(), ImmutableSet.of(new AddIdentityOverTableScan(), new RemoveRedundantIdentityProjections()));
assertTrinoExceptionThrownBy(() -> queryRunner.inTransaction(transactionSession -> queryRunner.createPlan(transactionSession, "SELECT nationkey FROM nation", ImmutableList.of(optimizer), WarningCollector.NOOP))).hasErrorCode(OPTIMIZER_TIMEOUT).hasMessageMatching("The optimizer exhausted the time limit of 1 ms: (no rules invoked|(?s)Top rules:.*(RemoveRedundantIdentityProjections|AddIdentityOverTableScan).*)");
}
use of io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections 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);
}
use of io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections 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);
}
use of io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections 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);
}
use of io.trino.sql.planner.iterative.rule.RemoveRedundantIdentityProjections 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);
}
Aggregations