@Override
public LogicalNode visitUnion(LogicalPlanner.PlanContext ctx, Stack<Expr> stack, SetOperation expr)
throws TajoException {
LogicalPlan.QueryBlock leftBlock = ctx.getPlan().newQueryBlock();
LogicalPlanner.PlanContext leftContext = new LogicalPlanner.PlanContext(ctx, leftBlock);
LogicalNode leftChild = visit(leftContext, new Stack<Expr>(), expr.getLeft());
leftBlock.setRoot(leftChild);
ctx.getQueryBlock().registerExprWithNode(expr.getLeft(), leftChild);
LogicalPlan.QueryBlock rightBlock = ctx.getPlan().newQueryBlock();
LogicalPlanner.PlanContext rightContext = new LogicalPlanner.PlanContext(ctx, rightBlock);
LogicalNode rightChild = visit(rightContext, new Stack<Expr>(), expr.getRight());
rightBlock.setRoot(rightChild);
ctx.getQueryBlock().registerExprWithNode(expr.getRight(), rightChild);
UnionNode unionNode = new UnionNode(ctx.getPlan().newPID());
unionNode.setLeftChild(leftChild);
unionNode.setRightChild(rightChild);
unionNode.setInSchema(leftChild.getOutSchema());
unionNode.setOutSchema(leftChild.getOutSchema());
unionNode.setDistinct(expr.isDistinct());
return unionNode;
}