.addAll(rightPlan.getOutputSymbols())
.build();
if (node.getType() == Join.Type.CROSS) {
return new RelationPlan(
new JoinNode(idAllocator.getNextId(),
JoinNode.Type.typeConvert(node.getType()),
leftPlanBuilder.getRoot(),
rightPlanBuilder.getRoot(),
ImmutableList.<JoinNode.EquiJoinClause>of()),
analysis.getOutputDescriptor(node), outputSymbols);
}
List<EquiJoinClause> criteria = analysis.getJoinCriteria(node);
Analysis.JoinInPredicates joinInPredicates = analysis.getJoinInPredicates(node);
// Add semi joins if necessary
if (joinInPredicates != null) {
leftPlanBuilder = appendSemiJoins(leftPlanBuilder, joinInPredicates.getLeftInPredicates());
rightPlanBuilder = appendSemiJoins(rightPlanBuilder, joinInPredicates.getRightInPredicates());
}
// Add projections for join criteria
leftPlanBuilder = appendProjections(leftPlanBuilder, Iterables.transform(criteria, leftGetter()));
rightPlanBuilder = appendProjections(rightPlanBuilder, Iterables.transform(criteria, rightGetter()));
ImmutableList.Builder<JoinNode.EquiJoinClause> clauses = ImmutableList.builder();
for (EquiJoinClause clause : criteria) {
Symbol leftSymbol = leftPlanBuilder.translate(clause.getLeft());
Symbol rightSymbol = rightPlanBuilder.translate(clause.getRight());
clauses.add(new JoinNode.EquiJoinClause(leftSymbol, rightSymbol));
}
return new RelationPlan(new JoinNode(idAllocator.getNextId(), JoinNode.Type.typeConvert(node.getType()), leftPlanBuilder.getRoot(), rightPlanBuilder.getRoot(), clauses.build()), analysis.getOutputDescriptor(node), outputSymbols);
}