use of io.prestosql.sql.planner.RuleStatsRecorder in project hetu-core by openlookeng.
the class TestEliminateSorts method assertUnitPlan.
private void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getQueryRunner().getMetadata()), new AddExchanges(getQueryRunner().getMetadata(), new TypeAnalyzer(new SqlParser(), getQueryRunner().getMetadata()), true), new PruneUnreferencedOutputs(), new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections())));
assertPlan(sql, pattern, optimizers);
}
use of io.prestosql.sql.planner.RuleStatsRecorder in project hetu-core by openlookeng.
the class TestOptimizeMixedDistinctAggregations method assertUnitPlan.
private void assertUnitPlan(String sql, PlanMatchPattern pattern) {
List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getQueryRunner().getMetadata()), 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(getMetadata())), new OptimizeMixedDistinctAggregations(getQueryRunner().getMetadata()), new PruneUnreferencedOutputs());
assertPlan(sql, pattern, optimizers);
}
use of io.prestosql.sql.planner.RuleStatsRecorder in project hetu-core by openlookeng.
the class TestSetFlatteningOptimizer method assertPlan.
@Override
protected void assertPlan(String sql, PlanMatchPattern pattern) {
List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(getQueryRunner().getMetadata()), new PruneUnreferencedOutputs(), new IterativeOptimizer(new RuleStatsRecorder(), getQueryRunner().getStatsCalculator(), getQueryRunner().getEstimatedExchangesCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections())), new SetFlatteningOptimizer());
assertPlan(sql, pattern, optimizers);
}
use of io.prestosql.sql.planner.RuleStatsRecorder in project hetu-core by openlookeng.
the class BasePlanTest method assertMinimallyOptimizedPlan.
protected void assertMinimallyOptimizedPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(queryRunner.getMetadata()), new PruneUnreferencedOutputs(), new IterativeOptimizer(new RuleStatsRecorder(), queryRunner.getStatsCalculator(), queryRunner.getCostCalculator(), ImmutableSet.of(new RemoveRedundantIdentityProjections())));
assertPlan(sql, LogicalPlanner.Stage.OPTIMIZED, pattern, optimizers);
}
use of io.prestosql.sql.planner.RuleStatsRecorder in project hetu-core by openlookeng.
the class TestIterativeOptimizer method optimizerTimeoutsOnNonConvergingPlan.
@Test(timeOut = 1000)
public void optimizerTimeoutsOnNonConvergingPlan() {
PlanOptimizer optimizer = new IterativeOptimizer(new RuleStatsRecorder(), queryRunner.getStatsCalculator(), queryRunner.getCostCalculator(), ImmutableSet.of(new NonConvergingRule()));
try {
queryRunner.inTransaction(transactionSession -> {
queryRunner.createPlan(transactionSession, "SELECT * FROM nation", ImmutableList.of(optimizer), WarningCollector.NOOP);
fail("The optimizer should not converge");
return null;
});
} catch (PrestoException ex) {
assertEquals(ex.getErrorCode(), OPTIMIZER_TIMEOUT.toErrorCode());
}
}
Aggregations