Add plan builder methods for join and aggregation
@@ -37,6 +37,7 @@ import com.facebook.presto.sql.planner.plan.Assignments;
import com.facebook.presto.sql.planner.plan.DeleteNode;
import com.facebook.presto.sql.planner.plan.ExchangeNode;
import com.facebook.presto.sql.planner.plan.FilterNode;
+import com.facebook.presto.sql.planner.plan.JoinNode;
import com.facebook.presto.sql.planner.plan.LimitNode;
import com.facebook.presto.sql.planner.plan.PlanNode;
import com.facebook.presto.sql.planner.plan.ProjectNode;
@@ -323,6 +324,30 @@ public class PlanBuilder
}
}
+ public AggregationNode aggregation(
+ PlanNode source,
+ Map<Symbol, AggregationNode.Aggregation> assignments,
+ List<List<Symbol>> groupingSets,
+ AggregationNode.Step step,
+ Optional<Symbol> hashSymbol,
+ Optional<Symbol> groupIdSymbol)
+ {
+ return new AggregationNode(idAllocator.getNextId(), source, assignments, groupingSets, step, hashSymbol, groupIdSymbol);
+ }
+
+ public JoinNode join(
+ JoinNode.Type type,
+ PlanNode left,
+ PlanNode right,
+ List<JoinNode.EquiJoinClause> criteria,
+ List<Symbol> outputSymbols,
+ Optional<Expression> filter,
+ Optional<Symbol> leftHashSymbol,
+ Optional<Symbol> rightHashSymbol)
+ {
+ return new JoinNode(idAllocator.getNextId(), type, left, right, criteria, outputSymbols, filter, leftHashSymbol, rightHashSymbol, Optional.empty());
+ }
+
public Symbol symbol(String name, Type type)
{
Symbol symbol = new Symbol(name);
