tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject [3/4] TAJO-123: Clean up the logical plan's json format. (hyunsik)
Date Mon, 19 Aug 2013 09:23:54 GMT
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java
index b8cfb70..4fa4a10 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java
@@ -32,7 +32,7 @@ import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.common.TajoDataTypes.DataType;
 import org.apache.tajo.datum.DatumFactory;
 import org.apache.tajo.engine.eval.*;
-import org.apache.tajo.engine.eval.EvalNode.Type;
+import org.apache.tajo.engine.eval.EvalType;
 import org.apache.tajo.engine.planner.LogicalPlan.QueryBlock;
 import org.apache.tajo.engine.planner.logical.*;
 import org.apache.tajo.engine.query.exception.InvalidQueryException;
@@ -100,7 +100,7 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     LogicalRootNode root = new LogicalRootNode();
     root.setInSchema(subroot.getOutSchema());
     root.setOutSchema(subroot.getOutSchema());
-    root.setSubNode(subroot);
+    root.setChild(subroot);
     plan.getRootBlock().setRoot(root);
 
     return plan;
@@ -209,8 +209,8 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
 
     // Determine join conditions
     if (join.isNatural()) { // if natural join, it should have the equi-join conditions by common column names
-      Schema leftSchema = joinNode.getOuterNode().getInSchema();
-      Schema rightSchema = joinNode.getInnerNode().getInSchema();
+      Schema leftSchema = joinNode.getLeftChild().getInSchema();
+      Schema rightSchema = joinNode.getRightChild().getInSchema();
       Schema commons = SchemaUtil.getCommons(leftSchema, rightSchema);
       EvalNode njCond = getNaturalJoinCondition(leftSchema, rightSchema, commons);
       joinNode.setJoinQual(njCond);
@@ -230,12 +230,12 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     for (Column common : commons.getColumns()) {
       leftJoinKey = outer.getColumnByName(common.getColumnName());
       rightJoinKey = inner.getColumnByName(common.getColumnName());
-      equiQual = new BinaryEval(EvalNode.Type.EQUAL,
+      equiQual = new BinaryEval(EvalType.EQUAL,
           new FieldEval(leftJoinKey), new FieldEval(rightJoinKey));
       if (njQual == null) {
         njQual = equiQual;
       } else {
-        njQual = new BinaryEval(EvalNode.Type.AND,
+        njQual = new BinaryEval(EvalType.AND,
             njQual, equiQual);
       }
     }
@@ -246,8 +246,8 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
   private static LogicalNode createCatasianProduct(LogicalNode left, LogicalNode right) {
     JoinNode join = new JoinNode(JoinType.CROSS_JOIN, left, right);
     Schema joinSchema = SchemaUtil.merge(
-        join.getOuterNode().getOutSchema(),
-        join.getInnerNode().getOutSchema());
+        join.getLeftChild().getOutSchema(),
+        join.getRightChild().getOutSchema());
     join.setInSchema(joinSchema);
     join.setOutSchema(joinSchema);
 
@@ -335,8 +335,8 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     Schema outSchema = PlannerUtil.targetToSchema(leftStrippedTargets);
     setOp.setInSchema(left.getOutSchema());
     setOp.setOutSchema(outSchema);
-    setOp.setOuter(left);
-    setOp.setInner(right);
+    setOp.setLeftChild(left);
+    setOp.setRightChild(right);
 
     if (isNoUpperProjection(stack)) {
       block.targetListManager = new TargetListManager(plan, leftStrippedTargets);
@@ -385,7 +385,7 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     SelectionNode selectionNode = new SelectionNode(searchCondition);
 
     // 4. set child plan, update input/output schemas:
-    selectionNode.setSubNode(child);
+    selectionNode.setChild(child);
     selectionNode.setInSchema(child.getOutSchema());
     selectionNode.setOutSchema(child.getOutSchema());
 
@@ -429,7 +429,7 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
       }
 
       // 4. Set Child Plan and Update Input Schemes Phase
-      groupingNode.setSubNode(child);
+      groupingNode.setChild(child);
       block.setGroupingNode(groupingNode);
       groupingNode.setInSchema(child.getInSchema());
 
@@ -462,8 +462,8 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
         Target[] clone = cloneTargets(block.getCurrentTargets());
 
         g1.setTargets(clone);
-        g1.setSubNode((LogicalNode) subNode.clone());
-        g1.setInSchema(g1.getSubNode().getOutSchema());
+        g1.setChild((LogicalNode) subNode.clone());
+        g1.setInSchema(g1.getChild().getOutSchema());
         Schema outSchema = getProjectedSchema(plan, block.getCurrentTargets());
         g1.setOutSchema(outSchema);
 
@@ -477,16 +477,16 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
         GroupbyNode g1 = new GroupbyNode(cuboids.get(idx));
         Target[] clone = cloneTargets(block.getCurrentTargets());
         g1.setTargets(clone);
-        g1.setSubNode((LogicalNode) subNode.clone());
-        g1.setInSchema(g1.getSubNode().getOutSchema());
+        g1.setChild((LogicalNode) subNode.clone());
+        g1.setInSchema(g1.getChild().getOutSchema());
         Schema outSchema = getProjectedSchema(plan, clone);
         g1.setOutSchema(outSchema);
 
         GroupbyNode g2 = new GroupbyNode(cuboids.get(idx+1));
         clone = cloneTargets(block.getCurrentTargets());
         g2.setTargets(clone);
-        g2.setSubNode((LogicalNode) subNode.clone());
-        g2.setInSchema(g1.getSubNode().getOutSchema());
+        g2.setChild((LogicalNode) subNode.clone());
+        g2.setInSchema(g1.getChild().getOutSchema());
         outSchema = getProjectedSchema(plan, clone);
         g2.setOutSchema(outSchema);
         union = new UnionNode(g1, g2);
@@ -577,7 +577,7 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     SortNode sortNode = new SortNode(annotatedSortSpecs);
 
     // 4. Set Child Plan, Update Input/Output Schemas:
-    sortNode.setSubNode(child);
+    sortNode.setChild(child);
     sortNode.setInSchema(child.getOutSchema());
     sortNode.setOutSchema(child.getOutSchema());
 
@@ -601,7 +601,7 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     LimitNode limitNode = new LimitNode(firstFetchNum.terminate(null).asInt8());
 
     // set child plan and update input/output schemas.
-    limitNode.setSubNode(child);
+    limitNode.setChild(child);
     limitNode.setInSchema(child.getOutSchema());
     limitNode.setOutSchema(child.getOutSchema());
     return limitNode;
@@ -655,7 +655,7 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     block.setProjectionNode(projectionNode);
     projectionNode.setOutSchema(getProjectedSchema(plan, projectionNode.getTargets()));
     projectionNode.setInSchema(child.getOutSchema());
-    projectionNode.setSubNode(child);
+    projectionNode.setChild(child);
 
     if (projection.isDistinct() && block.hasGrouping()) {
       throw new VerifyException("Cannot support grouping and distinct at the same time");
@@ -666,8 +666,8 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
         dupRemoval.setTargets(block.getTargetListManager().getTargets());
         dupRemoval.setInSchema(child.getOutSchema());
         dupRemoval.setOutSchema(outSchema);
-        dupRemoval.setSubNode(child);
-        projectionNode.setSubNode(dupRemoval);
+        dupRemoval.setChild(child);
+        projectionNode.setChild(dupRemoval);
       }
     }
 
@@ -684,7 +684,7 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     if (!block.isGroupingResolved()) {
       GroupbyNode groupbyNode = new GroupbyNode(new Column[] {});
       groupbyNode.setTargets(block.getCurrentTargets());
-      groupbyNode.setSubNode(child);
+      groupbyNode.setChild(child);
       groupbyNode.setInSchema(child.getOutSchema());
 
       plan.postVisit(blockName, groupbyNode, stack);
@@ -720,7 +720,7 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
       LogicalNode subQuery = visitChild(context, stack, expr.getSubQuery());
       stack.pop();
       StoreTableNode storeNode = new StoreTableNode(tableName);
-      storeNode.setSubNode(subQuery);
+      storeNode.setChild(subQuery);
 
       if (expr.hasTableElements()) {
         Schema schema = convertTableElementsSchema(expr.getTableElements());
@@ -939,23 +939,23 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     return new FieldEval(column);
   }
 
-  private static Type exprTypeToEvalType(OpType type) {
+  private static EvalType exprTypeToEvalType(OpType type) {
     switch (type) {
-      case And: return Type.AND;
-      case Or: return Type.OR;
-      case Equals: return Type.EQUAL;
-      case NotEquals: return Type.NOT_EQUAL;
-      case LessThan: return Type.LTH;
-      case LessThanOrEquals: return Type.LEQ;
-      case GreaterThan: return Type.GTH;
-      case GreaterThanOrEquals: return Type.GEQ;
-      case Plus: return Type.PLUS;
-      case Minus: return Type.MINUS;
-      case Multiply: return Type.MULTIPLY;
-      case Divide: return Type.DIVIDE;
-      case Modular: return Type.MODULAR;
-      case Column: return Type.FIELD;
-      case Function: return Type.FUNCTION;
+      case And: return EvalType.AND;
+      case Or: return EvalType.OR;
+      case Equals: return EvalType.EQUAL;
+      case NotEquals: return EvalType.NOT_EQUAL;
+      case LessThan: return EvalType.LTH;
+      case LessThanOrEquals: return EvalType.LEQ;
+      case GreaterThan: return EvalType.GTH;
+      case GreaterThanOrEquals: return EvalType.GEQ;
+      case Plus: return EvalType.PLUS;
+      case Minus: return EvalType.MINUS;
+      case Multiply: return EvalType.MULTIPLY;
+      case Divide: return EvalType.DIVIDE;
+      case Modular: return EvalType.MODULAR;
+      case Column: return EvalType.FIELD;
+      case Function: return EvalType.FUNCTION;
       default: throw new RuntimeException("Unsupported type: " + type);
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
index 9671066..a2e38b1 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
@@ -72,7 +72,7 @@ public class PhysicalPlannerImpl implements PhysicalPlanner {
 
       case ROOT:
         LogicalRootNode rootNode = (LogicalRootNode) logicalNode;
-        return createPlanRecursive(ctx, rootNode.getSubNode());
+        return createPlanRecursive(ctx, rootNode.getChild());
 
       case EXPRS:
         EvalExprNode evalExpr = (EvalExprNode) logicalNode;
@@ -80,17 +80,17 @@ public class PhysicalPlannerImpl implements PhysicalPlanner {
 
       case STORE:
         StoreTableNode storeNode = (StoreTableNode) logicalNode;
-        outer = createPlanRecursive(ctx, storeNode.getSubNode());
+        outer = createPlanRecursive(ctx, storeNode.getChild());
         return createStorePlan(ctx, storeNode, outer);
 
       case SELECTION:
         SelectionNode selNode = (SelectionNode) logicalNode;
-        outer = createPlanRecursive(ctx, selNode.getSubNode());
+        outer = createPlanRecursive(ctx, selNode.getChild());
         return new SelectionExec(ctx, selNode, outer);
 
       case PROJECTION:
         ProjectionNode prjNode = (ProjectionNode) logicalNode;
-        outer = createPlanRecursive(ctx, prjNode.getSubNode());
+        outer = createPlanRecursive(ctx, prjNode.getChild());
         return new ProjectionExec(ctx, prjNode, outer);
 
       case SCAN:
@@ -99,29 +99,29 @@ public class PhysicalPlannerImpl implements PhysicalPlanner {
 
       case GROUP_BY:
         GroupbyNode grpNode = (GroupbyNode) logicalNode;
-        outer = createPlanRecursive(ctx, grpNode.getSubNode());
+        outer = createPlanRecursive(ctx, grpNode.getChild());
         return createGroupByPlan(ctx, grpNode, outer);
 
       case SORT:
         SortNode sortNode = (SortNode) logicalNode;
-        outer = createPlanRecursive(ctx, sortNode.getSubNode());
+        outer = createPlanRecursive(ctx, sortNode.getChild());
         return createSortPlan(ctx, sortNode, outer);
 
       case JOIN:
         JoinNode joinNode = (JoinNode) logicalNode;
-        outer = createPlanRecursive(ctx, joinNode.getOuterNode());
-        inner = createPlanRecursive(ctx, joinNode.getInnerNode());
+        outer = createPlanRecursive(ctx, joinNode.getLeftChild());
+        inner = createPlanRecursive(ctx, joinNode.getRightChild());
         return createJoinPlan(ctx, joinNode, outer, inner);
 
       case UNION:
         UnionNode unionNode = (UnionNode) logicalNode;
-        outer = createPlanRecursive(ctx, unionNode.getOuterNode());
-        inner = createPlanRecursive(ctx, unionNode.getInnerNode());
+        outer = createPlanRecursive(ctx, unionNode.getLeftChild());
+        inner = createPlanRecursive(ctx, unionNode.getRightChild());
         return new UnionExec(ctx, outer, inner);
 
       case LIMIT:
         LimitNode limitNode = (LimitNode) logicalNode;
-        outer = createPlanRecursive(ctx, limitNode.getSubNode());
+        outer = createPlanRecursive(ctx, limitNode.getChild());
         return new LimitExec(ctx, limitNode.getInSchema(),
             limitNode.getOutSchema(), outer, limitNode);
 
@@ -130,14 +130,6 @@ public class PhysicalPlannerImpl implements PhysicalPlanner {
         outer = createIndexScanExec(ctx, indexScanNode);
         return outer;
 
-      case RENAME:
-      case SET_UNION:
-      case SET_DIFF:
-      case SET_INTERSECT:
-      case INSERT_INTO:
-      case SHOW_TABLE:
-      case DESC_TABLE:
-      case SHOW_FUNCTION:
       default:
         return null;
     }
@@ -163,8 +155,8 @@ public class PhysicalPlannerImpl implements PhysicalPlanner {
         return new NLJoinExec(ctx, joinNode, outer, inner);
 
       case INNER:
-        String [] outerLineage = PlannerUtil.getLineage(joinNode.getOuterNode());
-        String [] innerLineage = PlannerUtil.getLineage(joinNode.getInnerNode());
+        String [] outerLineage = PlannerUtil.getLineage(joinNode.getLeftChild());
+        String [] innerLineage = PlannerUtil.getLineage(joinNode.getRightChild());
         long outerSize = estimateSizeRecursive(ctx, outerLineage);
         long innerSize = estimateSizeRecursive(ctx, innerLineage);
 
@@ -254,7 +246,7 @@ public class PhysicalPlannerImpl implements PhysicalPlanner {
       LOG.info("The planner chooses HashAggregationExec");
       return new HashAggregateExec(ctx, groupbyNode, subOp);
     } else {
-      String [] outerLineage = PlannerUtil.getLineage(groupbyNode.getSubNode());
+      String [] outerLineage = PlannerUtil.getLineage(groupbyNode.getChild());
       long estimatedSize = estimateSizeRecursive(ctx, outerLineage);
       final long threshold = 1048576 * 256;
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java
index dc647a9..755d4cb 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java
@@ -45,14 +45,14 @@ public class PlannerUtil {
   public static boolean checkIfDDLPlan(LogicalNode node) {
     LogicalNode baseNode = node;
     if (node instanceof LogicalRootNode) {
-      baseNode = ((LogicalRootNode) node).getSubNode();
+      baseNode = ((LogicalRootNode) node).getChild();
     }
 
-    return baseNode.getType() == ExprType.CREATE_TABLE || baseNode.getType() == ExprType.DROP_TABLE;
+    return baseNode.getType() == NodeType.CREATE_TABLE || baseNode.getType() == NodeType.DROP_TABLE;
   }
   
   public static String [] getLineage(LogicalNode node) {
-    LogicalNode [] scans =  PlannerUtil.findAllNodes(node, ExprType.SCAN);
+    LogicalNode [] scans =  PlannerUtil.findAllNodes(node, NodeType.SCAN);
     String [] tableNames = new String[scans.length];
     ScanNode scan;
     for (int i = 0; i < scans.length; i++) {
@@ -67,12 +67,12 @@ public class PlannerUtil {
     Preconditions.checkArgument(newNode instanceof UnaryNode);
     
     UnaryNode p = (UnaryNode) parent;
-    LogicalNode c = p.getSubNode();
+    LogicalNode c = p.getChild();
     UnaryNode m = (UnaryNode) newNode;
     m.setInSchema(c.getOutSchema());
     m.setOutSchema(c.getOutSchema());
-    m.setSubNode(c);
-    p.setSubNode(m);
+    m.setChild(c);
+    p.setChild(m);
     
     return p;
   }
@@ -88,20 +88,20 @@ public class PlannerUtil {
         "ERROR: the logical node to be removed must be unary node.");
 
     UnaryNode child = (UnaryNode) tobeRemoved;
-    LogicalNode grandChild = child.getSubNode();
+    LogicalNode grandChild = child.getChild();
     if (parent instanceof UnaryNode) {
       UnaryNode unaryParent = (UnaryNode) parent;
 
-      Preconditions.checkArgument(unaryParent.getSubNode() == child,
+      Preconditions.checkArgument(unaryParent.getChild() == child,
           "ERROR: both logical node must be parent and child nodes");
-      unaryParent.setSubNode(grandChild);
+      unaryParent.setChild(grandChild);
 
     } else if (parent instanceof BinaryNode) {
       BinaryNode binaryParent = (BinaryNode) parent;
-      if (binaryParent.getOuterNode().equals(child)) {
-        binaryParent.setOuter(grandChild);
-      } else if (binaryParent.getInnerNode().equals(child)) {
-        binaryParent.setInner(grandChild);
+      if (binaryParent.getLeftChild().equals(child)) {
+        binaryParent.setLeftChild(grandChild);
+      } else if (binaryParent.getRightChild().equals(child)) {
+        binaryParent.setRightChild(grandChild);
       } else {
         throw new IllegalStateException("ERROR: both logical node must be parent and child nodes");
       }
@@ -111,16 +111,16 @@ public class PlannerUtil {
     return child;
   }
   
-  public static void replaceNode(LogicalNode plan, LogicalNode newNode, ExprType type) {
+  public static void replaceNode(LogicalNode plan, LogicalNode newNode, NodeType type) {
     LogicalNode parent = findTopParentNode(plan, type);
     Preconditions.checkArgument(parent instanceof UnaryNode);
     Preconditions.checkArgument(!(newNode instanceof BinaryNode));
     UnaryNode parentNode = (UnaryNode) parent;
-    LogicalNode child = parentNode.getSubNode();
+    LogicalNode child = parentNode.getChild();
     if (child instanceof UnaryNode) {
-      ((UnaryNode) newNode).setSubNode(((UnaryNode)child).getSubNode());
+      ((UnaryNode) newNode).setChild(((UnaryNode) child).getChild());
     }
-    parentNode.setSubNode(newNode);
+    parentNode.setChild(newNode);
   }
   
   public static LogicalNode insertOuterNode(LogicalNode parent, LogicalNode outer) {
@@ -128,12 +128,12 @@ public class PlannerUtil {
     Preconditions.checkArgument(outer instanceof UnaryNode);
     
     BinaryNode p = (BinaryNode) parent;
-    LogicalNode c = p.getOuterNode();
+    LogicalNode c = p.getLeftChild();
     UnaryNode m = (UnaryNode) outer;
     m.setInSchema(c.getOutSchema());
     m.setOutSchema(c.getOutSchema());
-    m.setSubNode(c);
-    p.setOuter(m);
+    m.setChild(c);
+    p.setLeftChild(m);
     return p;
   }
   
@@ -142,12 +142,12 @@ public class PlannerUtil {
     Preconditions.checkArgument(inner instanceof UnaryNode);
     
     BinaryNode p = (BinaryNode) parent;
-    LogicalNode c = p.getInnerNode();
+    LogicalNode c = p.getRightChild();
     UnaryNode m = (UnaryNode) inner;
     m.setInSchema(c.getOutSchema());
     m.setOutSchema(c.getOutSchema());
-    m.setSubNode(c);
-    p.setInner(m);
+    m.setChild(c);
+    p.setRightChild(m);
     return p;
   }
   
@@ -158,18 +158,18 @@ public class PlannerUtil {
     Preconditions.checkArgument(right instanceof UnaryNode);
     
     BinaryNode p = (BinaryNode)parent;
-    LogicalNode lc = p.getOuterNode();
-    LogicalNode rc = p.getInnerNode();
+    LogicalNode lc = p.getLeftChild();
+    LogicalNode rc = p.getRightChild();
     UnaryNode lm = (UnaryNode)left;
     UnaryNode rm = (UnaryNode)right;
     lm.setInSchema(lc.getOutSchema());
     lm.setOutSchema(lc.getOutSchema());
-    lm.setSubNode(lc);
+    lm.setChild(lc);
     rm.setInSchema(rc.getOutSchema());
     rm.setOutSchema(rc.getOutSchema());
-    rm.setSubNode(rc);
-    p.setOuter(lm);
-    p.setInner(rm);
+    rm.setChild(rc);
+    p.setLeftChild(lm);
+    p.setRightChild(rm);
     return p;
   }
   
@@ -227,7 +227,7 @@ public class PlannerUtil {
       child.setTargets(targetArray);
       child.setOutSchema(PlannerUtil.targetToSchema(targetArray));
       // set the groupby chaining
-      gp.setSubNode(child);
+      gp.setChild(child);
       gp.setInSchema(child.getOutSchema());
     } catch (CloneNotSupportedException e) {
       LOG.error(e);
@@ -241,7 +241,7 @@ public class PlannerUtil {
     
     try {
       SortNode child = (SortNode) sort.clone();
-      sort.setSubNode(child);
+      sort.setChild(child);
       sort.setInSchema(child.getOutSchema());
       sort.setOutSchema(child.getOutSchema());
     } catch (CloneNotSupportedException e) {
@@ -278,7 +278,7 @@ public class PlannerUtil {
    * @param type to find
    * @return a found logical node
    */
-  public static LogicalNode findTopNode(LogicalNode node, ExprType type) {
+  public static LogicalNode findTopNode(LogicalNode node, NodeType type) {
     Preconditions.checkNotNull(node);
     Preconditions.checkNotNull(type);
     
@@ -298,7 +298,7 @@ public class PlannerUtil {
    * @param type to find
    * @return a found logical node
    */
-  public static LogicalNode [] findAllNodes(LogicalNode node, ExprType type) {
+  public static LogicalNode [] findAllNodes(LogicalNode node, NodeType type) {
     Preconditions.checkNotNull(node);
     Preconditions.checkNotNull(type);
 
@@ -319,7 +319,7 @@ public class PlannerUtil {
    * @param type to find
    * @return the parent node of a found logical node
    */
-  public static LogicalNode findTopParentNode(LogicalNode node, ExprType type) {
+  public static LogicalNode findTopParentNode(LogicalNode node, NodeType type) {
     Preconditions.checkNotNull(node);
     Preconditions.checkNotNull(type);
     
@@ -335,7 +335,7 @@ public class PlannerUtil {
   public static boolean canBeEvaluated(EvalNode eval, LogicalNode node) {
     Set<Column> columnRefs = EvalTreeUtil.findDistinctRefColumns(eval);
 
-    if (node.getType() == ExprType.JOIN) {
+    if (node.getType() == NodeType.JOIN) {
       JoinNode joinNode = (JoinNode) node;
       Set<String> tableIds = Sets.newHashSet();
       // getting distinct table references
@@ -351,8 +351,8 @@ public class PlannerUtil {
         return false;
       }
 
-      String [] outer = getLineage(joinNode.getOuterNode());
-      String [] inner = getLineage(joinNode.getInnerNode());
+      String [] outer = getLineage(joinNode.getLeftChild());
+      String [] inner = getLineage(joinNode.getRightChild());
 
       Set<String> o = Sets.newHashSet(outer);
       Set<String> i = Sets.newHashSet(inner);
@@ -396,15 +396,15 @@ public class PlannerUtil {
 
   private static class LogicalNodeFinder implements LogicalNodeVisitor {
     private List<LogicalNode> list = new ArrayList<LogicalNode>();
-    private final ExprType [] tofind;
+    private final NodeType[] tofind;
     private boolean topmost = false;
     private boolean finished = false;
 
-    public LogicalNodeFinder(ExprType...type) {
+    public LogicalNodeFinder(NodeType...type) {
       this.tofind = type;
     }
 
-    public LogicalNodeFinder(ExprType [] type, boolean topmost) {
+    public LogicalNodeFinder(NodeType[] type, boolean topmost) {
       this(type);
       this.topmost = topmost;
     }
@@ -412,7 +412,7 @@ public class PlannerUtil {
     @Override
     public void visit(LogicalNode node) {
       if (!finished) {
-        for (ExprType type : tofind) {
+        for (NodeType type : tofind) {
           if (node.getType() == type) {
             list.add(node);
           }
@@ -430,9 +430,9 @@ public class PlannerUtil {
   
   private static class ParentNodeFinder implements LogicalNodeVisitor {
     private List<LogicalNode> list = new ArrayList<LogicalNode>();
-    private ExprType tofind;
+    private NodeType tofind;
 
-    public ParentNodeFinder(ExprType type) {
+    public ParentNodeFinder(NodeType type) {
       this.tofind = type;
     }
 
@@ -440,13 +440,13 @@ public class PlannerUtil {
     public void visit(LogicalNode node) {
       if (node instanceof UnaryNode) {
         UnaryNode unary = (UnaryNode) node;
-        if (unary.getSubNode().getType() == tofind) {
+        if (unary.getChild().getType() == tofind) {
           list.add(node);
         }
       } else if (node instanceof BinaryNode){
         BinaryNode bin = (BinaryNode) node;
-        if (bin.getOuterNode().getType() == tofind ||
-            bin.getInnerNode().getType() == tofind) {
+        if (bin.getLeftChild().getType() == tofind ||
+            bin.getRightChild().getType() == tofind) {
           list.add(node);
         }
       }
@@ -711,7 +711,7 @@ public class PlannerUtil {
       } catch (CloneNotSupportedException e) {
         throw new InternalError(e.getMessage());
       }
-      if (copy[i].getEvalTree().getType() == EvalNode.Type.FIELD) {
+      if (copy[i].getEvalTree().getType() == EvalType.FIELD) {
         FieldEval fieldEval = (FieldEval) copy[i].getEvalTree();
         if (fieldEval.getColumnRef().isQualified()) {
           fieldEval.getColumnRef().setName(fieldEval.getColumnName());

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
index 3db4d94..c14fe88 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/Target.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.engine.planner;
 
 import com.google.gson.annotations.Expose;
+import org.apache.tajo.engine.eval.EvalType;
 import org.apache.tajo.json.GsonObject;
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.common.TajoDataTypes.DataType;
@@ -37,7 +38,7 @@ public class Target implements Cloneable, GsonObject {
 
   public Target(EvalNode expr) {
     this.expr = expr;
-    if (expr.getType() == EvalNode.Type.AGG_FUNCTION &&
+    if (expr.getType() == EvalType.AGG_FUNCTION &&
         expr.getValueType().length > 1) { // hack for partial result
       this.column = new Column(expr.getName(), Type.ARRAY);
     } else {

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalOptimizer.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalOptimizer.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalOptimizer.java
index c0e4017..36190ef 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalOptimizer.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalOptimizer.java
@@ -20,8 +20,8 @@ package org.apache.tajo.engine.planner.global;
 
 import com.google.common.annotations.VisibleForTesting;
 import org.apache.tajo.engine.planner.PlannerUtil;
-import org.apache.tajo.engine.planner.logical.ExprType;
 import org.apache.tajo.engine.planner.logical.LogicalNode;
+import org.apache.tajo.engine.planner.logical.NodeType;
 import org.apache.tajo.engine.planner.logical.ScanNode;
 import org.apache.tajo.engine.planner.logical.UnaryNode;
 import org.apache.tajo.master.ExecutionBlock;
@@ -55,7 +55,7 @@ public class GlobalOptimizer {
     }
 
     for (ExecutionBlock childBlock: cur.getChildBlocks()) {
-      if (childBlock.getStoreTableNode().getSubNode().getType() != ExprType.UNION &&
+      if (childBlock.getStoreTableNode().getChild().getType() != NodeType.UNION &&
           childBlock.getPartitionType() == PartitionType.LIST) {
         mergeLogicalUnits(cur, childBlock);
       }
@@ -63,15 +63,15 @@ public class GlobalOptimizer {
   }
   
   private ExecutionBlock mergeLogicalUnits(ExecutionBlock parent, ExecutionBlock child) {
-    LogicalNode p = PlannerUtil.findTopParentNode(parent.getPlan(), ExprType.SCAN);
+    LogicalNode p = PlannerUtil.findTopParentNode(parent.getPlan(), NodeType.SCAN);
 
     if (p instanceof UnaryNode) {
       UnaryNode u = (UnaryNode) p;
-      ScanNode scan = (ScanNode) u.getSubNode();
-      LogicalNode c = child.getStoreTableNode().getSubNode();
+      ScanNode scan = (ScanNode) u.getChild();
+      LogicalNode c = child.getStoreTableNode().getChild();
 
       parent.removeChildBlock(scan);
-      u.setSubNode(c);
+      u.setChild(c);
       parent.setPlan(parent.getPlan());
       parent.addChildBlocks(child.getChildBlockMap());
     }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/BinaryNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/BinaryNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/BinaryNode.java
index 1adddf3..df4b046 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/BinaryNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/BinaryNode.java
@@ -25,7 +25,7 @@ import com.google.gson.annotations.Expose;
 import org.apache.tajo.json.GsonObject;
 
 public abstract class BinaryNode extends LogicalNode implements Cloneable, GsonObject {
-	@Expose LogicalNode outer = null;
+	@Expose LogicalNode leftChild = null;
 	@Expose LogicalNode inner = null;
 	
 	public BinaryNode() {
@@ -35,30 +35,30 @@ public abstract class BinaryNode extends LogicalNode implements Cloneable, GsonO
 	/**
 	 * @param opType
 	 */
-	public BinaryNode(ExprType opType) {
+	public BinaryNode(NodeType opType) {
 		super(opType);
 	}
 	
-	public LogicalNode getOuterNode() {
-		return this.outer;
+	public LogicalNode getLeftChild() {
+		return this.leftChild;
 	}
 	
-	public void setOuter(LogicalNode op) {
-		this.outer = op;
+	public void setLeftChild(LogicalNode op) {
+		this.leftChild = op;
 	}
 
-	public LogicalNode getInnerNode() {
+	public LogicalNode getRightChild() {
 		return this.inner;
 	}
 
-	public void setInner(LogicalNode op) {
+	public void setRightChild(LogicalNode op) {
 		this.inner = op;
 	}
 	
 	@Override
   public Object clone() throws CloneNotSupportedException {
 	  BinaryNode binNode = (BinaryNode) super.clone();
-	  binNode.outer = (LogicalNode) outer.clone();
+	  binNode.leftChild = (LogicalNode) leftChild.clone();
 	  binNode.inner = (LogicalNode) inner.clone();
 	  
 	  return binNode;
@@ -66,12 +66,12 @@ public abstract class BinaryNode extends LogicalNode implements Cloneable, GsonO
 	
 	public void preOrder(LogicalNodeVisitor visitor) {
 	  visitor.visit(this);
-	  outer.postOrder(visitor);
+	  leftChild.postOrder(visitor);
     inner.postOrder(visitor);    
   }
 	
 	public void postOrder(LogicalNodeVisitor visitor) {
-    outer.postOrder(visitor);
+    leftChild.postOrder(visitor);
     inner.postOrder(visitor);
     visitor.visit(this);
   }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/CreateTableNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/CreateTableNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/CreateTableNode.java
index a4d335b..c06623b 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/CreateTableNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/CreateTableNode.java
@@ -36,7 +36,7 @@ public class CreateTableNode extends LogicalNode implements Cloneable {
   @Expose private boolean external;
 
   public CreateTableNode(String tableName, Schema schema) {
-    super(ExprType.CREATE_TABLE);
+    super(NodeType.CREATE_TABLE);
     this.tableName = tableName;
     this.schema = schema;
   }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/DropTableNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/DropTableNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/DropTableNode.java
index d586bf9..7ddb5ef 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/DropTableNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/DropTableNode.java
@@ -22,7 +22,7 @@ public class DropTableNode extends LogicalNode {
   private String tableName;
 
   public DropTableNode(String tableName) {
-    super(ExprType.DROP_TABLE);
+    super(NodeType.DROP_TABLE);
     this.tableName = tableName;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/EvalExprNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/EvalExprNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/EvalExprNode.java
index 2ac6b2b..286f1c9 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/EvalExprNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/EvalExprNode.java
@@ -29,7 +29,7 @@ public class EvalExprNode extends LogicalNode implements Projectable {
   @Expose private Target[] exprs;
 
   public EvalExprNode(Target[] exprs) {
-    super(ExprType.EXPRS);
+    super(NodeType.EXPRS);
     this.exprs = exprs;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ExceptNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ExceptNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ExceptNode.java
index 379a83b..e7c7271 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ExceptNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ExceptNode.java
@@ -24,16 +24,16 @@ package org.apache.tajo.engine.planner.logical;
 public class ExceptNode extends BinaryNode {
 
   public ExceptNode() {
-    super(ExprType.EXCEPT);
+    super(NodeType.EXCEPT);
   }
 
   public ExceptNode(LogicalNode outer, LogicalNode inner) {
     this();
-    setOuter(outer);
-    setInner(inner);
+    setLeftChild(outer);
+    setRightChild(inner);
   }
 
   public String toString() {
-    return getOuterNode().toString() + "\n EXCEPT \n" + getInnerNode().toString();
+    return getLeftChild().toString() + "\n EXCEPT \n" + getRightChild().toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ExprType.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ExprType.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ExprType.java
deleted file mode 100644
index 7255146..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ExprType.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * 
- */
-package org.apache.tajo.engine.planner.logical;
-
-public enum ExprType {
-  BST_INDEX_SCAN,
-  CREATE_INDEX,
-  CREATE_TABLE,	
-	DROP_TABLE,
-  DESC_TABLE,
-	EXCEPT,
-	EXPRS,
-	GROUP_BY,
-	INSERT_INTO,
-	INTERSECT,
-  LIMIT,
-	JOIN,
-	PROJECTION,
-	RECEIVE,
-	RENAME,
-	ROOT,
-	SCAN,
-	SELECTION,
-	SEND,
-	SET_DIFF, 
-	SET_UNION,
-  SET_INTERSECT,
-	SHOW_TABLE,
-	SHOW_FUNCTION,
-	SORT,
-	STORE,
-	UNION
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/GroupbyNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/GroupbyNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/GroupbyNode.java
index b35a291..c6b9bc8 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/GroupbyNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/GroupbyNode.java
@@ -34,7 +34,7 @@ public class GroupbyNode extends UnaryNode implements Projectable, Cloneable {
 	}
 	
 	public GroupbyNode(final Column [] columns) {
-		super(ExprType.GROUP_BY);
+		super(NodeType.GROUP_BY);
 		this.columns = columns;
 	}
 	
@@ -75,8 +75,8 @@ public class GroupbyNode extends UnaryNode implements Projectable, Cloneable {
     return this.targets;
   }
   
-  public void setSubNode(LogicalNode subNode) {
-    super.setSubNode(subNode);
+  public void setChild(LogicalNode subNode) {
+    super.setChild(subNode);
   }
   
   public String toString() {
@@ -105,7 +105,7 @@ public class GroupbyNode extends UnaryNode implements Projectable, Cloneable {
     sb.append("}");
     
     return sb.toString() + "\n"
-        + getSubNode().toString();
+        + getChild().toString();
   }
   
   @Override
@@ -116,7 +116,7 @@ public class GroupbyNode extends UnaryNode implements Projectable, Cloneable {
       eq = eq && TUtil.checkEquals(columns, other.columns);
       eq = eq && TUtil.checkEquals(havingCondition, other.havingCondition);
       eq = eq && TUtil.checkEquals(targets, other.targets);
-      eq = eq && subExpr.equals(other.subExpr);
+      eq = eq && child.equals(other.child);
       return eq;
     } else {
       return false;  

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/IndexScanNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/IndexScanNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/IndexScanNode.java
index b14a54b..8a9ffe4 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/IndexScanNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/IndexScanNode.java
@@ -40,7 +40,7 @@ public class IndexScanNode extends ScanNode {
     setOutSchema(scanNode.getOutSchema());
     setLocal(scanNode.isLocal());
     setTargets(scanNode.getTargets());
-    setType(ExprType.BST_INDEX_SCAN);
+    setType(NodeType.BST_INDEX_SCAN);
     this.sortKeys = sortKeys;
     this.keySchema = keySchema;
     this.datum = datum;

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/IntersectNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/IntersectNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/IntersectNode.java
index 1d00a56..870d3bd 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/IntersectNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/IntersectNode.java
@@ -24,16 +24,16 @@ package org.apache.tajo.engine.planner.logical;
 public class IntersectNode extends BinaryNode {
 
   public IntersectNode() {
-    super(ExprType.INTERSECT);
+    super(NodeType.INTERSECT);
   }
 
   public IntersectNode(LogicalNode outer, LogicalNode inner) {
     this();
-    setOuter(outer);
-    setInner(inner);
+    setLeftChild(outer);
+    setRightChild(inner);
   }
 
   public String toString() {
-    return getOuterNode().toString() + "\n INTERSECT \n" + getInnerNode().toString();
+    return getLeftChild().toString() + "\n INTERSECT \n" + getRightChild().toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/JoinNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/JoinNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/JoinNode.java
index cd79e4d..6132c90 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/JoinNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/JoinNode.java
@@ -32,16 +32,16 @@ public class JoinNode extends BinaryNode implements Projectable, Cloneable {
   @Expose private Target[] targets;
 
   public JoinNode(JoinType joinType, LogicalNode left) {
-    super(ExprType.JOIN);
+    super(NodeType.JOIN);
     this.joinType = joinType;
-    setOuter(left);
+    setLeftChild(left);
   }
 
   public JoinNode(JoinType joinType, LogicalNode left, LogicalNode right) {
-    super(ExprType.JOIN);
+    super(NodeType.JOIN);
     this.joinType = joinType;
-    setOuter(left);
-    setInner(right);
+    setLeftChild(left);
+    setRightChild(right);
   }
 
   public JoinType getJoinType() {
@@ -83,7 +83,7 @@ public class JoinNode extends BinaryNode implements Projectable, Cloneable {
   public boolean equals(Object obj) {
     if (obj instanceof JoinNode) {
       JoinNode other = (JoinNode) obj;
-      return super.equals(other) && outer.equals(other.outer)
+      return super.equals(other) && leftChild.equals(other.leftChild)
           && inner.equals(other.inner);
     } else {
       return false;
@@ -118,7 +118,7 @@ public class JoinNode extends BinaryNode implements Projectable, Cloneable {
 
     sb.append("\n\"out schema: ").append(getOutSchema());
     sb.append("\n\"in schema: ").append(getInSchema());
-    sb.append("\n" + getOuterNode().toString()).append(" and ").append(getInnerNode());
+    sb.append("\n" + getLeftChild().toString()).append(" and ").append(getRightChild());
     return sb.toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LimitNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LimitNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LimitNode.java
index 1d24941..d5bc926 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LimitNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LimitNode.java
@@ -28,7 +28,7 @@ public final class LimitNode extends UnaryNode implements Cloneable {
 	}
 
   public LimitNode(long fetchFirstNum) {
-    super(ExprType.LIMIT);
+    super(NodeType.LIMIT);
     this.fetchFirstNum = fetchFirstNum;
   }
   
@@ -42,7 +42,7 @@ public final class LimitNode extends UnaryNode implements Cloneable {
       LimitNode other = (LimitNode) obj;
       return super.equals(other)
           && fetchFirstNum == other.fetchFirstNum
-          && subExpr.equals(other.subExpr);
+          && child.equals(other.child);
     } else {
       return false;
     }
@@ -60,7 +60,7 @@ public final class LimitNode extends UnaryNode implements Cloneable {
 
     sb.append("\n\"out schema: ").append(getOutSchema())
         .append("\n\"in schema: " + getInSchema());
-    sb.append("\n").append(getSubNode().toString());
+    sb.append("\n").append(getChild().toString());
 
     return sb.toString();
   }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LogicalNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LogicalNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LogicalNode.java
index 4891d82..6daaa50 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LogicalNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LogicalNode.java
@@ -28,7 +28,7 @@ import org.apache.tajo.engine.json.CoreGsonHelper;
 import org.apache.tajo.util.TUtil;
 
 public abstract class LogicalNode implements Cloneable, GsonObject {
-  @Expose private ExprType type;
+  @Expose private NodeType type;
 	@Expose private Schema inputSchema;
 	@Expose	private Schema outputSchema;
 
@@ -38,15 +38,15 @@ public abstract class LogicalNode implements Cloneable, GsonObject {
 		
 	}
 
-	public LogicalNode(ExprType type) {
+	public LogicalNode(NodeType type) {
 		this.type = type;
 	}
 	
-	public ExprType getType() {
+	public NodeType getType() {
 		return this.type;
 	}
 
-	public void setType(ExprType type) {
+	public void setType(NodeType type) {
 		this.type = type;
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LogicalRootNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LogicalRootNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LogicalRootNode.java
index 8b2fa77..67c08a6 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LogicalRootNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/LogicalRootNode.java
@@ -20,11 +20,11 @@ package org.apache.tajo.engine.planner.logical;
 
 public class LogicalRootNode extends UnaryNode implements Cloneable {
   public LogicalRootNode() {
-    super(ExprType.ROOT);
+    super(NodeType.ROOT);
   }
   
   public String toString() {
-    return "Logical Plan Root\n\n" + getSubNode().toString();
+    return "Logical Plan Root\n\n" + getChild().toString();
   }
   
   @Override
@@ -32,7 +32,7 @@ public class LogicalRootNode extends UnaryNode implements Cloneable {
     if (obj instanceof LogicalRootNode) {
       LogicalRootNode other = (LogicalRootNode) obj;
       boolean b1 = super.equals(other);
-      boolean b2 = subExpr.equals(other.subExpr);
+      boolean b2 = child.equals(other.child);
       
       return b1 && b2;
     } else {

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/NodeType.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/NodeType.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/NodeType.java
new file mode 100644
index 0000000..7f1505c
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/NodeType.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ *
+ */
+package org.apache.tajo.engine.planner.logical;
+
+/**
+ * This indicates a logical node type.
+ */
+public enum NodeType {
+  BST_INDEX_SCAN(IndexScanNode.class),
+  CREATE_TABLE(CreateTableNode.class),
+  DROP_TABLE(DropTableNode.class),
+  EXCEPT(ExceptNode.class),
+  EXPRS(EvalExprNode.class),
+  GROUP_BY(GroupbyNode.class),
+  INTERSECT(IntersectNode.class),
+  LIMIT(LimitNode.class),
+  JOIN(JoinNode.class),
+  PROJECTION(ProjectionNode.class),
+  RECEIVE(ReceiveNode.class),
+  ROOT(LogicalRootNode.class),
+  SEND(SendNode.class),
+  SCAN(ScanNode.class),
+  SELECTION(SelectionNode.class),
+  STORE(StoreTableNode.class),
+  SORT(SortNode.class),
+  UNION(UnionNode.class);
+
+  private final Class<? extends LogicalNode> baseClass;
+
+  NodeType(Class<? extends LogicalNode> baseClass) {
+    this.baseClass = baseClass;
+  }
+
+  public Class<? extends LogicalNode> getBaseClass() {
+    return this.baseClass;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/PipeType.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/PipeType.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/PipeType.java
new file mode 100644
index 0000000..0355b21
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/PipeType.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.engine.planner.logical;
+
+public enum PipeType {
+  PULL,
+  PUSH
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ProjectionNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ProjectionNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ProjectionNode.java
index 128bd43..90891bc 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ProjectionNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ProjectionNode.java
@@ -42,7 +42,7 @@ public class ProjectionNode extends UnaryNode implements Projectable {
    * @param targets they should be all evaluated ones.
    */
 	public ProjectionNode(Target [] targets) {		
-		super(ExprType.PROJECTION);
+		super(NodeType.PROJECTION);
 		this.targets = targets;
 	}
 
@@ -60,8 +60,8 @@ public class ProjectionNode extends UnaryNode implements Projectable {
     return this.targets;
   }
 	
-	public void setSubNode(LogicalNode subNode) {
-	  super.setSubNode(subNode);
+	public void setChild(LogicalNode subNode) {
+	  super.setChild(subNode);
 	}
 	
 	public String toString() {
@@ -83,7 +83,7 @@ public class ProjectionNode extends UnaryNode implements Projectable {
 	  sb.append("\n  \"in schema\": ").append(getInSchema());
 	  sb.append("}");
 	  return sb.toString()+"\n"
-	      + getSubNode().toString();
+	      + getChild().toString();
 	}
 	
 	@Override
@@ -93,7 +93,7 @@ public class ProjectionNode extends UnaryNode implements Projectable {
 	    
 	    boolean b1 = super.equals(other);
 	    boolean b2 = Arrays.equals(targets, other.targets);
-	    boolean b3 = subExpr.equals(other.subExpr);
+	    boolean b3 = child.equals(other.child);
 	    
 	    return b1 && b2 && b3;
 	  } else {

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ReceiveNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ReceiveNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ReceiveNode.java
new file mode 100644
index 0000000..1e566b0
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ReceiveNode.java
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * 
+ */
+package org.apache.tajo.engine.planner.logical;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.gson.Gson;
+import com.google.gson.annotations.Expose;
+import org.apache.tajo.engine.json.CoreGsonHelper;
+import org.apache.tajo.engine.planner.logical.NodeType;
+import org.apache.tajo.engine.planner.logical.LogicalNode;
+import org.apache.tajo.engine.planner.logical.LogicalNodeVisitor;
+
+import java.net.URI;
+import java.util.*;
+import java.util.Map.Entry;
+
+public final class ReceiveNode extends LogicalNode implements Cloneable {
+  @Expose private PipeType pipeType;
+  @Expose private RepartitionType repaType;
+  @Expose private Map<String, List<URI>> fetchMap;
+
+  private ReceiveNode() {
+    super(NodeType.RECEIVE);
+  }
+  public ReceiveNode(PipeType pipeType, RepartitionType shuffleType) {
+    this();
+    this.pipeType = pipeType;
+    this.repaType = shuffleType;
+    this.fetchMap = Maps.newHashMap();
+  }
+
+  public PipeType getPipeType() {
+    return this.pipeType;
+  }
+
+  public RepartitionType getRepartitionType() {
+    return this.repaType;
+  }
+  
+  public void addData(String name, URI uri) {
+    if (fetchMap.containsKey(name)) {
+      fetchMap.get(name).add(uri);
+    } else {
+      fetchMap.put(name, Lists.newArrayList(uri));
+    }
+  }
+  
+  public Collection<URI> getSrcURIs(String name) {
+    return Collections.unmodifiableList(fetchMap.get(name));
+  }
+
+  public Collection<Entry<String, List<URI>>> getAllDataSet() {
+    return Collections.unmodifiableSet(fetchMap.entrySet());
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj instanceof ReceiveNode) {
+      ReceiveNode other = (ReceiveNode) obj;
+      return pipeType == other.pipeType && repaType == other.repaType;
+    } else {
+      return false;
+    }
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hashCode(pipeType, repaType);
+  }
+
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    ReceiveNode receive = (ReceiveNode) super.clone();
+    receive.pipeType = pipeType;
+    receive.repaType = repaType;
+    receive.fetchMap = Maps.newHashMap();
+    // Both String and URI are immutable, but a list is mutable.
+    for (Entry<String, List<URI>> entry : fetchMap.entrySet()) {
+      receive.fetchMap
+          .put(entry.getKey(), new ArrayList<URI>(entry.getValue()));
+    }
+
+    return receive;
+  }
+
+  @Override
+  public String toString() {
+    Gson gson = CoreGsonHelper.getPrettyInstance();
+    return gson.toJson(this);
+  }
+
+  @Override
+  public void preOrder(LogicalNodeVisitor visitor) {
+    visitor.visit(this);
+  }
+  
+  @Override
+  public void postOrder(LogicalNodeVisitor visitor) {
+    visitor.visit(this);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/RepartitionType.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/RepartitionType.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/RepartitionType.java
new file mode 100644
index 0000000..d317fb8
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/RepartitionType.java
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.engine.planner.logical;
+
+public enum RepartitionType {
+  NONE,
+  HASH,
+  SORT
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ScanNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ScanNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ScanNode.java
index 6b45e8a..584a697 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ScanNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/ScanNode.java
@@ -39,7 +39,7 @@ public class ScanNode extends LogicalNode implements Projectable {
 	}
   
 	public ScanNode(FromTable table) {
-		super(ExprType.SCAN);
+		super(NodeType.SCAN);
 		this.table = table;
 		this.setInSchema(table.getSchema());
 		this.setOutSchema(table.getSchema());

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SelectionNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SelectionNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SelectionNode.java
index 2bd1e81..2b2a0ac 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SelectionNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SelectionNode.java
@@ -29,7 +29,7 @@ public class SelectionNode extends UnaryNode implements Cloneable {
 	}
 	
 	public SelectionNode(EvalNode qual) {
-		super(ExprType.SELECTION);
+		super(NodeType.SELECTION);
 		setQual(qual);
 	}
 
@@ -48,7 +48,7 @@ public class SelectionNode extends UnaryNode implements Cloneable {
     sb.append("\n  \"in schema\": ").append(getInSchema()).append("}");
     
     return sb.toString()+"\n"
-    + getSubNode().toString();
+    + getChild().toString();
   }
   
   @Override
@@ -57,7 +57,7 @@ public class SelectionNode extends UnaryNode implements Cloneable {
       SelectionNode other = (SelectionNode) obj;
       return super.equals(other) 
           && this.qual.equals(other.qual)
-          && subExpr.equals(other.subExpr);
+          && child.equals(other.child);
     } else {
       return false;
     }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SendNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SendNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SendNode.java
new file mode 100644
index 0000000..5456a77
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SendNode.java
@@ -0,0 +1,145 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * 
+ */
+package org.apache.tajo.engine.planner.logical;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import com.google.gson.Gson;
+import com.google.gson.annotations.Expose;
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.engine.json.CoreGsonHelper;
+import org.apache.tajo.engine.planner.logical.NodeType;
+import org.apache.tajo.engine.planner.logical.UnaryNode;
+import org.apache.tajo.util.TUtil;
+
+import java.net.URI;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * This logical node means that the worker sends intermediate data to 
+ * some destined one or more workers.
+ */
+public class SendNode extends UnaryNode {
+  @Expose private PipeType pipeType;
+  @Expose private RepartitionType repaType;
+  /** This will be used for pipeType == PUSH. */
+  @Expose private Map<Integer, URI> destURIs;
+  @Expose private Column[] partitionKeys;
+  @Expose private int numPartitions;
+
+  private SendNode() {
+    super(NodeType.SEND);
+  }
+  
+  public SendNode(PipeType pipeType, RepartitionType repaType) {
+    this();
+    this.pipeType = pipeType;
+    this.repaType = repaType;
+    this.destURIs = Maps.newHashMap();
+  }
+
+  public PipeType getPipeType() {
+    return this.pipeType;
+  }
+  
+  public RepartitionType getRepartitionType() {
+    return this.repaType;
+  }
+  
+  public URI getDestURI(int partition) {
+    return this.destURIs.get(partition);
+  }
+  
+  public void setPartitionKeys(Column [] keys, int numPartitions) {
+    Preconditions.checkState(repaType != RepartitionType.NONE,
+        "Hash or Sort repartition only requires the partition keys");
+    Preconditions.checkArgument(keys.length > 0, 
+        "At least one partition key must be specified.");
+    Preconditions.checkArgument(numPartitions > 0,
+        "The number of partitions must be positive: %s", numPartitions);
+    this.partitionKeys = keys;
+    this.numPartitions = numPartitions;
+  }
+  
+  public boolean hasPartitionKeys() {
+    return this.partitionKeys != null;
+  }
+  
+  public Column [] getPartitionKeys() {
+    return this.partitionKeys;
+  }
+  
+  public int getPartitionsNum() {
+    return this.numPartitions;
+  }
+  
+  public Iterator<Entry<Integer, URI>> getAllDestURIs() {
+    return this.destURIs.entrySet().iterator();
+  }
+  
+  public void putDestURI(int partition, URI uri) {
+    this.destURIs.put(partition, uri);
+  }
+  
+  public void setDestURIs(Map<Integer, URI> destURIs) {
+    this.destURIs = destURIs;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj instanceof SendNode) {
+      SendNode other = (SendNode) obj;
+      return pipeType == other.pipeType
+          && repaType == other.repaType
+          && TUtil.checkEquals(destURIs, other.destURIs);
+    } else {
+      return false;
+    }
+  }
+  
+  @Override
+  public int hashCode() {
+    return Objects.hashCode(pipeType, repaType, destURIs);
+  }
+  
+  @Override
+  public Object clone() throws CloneNotSupportedException {
+    SendNode send = (SendNode) super.clone();
+    send.pipeType = pipeType;
+    send.repaType = repaType;
+    send.destURIs = Maps.newHashMap();
+    for (Entry<Integer, URI> entry : destURIs.entrySet()) {
+      send.destURIs.put(entry.getKey(), entry.getValue());
+    }
+    
+    return send;
+  }
+
+  @Override
+  public String toString() {
+    Gson gson = CoreGsonHelper.getPrettyInstance();
+    return gson.toJson(this);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SortNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SortNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SortNode.java
index 4efe842..e053c3c 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SortNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/SortNode.java
@@ -33,7 +33,7 @@ public final class SortNode extends UnaryNode implements Cloneable {
 	}
 
   public SortNode(SortSpec[] sortKeys) {
-    super(ExprType.SORT);
+    super(NodeType.SORT);
     Preconditions.checkArgument(sortKeys.length > 0, 
         "At least one sort key must be specified");
     this.sortKeys = sortKeys;
@@ -55,7 +55,7 @@ public final class SortNode extends UnaryNode implements Cloneable {
       SortNode other = (SortNode) obj;
       boolean eq = super.equals(other);
       eq = eq && TUtil.checkEquals(sortKeys, other.sortKeys);
-      eq = eq && subExpr.equals(other.subExpr);
+      eq = eq && child.equals(other.child);
       return eq;
     } else {
       return false;
@@ -84,6 +84,6 @@ public final class SortNode extends UnaryNode implements Cloneable {
     sb.append("\n\"out schema: " + getOutSchema()
         + "\n\"in schema: " + getInSchema());
     return sb.toString()+"\n"
-        + getSubNode().toString();
+        + getChild().toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/StoreTableNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/StoreTableNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/StoreTableNode.java
index ec7b1b7..7bdb587 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/StoreTableNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/StoreTableNode.java
@@ -37,7 +37,7 @@ public class StoreTableNode extends UnaryNode implements Cloneable {
   @Expose private Options options;
 
   public StoreTableNode(String tableName) {
-    super(ExprType.STORE);
+    super(NodeType.STORE);
     this.tableName = tableName;
     this.local = false;
   }
@@ -121,7 +121,7 @@ public class StoreTableNode extends UnaryNode implements Cloneable {
       eq = eq && this.numPartitions == other.numPartitions;
       eq = eq && TUtil.checkEquals(partitionKeys, other.partitionKeys);
       eq = eq &&  TUtil.checkEquals(options, other.options);
-      eq = eq && subExpr.equals(other.subExpr);
+      eq = eq && child.equals(other.child);
       return eq;
     } else {
       return false;
@@ -162,6 +162,6 @@ public class StoreTableNode extends UnaryNode implements Cloneable {
     .append("}");
     
     return sb.toString() + "\n"
-        + getSubNode().toString();
+        + getChild().toString();
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/UnaryNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/UnaryNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/UnaryNode.java
index cd3aa1c..4380996 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/UnaryNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/UnaryNode.java
@@ -25,7 +25,7 @@ import com.google.gson.annotations.Expose;
 
 
 public abstract class UnaryNode extends LogicalNode implements Cloneable {
-	@Expose LogicalNode subExpr;
+	@Expose LogicalNode child;
 	
 	public UnaryNode() {
 		super();
@@ -34,33 +34,33 @@ public abstract class UnaryNode extends LogicalNode implements Cloneable {
 	/**
 	 * @param type
 	 */
-	public UnaryNode(ExprType type) {
+	public UnaryNode(NodeType type) {
 		super(type);
 	}
 	
-	public void setSubNode(LogicalNode subNode) {
-		this.subExpr = subNode;
+	public void setChild(LogicalNode subNode) {
+		this.child = subNode;
 	}
 	
-	public LogicalNode getSubNode() {
-		return this.subExpr;
+	public LogicalNode getChild() {
+		return this.child;
 	}
 	
 	@Override
   public Object clone() throws CloneNotSupportedException {
 	  UnaryNode unary = (UnaryNode) super.clone();
-	  unary.subExpr = (LogicalNode) (subExpr == null ? null : subExpr.clone());
+	  unary.child = (LogicalNode) (child == null ? null : child.clone());
 	  
 	  return unary;
 	}
 	
 	public void preOrder(LogicalNodeVisitor visitor) {
 	  visitor.visit(this);
-	  subExpr.preOrder(visitor);
+	  child.preOrder(visitor);
   }
 	
 	public void postOrder(LogicalNodeVisitor visitor) {
-	  subExpr.postOrder(visitor);	  
+	  child.postOrder(visitor);
 	  visitor.visit(this);
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/UnionNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/UnionNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/UnionNode.java
index d0ded08..c0aafbd 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/UnionNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/UnionNode.java
@@ -24,16 +24,16 @@ package org.apache.tajo.engine.planner.logical;
 public class UnionNode extends BinaryNode {
 
   public UnionNode() {
-    super(ExprType.UNION);
+    super(NodeType.UNION);
   }
 
   public UnionNode(LogicalNode outer, LogicalNode inner) {
     this();
-    setOuter(outer);
-    setInner(inner);
+    setLeftChild(outer);
+    setRightChild(inner);
   }
 
   public String toString() {
-    return getOuterNode().toString() + "\n UNION \n" + getInnerNode().toString();
+    return getLeftChild().toString() + "\n UNION \n" + getRightChild().toString();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/PipeType.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/PipeType.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/PipeType.java
deleted file mode 100644
index 849bd30..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/PipeType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.engine.planner.logical.extended;
-
-public enum PipeType {
-  PULL,
-  PUSH
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/ReceiveNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/ReceiveNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/ReceiveNode.java
deleted file mode 100644
index 94ecffe..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/ReceiveNode.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * 
- */
-package org.apache.tajo.engine.planner.logical.extended;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.gson.Gson;
-import com.google.gson.annotations.Expose;
-import org.apache.tajo.engine.json.CoreGsonHelper;
-import org.apache.tajo.engine.planner.logical.ExprType;
-import org.apache.tajo.engine.planner.logical.LogicalNode;
-import org.apache.tajo.engine.planner.logical.LogicalNodeVisitor;
-
-import java.net.URI;
-import java.util.*;
-import java.util.Map.Entry;
-
-public final class ReceiveNode extends LogicalNode implements Cloneable {
-  @Expose private PipeType pipeType;
-  @Expose private RepartitionType repaType;
-  @Expose private Map<String, List<URI>> fetchMap;
-
-  private ReceiveNode() {
-    super(ExprType.RECEIVE);
-  }
-  public ReceiveNode(PipeType pipeType, RepartitionType shuffleType) {
-    this();
-    this.pipeType = pipeType;
-    this.repaType = shuffleType;
-    this.fetchMap = Maps.newHashMap();
-  }
-
-  public PipeType getPipeType() {
-    return this.pipeType;
-  }
-
-  public RepartitionType getRepartitionType() {
-    return this.repaType;
-  }
-  
-  public void addData(String name, URI uri) {
-    if (fetchMap.containsKey(name)) {
-      fetchMap.get(name).add(uri);
-    } else {
-      fetchMap.put(name, Lists.newArrayList(uri));
-    }
-  }
-  
-  public Collection<URI> getSrcURIs(String name) {
-    return Collections.unmodifiableList(fetchMap.get(name));
-  }
-
-  public Collection<Entry<String, List<URI>>> getAllDataSet() {
-    return Collections.unmodifiableSet(fetchMap.entrySet());
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (obj instanceof ReceiveNode) {
-      ReceiveNode other = (ReceiveNode) obj;
-      return pipeType == other.pipeType && repaType == other.repaType;
-    } else {
-      return false;
-    }
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hashCode(pipeType, repaType);
-  }
-
-  @Override
-  public Object clone() throws CloneNotSupportedException {
-    ReceiveNode receive = (ReceiveNode) super.clone();
-    receive.pipeType = pipeType;
-    receive.repaType = repaType;
-    receive.fetchMap = Maps.newHashMap();
-    // Both String and URI are immutable, but a list is mutable.
-    for (Entry<String, List<URI>> entry : fetchMap.entrySet()) {
-      receive.fetchMap
-          .put(entry.getKey(), new ArrayList<URI>(entry.getValue()));
-    }
-
-    return receive;
-  }
-
-  @Override
-  public String toString() {
-    Gson gson = CoreGsonHelper.getPrettyInstance();
-    return gson.toJson(this);
-  }
-
-  @Override
-  public void preOrder(LogicalNodeVisitor visitor) {
-    visitor.visit(this);
-  }
-  
-  @Override
-  public void postOrder(LogicalNodeVisitor visitor) {
-    visitor.visit(this);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/RepartitionType.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/RepartitionType.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/RepartitionType.java
deleted file mode 100644
index e46c55e..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/RepartitionType.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.engine.planner.logical.extended;
-
-public enum RepartitionType {
-  NONE,
-  HASH,
-  SORT
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/SendNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/SendNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/SendNode.java
deleted file mode 100644
index 8d9064e..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/extended/SendNode.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * 
- */
-package org.apache.tajo.engine.planner.logical.extended;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-import com.google.gson.Gson;
-import com.google.gson.annotations.Expose;
-import org.apache.tajo.catalog.Column;
-import org.apache.tajo.engine.json.CoreGsonHelper;
-import org.apache.tajo.engine.planner.logical.ExprType;
-import org.apache.tajo.engine.planner.logical.UnaryNode;
-import org.apache.tajo.util.TUtil;
-
-import java.net.URI;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * This logical node means that the worker sends intermediate data to 
- * some destined one or more workers.
- */
-public class SendNode extends UnaryNode {
-  @Expose private PipeType pipeType;
-  @Expose private RepartitionType repaType;
-  /** This will be used for pipeType == PUSH. */
-  @Expose private Map<Integer, URI> destURIs;
-  @Expose private Column[] partitionKeys;
-  @Expose private int numPartitions;
-
-  private SendNode() {
-    super(ExprType.SEND);
-  }
-  
-  public SendNode(PipeType pipeType, RepartitionType repaType) {
-    this();
-    this.pipeType = pipeType;
-    this.repaType = repaType;
-    this.destURIs = Maps.newHashMap();
-  }
-
-  public PipeType getPipeType() {
-    return this.pipeType;
-  }
-  
-  public RepartitionType getRepartitionType() {
-    return this.repaType;
-  }
-  
-  public URI getDestURI(int partition) {
-    return this.destURIs.get(partition);
-  }
-  
-  public void setPartitionKeys(Column [] keys, int numPartitions) {
-    Preconditions.checkState(repaType != RepartitionType.NONE,
-        "Hash or Sort repartition only requires the partition keys");
-    Preconditions.checkArgument(keys.length > 0, 
-        "At least one partition key must be specified.");
-    Preconditions.checkArgument(numPartitions > 0,
-        "The number of partitions must be positive: %s", numPartitions);
-    this.partitionKeys = keys;
-    this.numPartitions = numPartitions;
-  }
-  
-  public boolean hasPartitionKeys() {
-    return this.partitionKeys != null;
-  }
-  
-  public Column [] getPartitionKeys() {
-    return this.partitionKeys;
-  }
-  
-  public int getPartitionsNum() {
-    return this.numPartitions;
-  }
-  
-  public Iterator<Entry<Integer, URI>> getAllDestURIs() {
-    return this.destURIs.entrySet().iterator();
-  }
-  
-  public void putDestURI(int partition, URI uri) {
-    this.destURIs.put(partition, uri);
-  }
-  
-  public void setDestURIs(Map<Integer, URI> destURIs) {
-    this.destURIs = destURIs;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (obj instanceof SendNode) {
-      SendNode other = (SendNode) obj;
-      return pipeType == other.pipeType
-          && repaType == other.repaType
-          && TUtil.checkEquals(destURIs, other.destURIs);
-    } else {
-      return false;
-    }
-  }
-  
-  @Override
-  public int hashCode() {
-    return Objects.hashCode(pipeType, repaType, destURIs);
-  }
-  
-  @Override
-  public Object clone() throws CloneNotSupportedException {
-    SendNode send = (SendNode) super.clone();
-    send.pipeType = pipeType;
-    send.repaType = repaType;
-    send.destURIs = Maps.newHashMap();
-    for (Entry<Integer, URI> entry : destURIs.entrySet()) {
-      send.destURIs.put(entry.getKey(), entry.getValue());
-    }
-    
-    return send;
-  }
-
-  @Override
-  public String toString() {
-    Gson gson = CoreGsonHelper.getPrettyInstance();
-    return gson.toJson(this);
-  }
-}
\ No newline at end of file


Mime
View raw message