use of com.facebook.presto.sql.planner.iterative.IterativeOptimizer 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);
}
use of com.facebook.presto.sql.planner.iterative.IterativeOptimizer in project presto by prestodb.
the class TestPlannerWarnings method createPlan.
private static Plan createPlan(LocalQueryRunner queryRunner, Session session, String sql, WarningCollector warningCollector, List<Rule<?>> rules) {
// Warnings from testing rules will be added
PlanOptimizer optimizer = new IterativeOptimizer(new RuleStatsRecorder(), queryRunner.getStatsCalculator(), queryRunner.getCostCalculator(), ImmutableSet.copyOf(rules));
// Translate all OriginalExpression in planNodes to RowExpression so that we can do plan pattern asserting and printing on RowExpression only.
PlanOptimizer expressionTranslator = new IterativeOptimizer(new RuleStatsRecorder(), queryRunner.getStatsCalculator(), queryRunner.getCostCalculator(), ImmutableSet.copyOf(new TranslateExpressions(queryRunner.getMetadata(), queryRunner.getSqlParser()).rules()));
return queryRunner.createPlan(session, sql, ImmutableList.of(optimizer, expressionTranslator), LogicalPlanner.Stage.OPTIMIZED_AND_VALIDATED, warningCollector);
}
use of com.facebook.presto.sql.planner.iterative.IterativeOptimizer 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);
}
use of com.facebook.presto.sql.planner.iterative.IterativeOptimizer 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);
}
use of com.facebook.presto.sql.planner.iterative.IterativeOptimizer 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);
}
Aggregations