Extract BasePlanTest#assertPlan
@@ -93,20 +93,14 @@ public class BasePlanTest
protected void assertPlan(String sql, LogicalPlanner.Stage stage, PlanMatchPattern pattern)
{
- queryRunner.inTransaction(transactionSession -> {
- Plan actualPlan = queryRunner.createPlan(transactionSession, sql, stage);
- PlanAssert.assertPlan(transactionSession, queryRunner.getMetadata(), queryRunner.getCostCalculator(), actualPlan, pattern);
- return null;
- });
+ List<PlanOptimizer> optimizers = queryRunner.getPlanOptimizers(true);
+
+ assertPlan(sql, stage, pattern, optimizers);
}
protected void assertPlanWithOptimizers(String sql, PlanMatchPattern pattern, List<PlanOptimizer> optimizers)
{
- queryRunner.inTransaction(transactionSession -> {
- Plan actualPlan = queryRunner.createPlan(transactionSession, sql, optimizers, LogicalPlanner.Stage.OPTIMIZED);
- PlanAssert.assertPlan(transactionSession, queryRunner.getMetadata(), queryRunner.getCostCalculator(), actualPlan, pattern);
- return null;
- });
+ assertPlan(sql, LogicalPlanner.Stage.OPTIMIZED, pattern, optimizers);
}
protected void assertPlanWithOptimizerFiltering(String sql, LogicalPlanner.Stage stage, PlanMatchPattern pattern, Predicate<PlanOptimizer> optimizerPredicate)
@@ -115,6 +109,11 @@ public class BasePlanTest
.filter(optimizerPredicate)
.collect(toList());
+ assertPlan(sql, stage, pattern, optimizers);
+ }
+
+ protected void assertPlan(String sql, LogicalPlanner.Stage stage, PlanMatchPattern pattern, List<PlanOptimizer> optimizers)
+ {
queryRunner.inTransaction(transactionSession -> {
Plan actualPlan = queryRunner.createPlan(transactionSession, sql, optimizers, stage);
PlanAssert.assertPlan(transactionSession, queryRunner.getMetadata(), queryRunner.getCostCalculator(), actualPlan, pattern);
