Skip to content

Commit

Permalink
Annotate sql parameter with @language
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Apr 26, 2021
1 parent 5ad6240 commit 1f2854f
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,29 +102,29 @@ protected LocalQueryRunner getQueryRunner()
return queryRunner;
}

protected void assertPlan(String sql, PlanMatchPattern pattern)
protected void assertPlan(@Language("SQL") String sql, PlanMatchPattern pattern)
{
assertPlan(sql, OPTIMIZED_AND_VALIDATED, pattern);
}

protected void assertPlan(String sql, Session session, PlanMatchPattern pattern)
protected void assertPlan(@Language("SQL") String sql, Session session, PlanMatchPattern pattern)
{
assertPlanWithSession(sql, session, true, pattern);
}

protected void assertPlan(String sql, LogicalPlanner.Stage stage, PlanMatchPattern pattern)
protected void assertPlan(@Language("SQL") String sql, LogicalPlanner.Stage stage, PlanMatchPattern pattern)
{
List<PlanOptimizer> optimizers = queryRunner.getPlanOptimizers(true);

assertPlan(sql, stage, pattern, optimizers);
}

protected void assertPlan(String sql, PlanMatchPattern pattern, List<PlanOptimizer> optimizers)
protected void assertPlan(@Language("SQL") String sql, PlanMatchPattern pattern, List<PlanOptimizer> optimizers)
{
assertPlan(sql, OPTIMIZED, pattern, optimizers);
}

protected void assertPlan(String sql, LogicalPlanner.Stage stage, PlanMatchPattern pattern, Predicate<PlanOptimizer> optimizerPredicate)
protected void assertPlan(@Language("SQL") String sql, LogicalPlanner.Stage stage, PlanMatchPattern pattern, Predicate<PlanOptimizer> optimizerPredicate)
{
List<PlanOptimizer> optimizers = queryRunner.getPlanOptimizers(true).stream()
.filter(optimizerPredicate)
Expand All @@ -133,7 +133,7 @@ protected void assertPlan(String sql, LogicalPlanner.Stage stage, PlanMatchPatte
assertPlan(sql, stage, pattern, optimizers);
}

protected void assertPlan(String sql, LogicalPlanner.Stage stage, PlanMatchPattern pattern, List<PlanOptimizer> optimizers)
protected void assertPlan(@Language("SQL") String sql, LogicalPlanner.Stage stage, PlanMatchPattern pattern, List<PlanOptimizer> optimizers)
{
queryRunner.inTransaction(transactionSession -> {
Plan actualPlan = queryRunner.createPlan(transactionSession, sql, optimizers, stage, WarningCollector.NOOP);
Expand All @@ -142,12 +142,12 @@ protected void assertPlan(String sql, LogicalPlanner.Stage stage, PlanMatchPatte
});
}

protected void assertDistributedPlan(String sql, PlanMatchPattern pattern)
protected void assertDistributedPlan(@Language("SQL") String sql, PlanMatchPattern pattern)
{
assertDistributedPlan(sql, getQueryRunner().getDefaultSession(), pattern);
}

protected void assertDistributedPlan(String sql, Session session, PlanMatchPattern pattern)
protected void assertDistributedPlan(@Language("SQL") String sql, Session session, PlanMatchPattern pattern)
{
assertPlanWithSession(sql, session, false, pattern);
}
Expand Down Expand Up @@ -185,17 +185,17 @@ protected void assertPlanWithSession(@Language("SQL") String sql, Session sessio
});
}

protected Plan plan(String sql)
protected Plan plan(@Language("SQL") String sql)
{
return plan(sql, OPTIMIZED_AND_VALIDATED);
}

protected Plan plan(String sql, LogicalPlanner.Stage stage)
protected Plan plan(@Language("SQL") String sql, LogicalPlanner.Stage stage)
{
return plan(sql, stage, true);
}

protected Plan plan(String sql, LogicalPlanner.Stage stage, boolean forceSingleNode)
protected Plan plan(@Language("SQL") String sql, LogicalPlanner.Stage stage, boolean forceSingleNode)
{
try {
return queryRunner.inTransaction(transactionSession -> queryRunner.createPlan(transactionSession, sql, stage, forceSingleNode, WarningCollector.NOOP));
Expand All @@ -205,12 +205,12 @@ protected Plan plan(String sql, LogicalPlanner.Stage stage, boolean forceSingleN
}
}

protected SubPlan subplan(String sql, LogicalPlanner.Stage stage, boolean forceSingleNode)
protected SubPlan subplan(@Language("SQL") String sql, LogicalPlanner.Stage stage, boolean forceSingleNode)
{
return subplan(sql, stage, forceSingleNode, getQueryRunner().getDefaultSession());
}

protected SubPlan subplan(String sql, LogicalPlanner.Stage stage, boolean forceSingleNode, Session session)
protected SubPlan subplan(@Language("SQL") String sql, LogicalPlanner.Stage stage, boolean forceSingleNode, Session session)
{
try {
return queryRunner.inTransaction(session, transactionSession -> {
Expand Down

0 comments on commit 1f2854f

Please sign in to comment.