tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject [2/4] TAJO-123: Clean up the logical plan's json format. (hyunsik)
Date Mon, 19 Aug 2013 09:23:53 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/physical/AggregationExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/AggregationExec.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/AggregationExec.java
index e7ee5bf..a00fa41 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/AggregationExec.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/physical/AggregationExec.java
@@ -25,6 +25,7 @@ import org.apache.tajo.datum.DatumFactory;
 import org.apache.tajo.engine.eval.ConstEval;
 import org.apache.tajo.engine.eval.EvalContext;
 import org.apache.tajo.engine.eval.EvalNode;
+import org.apache.tajo.engine.eval.EvalType;
 import org.apache.tajo.engine.planner.Target;
 import org.apache.tajo.engine.planner.logical.GroupbyNode;
 
@@ -78,7 +79,7 @@ public abstract class AggregationExec extends UnaryPhysicalExec {
     evalContexts = new EvalContext[plan.getTargets().length];
     for (int i = 0; i < plan.getTargets().length; i++) {
       Target t = plan.getTargets()[i];
-      if (t.getEvalTree().getType() == EvalNode.Type.FIELD && !nonNullGroupingFields.contains(t.getColumnSchema())) {
+      if (t.getEvalTree().getType() == EvalType.FIELD && !nonNullGroupingFields.contains(t.getColumnSchema())) {
         evals[i] = new ConstEval(DatumFactory.createNullDatum());
         evalContexts[i] = evals[i].newContext();
       } 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/rewrite/FilterPushDownRule.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/rewrite/FilterPushDownRule.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/rewrite/FilterPushDownRule.java
index d5e427c..1ae4c1c 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/rewrite/FilterPushDownRule.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/rewrite/FilterPushDownRule.java
@@ -45,13 +45,13 @@ public class FilterPushDownRule extends BasicLogicalPlanVisitor<List<EvalNode>>
   public boolean isEligible(LogicalPlan plan) {
     LogicalNode toBeOptimized = plan.getRootBlock().getRoot();
 
-    return PlannerUtil.findTopNode(toBeOptimized, ExprType.SELECTION) != null;
+    return PlannerUtil.findTopNode(toBeOptimized, NodeType.SELECTION) != null;
   }
 
   @Override
   public LogicalPlan rewrite(LogicalPlan plan) throws PlanningException {
     LogicalNode root = plan.getRootBlock().getRoot();
-    SelectionNode selNode = (SelectionNode) PlannerUtil.findTopNode(root, ExprType.SELECTION);
+    SelectionNode selNode = (SelectionNode) PlannerUtil.findTopNode(root, NodeType.SELECTION);
     Preconditions.checkNotNull(selNode);
 
     Stack<LogicalNode> stack = new Stack<LogicalNode>();
@@ -64,7 +64,7 @@ public class FilterPushDownRule extends BasicLogicalPlanVisitor<List<EvalNode>>
   public LogicalNode visitFilter(LogicalPlan plan, SelectionNode selNode, Stack<LogicalNode> stack, List<EvalNode> cnf)
       throws PlanningException {
     stack.push(selNode);
-    visitChild(plan, selNode.getSubNode(), stack, cnf);
+    visitChild(plan, selNode.getChild(), stack, cnf);
     stack.pop();
 
     // remove the selection operator if there is no search condition
@@ -73,7 +73,7 @@ public class FilterPushDownRule extends BasicLogicalPlanVisitor<List<EvalNode>>
       LogicalNode node = stack.peek();
       if (node instanceof UnaryNode) {
         UnaryNode unary = (UnaryNode) node;
-        unary.setSubNode(selNode.getSubNode());
+        unary.setChild(selNode.getChild());
       } else {
         throw new InvalidQueryException("Unexpected Logical Query Plan");
       }
@@ -84,11 +84,11 @@ public class FilterPushDownRule extends BasicLogicalPlanVisitor<List<EvalNode>>
 
   public LogicalNode visitJoin(LogicalPlan plan, JoinNode joinNode, Stack<LogicalNode> stack, List<EvalNode> cnf)
       throws PlanningException {
-    LogicalNode outer = joinNode.getOuterNode();
-    LogicalNode inner = joinNode.getInnerNode();
+    LogicalNode left = joinNode.getRightChild();
+    LogicalNode right = joinNode.getLeftChild();
 
-    visitChild(plan, outer, stack, cnf);
-    visitChild(plan, inner, stack, cnf);
+    visitChild(plan, left, stack, cnf);
+    visitChild(plan, right, stack, cnf);
 
     List<EvalNode> matched = Lists.newArrayList();
     for (EvalNode eval : cnf) {

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/rewrite/ProjectionPushDownRule.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/rewrite/ProjectionPushDownRule.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/rewrite/ProjectionPushDownRule.java
index 46740b5..89a935a 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/rewrite/ProjectionPushDownRule.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/rewrite/ProjectionPushDownRule.java
@@ -27,6 +27,7 @@ import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.SortSpec;
 import org.apache.tajo.engine.eval.EvalNode;
 import org.apache.tajo.engine.eval.EvalTreeUtil;
+import org.apache.tajo.engine.eval.EvalType;
 import org.apache.tajo.engine.planner.*;
 import org.apache.tajo.engine.planner.logical.*;
 import org.apache.tajo.engine.utils.SchemaUtil;
@@ -108,10 +109,10 @@ public class ProjectionPushDownRule extends BasicLogicalPlanVisitor<ProjectionPu
     }
 
     stack.push(node);
-    LogicalNode child = visitChild(plan, node.getSubNode(), stack, context);
+    LogicalNode child = visitChild(plan, node.getChild(), stack, context);
     stack.pop();
 
-    LogicalNode childNode = node.getSubNode();
+    LogicalNode childNode = node.getChild();
 
     // If all expressions are evaluated in the child operators and the last operator is projectable,
     // ProjectionNode will not be necessary. It eliminates ProjectionNode.
@@ -181,7 +182,7 @@ public class ProjectionPushDownRule extends BasicLogicalPlanVisitor<ProjectionPu
       EvalNode expr;
       for (Target target : node.getTargets()) {
         expr = target.getEvalTree();
-        if (expr.getType() != EvalNode.Type.FIELD) {
+        if (expr.getType() != EvalType.FIELD) {
           currentRequired.addAll(EvalTreeUtil.findDistinctRefColumns(target.getEvalTree()));
         }
       }
@@ -197,8 +198,8 @@ public class ProjectionPushDownRule extends BasicLogicalPlanVisitor<ProjectionPu
     rightContext.upperRequired = currentRequired;
 
     stack.push(node);
-    LogicalNode outer = visitChild(plan, node.getOuterNode(), stack, leftContext);
-    LogicalNode inner = visitChild(plan, node.getInnerNode(), stack, rightContext);
+    LogicalNode outer = visitChild(plan, node.getLeftChild(), stack, leftContext);
+    LogicalNode inner = visitChild(plan, node.getRightChild(), stack, rightContext);
     stack.pop();
 
     Schema merged = SchemaUtil.merge(outer.getOutSchema(), inner.getOutSchema());
@@ -242,7 +243,7 @@ public class ProjectionPushDownRule extends BasicLogicalPlanVisitor<ProjectionPu
       throws PlanningException {
 
     stack.push(node);
-    LogicalNode child = visitChild(context.plan, node.getSubNode(), stack, context);
+    LogicalNode child = visitChild(context.plan, node.getChild(), stack, context);
     stack.pop();
     node.setInSchema(child.getOutSchema());
     node.setOutSchema(child.getOutSchema());
@@ -267,7 +268,7 @@ public class ProjectionPushDownRule extends BasicLogicalPlanVisitor<ProjectionPu
 
         if (node instanceof ScanNode) { // For ScanNode
 
-          if (expr.getType() == EvalNode.Type.FIELD && !targetListManager.getTarget(i).hasAlias()) {
+          if (expr.getType() == EvalType.FIELD && !targetListManager.getTarget(i).hasAlias()) {
             targetListManager.setEvaluated(i);
           } else if (EvalTreeUtil.findDistinctAggFunction(expr).size() == 0) {
             targetListManager.setEvaluated(i);
@@ -275,13 +276,13 @@ public class ProjectionPushDownRule extends BasicLogicalPlanVisitor<ProjectionPu
           }
 
         } else if (node instanceof GroupbyNode) { // For GroupBy
-          if (EvalTreeUtil.findDistinctAggFunction(expr).size() > 0 && expr.getType() != EvalNode.Type.FIELD) {
+          if (EvalTreeUtil.findDistinctAggFunction(expr).size() > 0 && expr.getType() != EvalType.FIELD) {
             targetListManager.setEvaluated(i);
             newEvaluatedTargetIds.add(i);
           }
 
         } else if (node instanceof JoinNode) {
-          if (expr.getType() != EvalNode.Type.FIELD && EvalTreeUtil.findDistinctAggFunction(expr).size() == 0) {
+          if (expr.getType() != EvalType.FIELD && EvalTreeUtil.findDistinctAggFunction(expr).size() == 0) {
             targetListManager.setEvaluated(i);
             newEvaluatedTargetIds.add(i);
           }
@@ -338,7 +339,7 @@ public class ProjectionPushDownRule extends BasicLogicalPlanVisitor<ProjectionPu
 
   private static boolean isTopmostProjectable(Stack<LogicalNode> stack) {
     for (LogicalNode node : stack) {
-      if (node.getType() == ExprType.JOIN || node.getType() == ExprType.GROUP_BY) {
+      if (node.getType() == NodeType.JOIN || node.getType() == NodeType.GROUP_BY) {
         return false;
       }
     }
@@ -349,25 +350,25 @@ public class ProjectionPushDownRule extends BasicLogicalPlanVisitor<ProjectionPu
   private BinaryNode pushDownSetNode(LogicalPlan plan, BinaryNode setNode, Stack<LogicalNode> stack,
                                             PushDownContext context) throws PlanningException {
 
-    LogicalPlan.QueryBlock leftBlock = plan.getBlock(setNode.getOuterNode());
+    LogicalPlan.QueryBlock leftBlock = plan.getBlock(setNode.getLeftChild());
     PushDownContext leftContext = new PushDownContext(context);
     leftContext.targetListManager = new TargetListManager(plan,
         leftBlock.getTargetListManager().getUnEvaluatedTargets());
 
-    LogicalPlan.QueryBlock rightBlock = plan.getBlock(setNode.getInnerNode());
+    LogicalPlan.QueryBlock rightBlock = plan.getBlock(setNode.getRightChild());
     PushDownContext rightContext = new PushDownContext(context);
     rightContext.targetListManager = new TargetListManager(plan,
         rightBlock.getTargetListManager().getUnEvaluatedTargets());
 
 
     stack.push(setNode);
-    visitChild(plan, setNode.getOuterNode(), stack, leftContext);
-    visitChild(plan, setNode.getInnerNode(), stack, rightContext);
+    visitChild(plan, setNode.getLeftChild(), stack, leftContext);
+    visitChild(plan, setNode.getRightChild(), stack, rightContext);
     stack.pop();
 
     // if this is the final union, we assume that all targets are evalauted.
     // TODO - is it always correct?
-    if (stack.peek().getType() != ExprType.UNION) {
+    if (stack.peek().getType() != NodeType.UNION) {
       context.targetListManager.setEvaluatedAll();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/ExecutionBlock.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/ExecutionBlock.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/ExecutionBlock.java
index 69d0804..36327ff 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/ExecutionBlock.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/ExecutionBlock.java
@@ -72,8 +72,7 @@ public class ExecutionBlock {
 
   public void setPlan(LogicalNode plan) {
     hasJoinPlan = false;
-    Preconditions.checkArgument(plan.getType() == ExprType.STORE
-        || plan.getType() == ExprType.CREATE_INDEX);
+    Preconditions.checkArgument(plan.getType() == NodeType.STORE);
 
     this.plan = plan;
     store = (StoreTableNode) plan;
@@ -85,16 +84,16 @@ public class ExecutionBlock {
       node = s.remove(s.size()-1);
       if (node instanceof UnaryNode) {
         UnaryNode unary = (UnaryNode) node;
-        s.add(s.size(), unary.getSubNode());
+        s.add(s.size(), unary.getChild());
       } else if (node instanceof BinaryNode) {
         BinaryNode binary = (BinaryNode) node;
-        if (binary.getType() == ExprType.JOIN) {
+        if (binary.getType() == NodeType.JOIN) {
           hasJoinPlan = true;
-        } else if (binary.getType() == ExprType.UNION) {
+        } else if (binary.getType() == NodeType.UNION) {
           hasUnionPlan = true;
         }
-        s.add(s.size(), binary.getOuterNode());
-        s.add(s.size(), binary.getInnerNode());
+        s.add(s.size(), binary.getLeftChild());
+        s.add(s.size(), binary.getRightChild());
       } else if (node instanceof ScanNode) {
         scanlist.add((ScanNode)node);
       }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
index 3d9a364..8c3617e 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
@@ -122,7 +122,7 @@ public class GlobalEngine extends AbstractService {
     LogicalRootNode plan = (LogicalRootNode) createLogicalPlan(planningContext);
 
     if (PlannerUtil.checkIfDDLPlan(plan)) {
-      updateQuery(plan.getSubNode());
+      updateQuery(plan.getChild());
       return TajoIdUtils.NullQueryId;
     } else {
       GetNewApplicationResponse newApp = yarnClient.getNewApplication();
@@ -136,8 +136,8 @@ public class GlobalEngine extends AbstractService {
       QueryConf queryConf = new QueryConf(context.getConf());
       queryConf.setUser(UserGroupInformation.getCurrentUser().getShortUserName());
       // the output table is given by user
-      if (plan.getSubNode().getType() == ExprType.CREATE_TABLE) {
-        CreateTableNode createTableNode = (CreateTableNode) plan.getSubNode();
+      if (plan.getChild().getType() == NodeType.CREATE_TABLE) {
+        CreateTableNode createTableNode = (CreateTableNode) plan.getChild();
         queryConf.setOutputTable(createTableNode.getTableName());
       }
       QueryMasterManager queryMasterManager = new QueryMasterManager(context, yarnClient, queryId, tql, plan, appId,
@@ -241,7 +241,7 @@ public class GlobalEngine extends AbstractService {
     if (!PlannerUtil.checkIfDDLPlan(plan)) {
       throw new SQLException("This is not update query:\n" + sql);
     } else {
-      updateQuery(plan.getSubNode());
+      updateQuery(plan.getChild());
       return TajoIdUtils.NullQueryId;
     }
   }
@@ -338,7 +338,7 @@ public class GlobalEngine extends AbstractService {
     StorageUtil.writeTableMeta(context.getConf(), path, meta);
     catalog.addTable(desc);
 
-    LOG.info("Table " + desc.getId() + " is created (" + desc.getMeta().getStat().getNumBytes() + ")");
+    LOG.info("Table " + desc.getName() + " is created (" + desc.getMeta().getStat().getNumBytes() + ")");
 
     return desc;
   }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalPlanner.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalPlanner.java
index 9522086..8b6ba94 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalPlanner.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalPlanner.java
@@ -66,15 +66,15 @@ public class GlobalPlanner {
     this.queryId = queryId;
 
     String outputTableName = null;
-    if (rootNode.getSubNode().getType() == ExprType.STORE) {
+    if (rootNode.getChild().getType() == NodeType.STORE) {
       // create table queries are executed by the master
-      StoreTableNode storeTableNode = (StoreTableNode) rootNode.getSubNode();
+      StoreTableNode storeTableNode = (StoreTableNode) rootNode.getChild();
       outputTableName = storeTableNode.getTableName();
     }
 
     // insert store at the subnode of the root
     UnaryNode root = rootNode;
-    if (root.getSubNode().getType() != ExprType.STORE) {
+    if (root.getChild().getType() != NodeType.STORE) {
       SubQueryId subQueryId = QueryIdFactory.newSubQueryId(this.queryId);
       outputTableName = subQueryId.toString();
       insertStore(subQueryId.toString(),root).setLocal(false);
@@ -106,40 +106,40 @@ public class GlobalPlanner {
     public void visit(LogicalNode node) {
       String tableId;
       StoreTableNode store;
-      if (node.getType() == ExprType.GROUP_BY) {
+      if (node.getType() == NodeType.GROUP_BY) {
         // transform group by to two-phase plan 
         GroupbyNode groupby = (GroupbyNode) node;
         // insert a store for the child of first group by
-        if (groupby.getSubNode().getType() != ExprType.UNION &&
-            groupby.getSubNode().getType() != ExprType.STORE &&
-            groupby.getSubNode().getType() != ExprType.SCAN) {
+        if (groupby.getChild().getType() != NodeType.UNION &&
+            groupby.getChild().getType() != NodeType.STORE &&
+            groupby.getChild().getType() != NodeType.SCAN) {
           tableId = QueryIdFactory.newSubQueryId(queryId).toString();
           insertStore(tableId, groupby);
         }
         tableId = QueryIdFactory.newSubQueryId(queryId).toString();
         // insert (a store for the first group by) and (a second group by)
         PlannerUtil.transformGroupbyTo2PWithStore((GroupbyNode)node, tableId);
-      } else if (node.getType() == ExprType.SORT) {
+      } else if (node.getType() == NodeType.SORT) {
         // transform sort to two-phase plan 
         SortNode sort = (SortNode) node;
         // insert a store for the child of first sort
-        if (sort.getSubNode().getType() != ExprType.UNION &&
-            sort.getSubNode().getType() != ExprType.STORE &&
-            sort.getSubNode().getType() != ExprType.SCAN) {
+        if (sort.getChild().getType() != NodeType.UNION &&
+            sort.getChild().getType() != NodeType.STORE &&
+            sort.getChild().getType() != NodeType.SCAN) {
           tableId = QueryIdFactory.newSubQueryId(queryId).toString();
           insertStore(tableId, sort);
         }
         tableId = QueryIdFactory.newSubQueryId(queryId).toString();
         // insert (a store for the first sort) and (a second sort)
         PlannerUtil.transformSortTo2PWithStore((SortNode)node, tableId);
-      } else if (node.getType() == ExprType.JOIN) {
+      } else if (node.getType() == NodeType.JOIN) {
         // transform join to two-phase plan 
         // the first phase of two-phase join can be any logical nodes
         JoinNode join = (JoinNode) node;
 
         /*
-        if (join.getOuterNode().getType() == ExprType.SCAN &&
-            join.getInnerNode().getType() == ExprType.SCAN) {
+        if (join.getOuterNode().getType() == NodeType.SCAN &&
+            join.getInnerNode().getType() == NodeType.SCAN) {
           ScanNode outerScan = (ScanNode) join.getOuterNode();
           ScanNode innerScan = (ScanNode) join.getInnerNode();
 
@@ -196,29 +196,29 @@ public class GlobalPlanner {
         } */
 
         // insert stores for the first phase
-        if (join.getOuterNode().getType() != ExprType.UNION &&
-            join.getOuterNode().getType() != ExprType.STORE) {
+        if (join.getLeftChild().getType() != NodeType.UNION &&
+            join.getLeftChild().getType() != NodeType.STORE) {
           tableId = QueryIdFactory.newSubQueryId(queryId).toString();
           store = new StoreTableNode(tableId);
           store.setLocal(true);
           PlannerUtil.insertOuterNode(node, store);
         }
-        if (join.getInnerNode().getType() != ExprType.UNION &&
-            join.getInnerNode().getType() != ExprType.STORE) {
+        if (join.getRightChild().getType() != NodeType.UNION &&
+            join.getRightChild().getType() != NodeType.STORE) {
           tableId = QueryIdFactory.newSubQueryId(queryId).toString();
           store = new StoreTableNode(tableId);
           store.setLocal(true);
           PlannerUtil.insertInnerNode(node, store);
         }
-      } else if (node.getType() == ExprType.UNION) {
+      } else if (node.getType() == NodeType.UNION) {
         // not two-phase transform
         UnionNode union = (UnionNode) node;
         // insert stores
-        if (union.getOuterNode().getType() != ExprType.UNION &&
-            union.getOuterNode().getType() != ExprType.STORE) {
+        if (union.getLeftChild().getType() != NodeType.UNION &&
+            union.getLeftChild().getType() != NodeType.STORE) {
           tableId = QueryIdFactory.newSubQueryId(queryId).toString();
           store = new StoreTableNode(tableId);
-          if(union.getOuterNode().getType() == ExprType.GROUP_BY) {
+          if(union.getLeftChild().getType() == NodeType.GROUP_BY) {
             /*This case is for cube by operator
              * TODO : more complicated conidtion*/
             store.setLocal(true);
@@ -228,11 +228,11 @@ public class GlobalPlanner {
           }
           PlannerUtil.insertOuterNode(node, store);
         }
-        if (union.getInnerNode().getType() != ExprType.UNION &&
-            union.getInnerNode().getType() != ExprType.STORE) {
+        if (union.getRightChild().getType() != NodeType.UNION &&
+            union.getRightChild().getType() != NodeType.STORE) {
           tableId = QueryIdFactory.newSubQueryId(queryId).toString();
           store = new StoreTableNode(tableId);
-          if(union.getInnerNode().getType() == ExprType.GROUP_BY) {
+          if(union.getRightChild().getType() == NodeType.GROUP_BY) {
             /*This case is for cube by operator
              * TODO : more complicated conidtion*/
             store.setLocal(true);
@@ -244,8 +244,8 @@ public class GlobalPlanner {
         }
       } else if (node instanceof UnaryNode) {
         UnaryNode unary = (UnaryNode)node;
-        if (unary.getType() != ExprType.STORE &&
-            unary.getSubNode().getType() != ExprType.STORE) {
+        if (unary.getType() != NodeType.STORE &&
+            unary.getChild().getType() != NodeType.STORE) {
           tableId = QueryIdFactory.newSubQueryId(queryId).toString();
           insertStore(tableId, unary);
         }
@@ -279,9 +279,9 @@ public class GlobalPlanner {
     ExecutionBlock subQuery;
     StoreTableNode store;
     if (node instanceof UnaryNode) {
-      recursiveBuildSubQuery(((UnaryNode) node).getSubNode());
+      recursiveBuildSubQuery(((UnaryNode) node).getChild());
       
-      if (node.getType() == ExprType.STORE) {
+      if (node.getType() == NodeType.STORE) {
         store = (StoreTableNode) node;
         SubQueryId id;
         if (store.getTableName().startsWith(QueryId.PREFIX)) {
@@ -291,7 +291,7 @@ public class GlobalPlanner {
         }
         subQuery = new ExecutionBlock(id);
 
-        switch (store.getSubNode().getType()) {
+        switch (store.getChild().getType()) {
         case BST_INDEX_SCAN:
         case SCAN:  // store - scan
           subQuery = makeScanSubQuery(subQuery);
@@ -327,8 +327,8 @@ public class GlobalPlanner {
         convertMap.put(store, subQuery);
       }
     } else if (node instanceof BinaryNode) {
-      recursiveBuildSubQuery(((BinaryNode) node).getOuterNode());
-      recursiveBuildSubQuery(((BinaryNode) node).getInnerNode());
+      recursiveBuildSubQuery(((BinaryNode) node).getLeftChild());
+      recursiveBuildSubQuery(((BinaryNode) node).getRightChild());
     } else if (node instanceof ScanNode) {
 
     } else {
@@ -355,14 +355,14 @@ public class GlobalPlanner {
     ScanNode newScan;
     ExecutionBlock prev;
     UnaryNode unary = (UnaryNode) plan;
-    UnaryNode child = (UnaryNode) unary.getSubNode();
-    StoreTableNode prevStore = (StoreTableNode)child.getSubNode();
+    UnaryNode child = (UnaryNode) unary.getChild();
+    StoreTableNode prevStore = (StoreTableNode)child.getChild();
 
     // add scan
     newScan = GlobalPlannerUtils.newScanPlan(prevStore.getOutSchema(),
         prevStore.getTableName(), sm.getTablePath(prevStore.getTableName()));
     newScan.setLocal(true);
-    child.setSubNode(newScan);
+    child.setChild(newScan);
     prev = convertMap.get(prevStore);
 
     if (prev != null) {
@@ -392,24 +392,24 @@ public class GlobalPlanner {
     StoreTableNode prevStore;
     ScanNode newScan;
     ExecutionBlock prev;
-    unaryChild = (UnaryNode) unary.getSubNode();  // groupby
-    ExprType curType = unaryChild.getType();
-    if (unaryChild.getSubNode().getType() == ExprType.STORE) {
+    unaryChild = (UnaryNode) unary.getChild();  // groupby
+    NodeType curType = unaryChild.getType();
+    if (unaryChild.getChild().getType() == NodeType.STORE) {
       // store - groupby - store
-      unaryChild = (UnaryNode) unaryChild.getSubNode(); // store
+      unaryChild = (UnaryNode) unaryChild.getChild(); // store
       prevStore = (StoreTableNode) unaryChild;
       newScan = GlobalPlannerUtils.newScanPlan(prevStore.getOutSchema(),
           prevStore.getTableName(),
           sm.getTablePath(prevStore.getTableName()));
       newScan.setLocal(true);
-      ((UnaryNode) unary.getSubNode()).setSubNode(newScan);
+      ((UnaryNode) unary.getChild()).setChild(newScan);
       prev = convertMap.get(prevStore);
       if (prev != null) {
         prev.setParentBlock(unit);
         unit.addChildBlock(newScan, prev);
       }
 
-      if (unaryChild.getSubNode().getType() == curType) {
+      if (unaryChild.getChild().getType() == curType) {
         // the second phase
         unit.setPartitionType(PartitionType.LIST);
         if (prev != null) {
@@ -422,12 +422,12 @@ public class GlobalPlanner {
           prev.setPartitionType(PartitionType.LIST);
         }
       }
-    } else if (unaryChild.getSubNode().getType() == ExprType.SCAN) {
+    } else if (unaryChild.getChild().getType() == NodeType.SCAN) {
       // the first phase
       // store - groupby - scan
       unit.setPartitionType(PartitionType.HASH);
-    } else if (unaryChild.getSubNode().getType() == ExprType.UNION) {
-      _handleUnionNode(rootStore, (UnionNode)unaryChild.getSubNode(), unit, 
+    } else if (unaryChild.getChild().getType() == NodeType.UNION) {
+      _handleUnionNode(rootStore, (UnionNode)unaryChild.getChild(), unit,
           null, PartitionType.LIST);
     } else {
       // error
@@ -449,11 +449,11 @@ public class GlobalPlanner {
     UnaryNode unary = (UnaryNode) plan;
     StoreTableNode outerStore, innerStore;
     ExecutionBlock prev;
-    UnionNode union = (UnionNode) unary.getSubNode();
+    UnionNode union = (UnionNode) unary.getChild();
     unit.setPartitionType(PartitionType.LIST);
     
-    if (union.getOuterNode().getType() == ExprType.STORE) {
-      outerStore = (StoreTableNode) union.getOuterNode();
+    if (union.getLeftChild().getType() == NodeType.STORE) {
+      outerStore = (StoreTableNode) union.getLeftChild();
       TableMeta outerMeta = CatalogUtil.newTableMeta(outerStore.getOutSchema(),
           StoreType.CSV);
       insertOuterScan(union, outerStore.getTableName(), outerMeta);
@@ -462,14 +462,14 @@ public class GlobalPlanner {
         prev.getStoreTableNode().setTableName(rootStore.getTableName());
         prev.setPartitionType(PartitionType.LIST);
         prev.setParentBlock(unit);
-        unit.addChildBlock((ScanNode) union.getOuterNode(), prev);
+        unit.addChildBlock((ScanNode) union.getLeftChild(), prev);
       }
-    } else if (union.getOuterNode().getType() == ExprType.UNION) {
+    } else if (union.getLeftChild().getType() == NodeType.UNION) {
       _handleUnionNode(rootStore, union, unit, null, PartitionType.LIST);
     }
     
-    if (union.getInnerNode().getType() == ExprType.STORE) {
-      innerStore = (StoreTableNode) union.getInnerNode();
+    if (union.getRightChild().getType() == NodeType.STORE) {
+      innerStore = (StoreTableNode) union.getRightChild();
       TableMeta innerMeta = CatalogUtil.newTableMeta(innerStore.getOutSchema(),
           StoreType.CSV);
       insertInnerScan(union, innerStore.getTableName(), innerMeta);
@@ -478,9 +478,9 @@ public class GlobalPlanner {
         prev.getStoreTableNode().setTableName(rootStore.getTableName());
         prev.setPartitionType(PartitionType.LIST);
         prev.setParentBlock(unit);
-        unit.addChildBlock((ScanNode) union.getInnerNode(), prev);
+        unit.addChildBlock((ScanNode) union.getRightChild(), prev);
       }
-    } else if (union.getInnerNode().getType() == ExprType.UNION) {
+    } else if (union.getRightChild().getType() == NodeType.UNION) {
       _handleUnionNode(rootStore, union, unit, null, PartitionType.LIST);
     }
 
@@ -495,40 +495,40 @@ public class GlobalPlanner {
     StoreTableNode prevStore;
     ScanNode newScan;
     ExecutionBlock prev;
-    unaryChild = (UnaryNode) unary.getSubNode();  // groupby
-    ExprType curType = unaryChild.getType();
-    if (unaryChild.getSubNode().getType() == ExprType.STORE) {
+    unaryChild = (UnaryNode) unary.getChild();  // groupby
+    NodeType curType = unaryChild.getType();
+    if (unaryChild.getChild().getType() == NodeType.STORE) {
       // store - groupby - store
-      unaryChild = (UnaryNode) unaryChild.getSubNode(); // store
+      unaryChild = (UnaryNode) unaryChild.getChild(); // store
       prevStore = (StoreTableNode) unaryChild;
       newScan = GlobalPlannerUtils.newScanPlan(prevStore.getOutSchema(),
           prevStore.getTableName(), sm.getTablePath(prevStore.getTableName()));
       newScan.setLocal(true);
-      ((UnaryNode) unary.getSubNode()).setSubNode(newScan);
+      ((UnaryNode) unary.getChild()).setChild(newScan);
       prev = convertMap.get(prevStore);
       if (prev != null) {
         prev.setParentBlock(unit);
         unit.addChildBlock(newScan, prev);
-        if (unaryChild.getSubNode().getType() == curType) {
+        if (unaryChild.getChild().getType() == curType) {
           // TODO - this is duplicated code
           prev.setPartitionType(PartitionType.RANGE);
         } else {
           prev.setPartitionType(PartitionType.LIST);
         }
       }
-      if (unaryChild.getSubNode().getType() == curType) {
+      if (unaryChild.getChild().getType() == curType) {
         // the second phase
         unit.setPartitionType(PartitionType.LIST);
       } else {
         // the first phase
         unit.setPartitionType(PartitionType.HASH);
       }
-    } else if (unaryChild.getSubNode().getType() == ExprType.SCAN) {
+    } else if (unaryChild.getChild().getType() == NodeType.SCAN) {
       // the first phase
       // store - sort - scan
       unit.setPartitionType(PartitionType.RANGE);
-    } else if (unaryChild.getSubNode().getType() == ExprType.UNION) {
-      _handleUnionNode(rootStore, (UnionNode)unaryChild.getSubNode(), unit,
+    } else if (unaryChild.getChild().getType() == NodeType.UNION) {
+      _handleUnionNode(rootStore, (UnionNode)unaryChild.getChild(), unit,
           null, PartitionType.LIST);
     } else {
       // error
@@ -541,9 +541,9 @@ public class GlobalPlanner {
     UnaryNode unary = (UnaryNode)plan;
     StoreTableNode outerStore, innerStore;
     ExecutionBlock prev;
-    JoinNode join = (JoinNode) unary.getSubNode();
-    Schema outerSchema = join.getOuterNode().getOutSchema();
-    Schema innerSchema = join.getInnerNode().getOutSchema();
+    JoinNode join = (JoinNode) unary.getChild();
+    Schema outerSchema = join.getLeftChild().getOutSchema();
+    Schema innerSchema = join.getRightChild().getOutSchema();
     unit.setPartitionType(PartitionType.LIST);
 
     List<Column> outerCollist = new ArrayList<Column>();
@@ -567,8 +567,8 @@ public class GlobalPlanner {
     innerCols = innerCollist.toArray(innerCols);
     
     // outer
-    if (join.getOuterNode().getType() == ExprType.STORE) {
-      outerStore = (StoreTableNode) join.getOuterNode();
+    if (join.getLeftChild().getType() == NodeType.STORE) {
+      outerStore = (StoreTableNode) join.getLeftChild();
       TableMeta outerMeta = CatalogUtil.newTableMeta(outerStore.getOutSchema(),
           StoreType.CSV);
       insertOuterScan(join, outerStore.getTableName(), outerMeta);
@@ -576,19 +576,19 @@ public class GlobalPlanner {
       if (prev != null) {
         prev.setPartitionType(PartitionType.HASH);
         prev.setParentBlock(unit);
-        unit.addChildBlock((ScanNode) join.getOuterNode(), prev);
+        unit.addChildBlock((ScanNode) join.getLeftChild(), prev);
       }
       outerStore.setPartitions(PartitionType.HASH, outerCols, 32);
-    } else if (join.getOuterNode().getType() == ExprType.UNION) {
-      _handleUnionNode(rootStore, (UnionNode)join.getOuterNode(), unit, 
+    } else if (join.getLeftChild().getType() == NodeType.UNION) {
+      _handleUnionNode(rootStore, (UnionNode)join.getLeftChild(), unit,
           outerCols, PartitionType.HASH);
     } else {
 
     }
     
     // inner
-    if (join.getInnerNode().getType() == ExprType.STORE) {
-      innerStore = (StoreTableNode) join.getInnerNode();
+    if (join.getRightChild().getType() == NodeType.STORE) {
+      innerStore = (StoreTableNode) join.getRightChild();
       TableMeta innerMeta = CatalogUtil.newTableMeta(innerStore.getOutSchema(),
           StoreType.CSV);
       insertInnerScan(join, innerStore.getTableName(), innerMeta);
@@ -596,11 +596,11 @@ public class GlobalPlanner {
       if (prev != null) {
         prev.setPartitionType(PartitionType.HASH);
         prev.setParentBlock(unit);
-        unit.addChildBlock((ScanNode) join.getInnerNode(), prev);
+        unit.addChildBlock((ScanNode) join.getRightChild(), prev);
       }
       innerStore.setPartitions(PartitionType.HASH, innerCols, 32);
-    } else if (join.getInnerNode().getType() == ExprType.UNION) {
-      _handleUnionNode(rootStore, (UnionNode)join.getInnerNode(), unit,
+    } else if (join.getRightChild().getType() == NodeType.UNION) {
+      _handleUnionNode(rootStore, (UnionNode)join.getRightChild(), unit,
           innerCols, PartitionType.HASH);
     }
     
@@ -624,8 +624,8 @@ public class GlobalPlanner {
     TableMeta meta;
     ExecutionBlock prev;
     
-    if (union.getOuterNode().getType() == ExprType.STORE) {
-      store = (StoreTableNode) union.getOuterNode();
+    if (union.getLeftChild().getType() == NodeType.STORE) {
+      store = (StoreTableNode) union.getLeftChild();
       meta = CatalogUtil.newTableMeta(store.getOutSchema(), StoreType.CSV);
       insertOuterScan(union, store.getTableName(), meta);
       prev = convertMap.get(store);
@@ -633,18 +633,18 @@ public class GlobalPlanner {
         prev.getStoreTableNode().setTableName(rootStore.getTableName());
         prev.setPartitionType(prevOutputType);
         prev.setParentBlock(cur);
-        cur.addChildBlock((ScanNode) union.getOuterNode(), prev);
+        cur.addChildBlock((ScanNode) union.getLeftChild(), prev);
       }
       if (cols != null) {
         store.setPartitions(PartitionType.LIST, cols, 32);
       }
-    } else if (union.getOuterNode().getType() == ExprType.UNION) {
-      _handleUnionNode(rootStore, (UnionNode)union.getOuterNode(), cur, cols, 
+    } else if (union.getLeftChild().getType() == NodeType.UNION) {
+      _handleUnionNode(rootStore, (UnionNode)union.getLeftChild(), cur, cols,
           prevOutputType);
     }
     
-    if (union.getInnerNode().getType() == ExprType.STORE) {
-      store = (StoreTableNode) union.getInnerNode();
+    if (union.getRightChild().getType() == NodeType.STORE) {
+      store = (StoreTableNode) union.getRightChild();
       meta = CatalogUtil.newTableMeta(store.getOutSchema(), StoreType.CSV);
       insertInnerScan(union, store.getTableName(), meta);
       prev = convertMap.get(store);
@@ -652,13 +652,13 @@ public class GlobalPlanner {
         prev.getStoreTableNode().setTableName(rootStore.getTableName());
         prev.setPartitionType(prevOutputType);
         prev.setParentBlock(cur);
-        cur.addChildBlock((ScanNode) union.getInnerNode(), prev);
+        cur.addChildBlock((ScanNode) union.getRightChild(), prev);
       }
       if (cols != null) {
         store.setPartitions(PartitionType.LIST, cols, 32);
       }
-    } else if (union.getInnerNode().getType() == ExprType.UNION) {
-      _handleUnionNode(rootStore, (UnionNode)union.getInnerNode(), cur, cols, 
+    } else if (union.getRightChild().getType() == NodeType.UNION) {
+      _handleUnionNode(rootStore, (UnionNode)union.getRightChild(), cur, cols,
           prevOutputType);
     }
   }
@@ -670,7 +670,7 @@ public class GlobalPlanner {
     scan.setLocal(true);
     scan.setInSchema(meta.getSchema());
     scan.setOutSchema(meta.getSchema());
-    parent.setOuter(scan);
+    parent.setLeftChild(scan);
     return parent;
   }
   
@@ -681,7 +681,7 @@ public class GlobalPlanner {
     scan.setLocal(true);
     scan.setInSchema(meta.getSchema());
     scan.setOutSchema(meta.getSchema());
-    parent.setInner(scan);
+    parent.setRightChild(scan);
     return parent;
   }
   
@@ -689,7 +689,7 @@ public class GlobalPlanner {
     recursiveBuildSubQuery(logicalPlan);
     ExecutionBlock root;
 
-    root = convertMap.get(((LogicalRootNode)logicalPlan).getSubNode());
+    root = convertMap.get(((LogicalRootNode)logicalPlan).getChild());
     root.getStoreTableNode().setLocal(false);
 
     return new MasterPlan(root);

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
index b433718..ed1376c 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
@@ -376,7 +376,7 @@ public class TajoMasterClientService extends AbstractService {
 
       desc = new TableDescImpl(request.getName(), meta, path);
       catalog.addTable(desc);
-      LOG.info("Table " + desc.getId() + " is attached ("
+      LOG.info("Table " + desc.getName() + " is attached ("
           + meta.getStat().getNumBytes() + ")");
 
       return TableResponse.newBuilder().

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryMaster.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryMaster.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryMaster.java
index 4b15c61..b66ef68 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryMaster.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryMaster.java
@@ -53,9 +53,9 @@ import org.apache.tajo.engine.json.CoreGsonHelper;
 import org.apache.tajo.engine.planner.PlannerUtil;
 import org.apache.tajo.engine.planner.global.GlobalOptimizer;
 import org.apache.tajo.engine.planner.global.MasterPlan;
-import org.apache.tajo.engine.planner.logical.ExprType;
 import org.apache.tajo.engine.planner.logical.LogicalNode;
 import org.apache.tajo.engine.planner.logical.LogicalRootNode;
+import org.apache.tajo.engine.planner.logical.NodeType;
 import org.apache.tajo.engine.planner.logical.ScanNode;
 import org.apache.tajo.ipc.QueryMasterManagerProtocol;
 import org.apache.tajo.ipc.QueryMasterProtocol;
@@ -444,7 +444,7 @@ public class QueryMaster extends CompositeService implements EventHandler {
 
     try {
       LogicalRootNode logicalNodeRoot = (LogicalRootNode) CoreGsonHelper.fromJson(planJSON, LogicalNode.class);
-      LogicalNode[] scanNodes = PlannerUtil.findAllNodes(logicalNodeRoot, ExprType.SCAN);
+      LogicalNode[] scanNodes = PlannerUtil.findAllNodes(logicalNodeRoot, NodeType.SCAN);
       if(scanNodes != null) {
         for(LogicalNode eachScanNode: scanNodes) {
           ScanNode scanNode = (ScanNode)eachScanNode;

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryUnit.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryUnit.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryUnit.java
index fcb8f3e..cf32e16 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryUnit.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/QueryUnit.java
@@ -145,8 +145,7 @@ public class QueryUnit implements EventHandler<TaskEvent> {
   }
 	
 	public void setLogicalPlan(LogicalNode plan) {
-    Preconditions.checkArgument(plan.getType() == ExprType.STORE ||
-        plan.getType() == ExprType.CREATE_INDEX);
+    Preconditions.checkArgument(plan.getType() == NodeType.STORE);
     
 	  this.plan = plan;
     store = (StoreTableNode) plan;
@@ -158,11 +157,11 @@ public class QueryUnit implements EventHandler<TaskEvent> {
 	    node = s.remove(s.size()-1);
 	    if (node instanceof UnaryNode) {
 	      UnaryNode unary = (UnaryNode) node;
-	      s.add(s.size(), unary.getSubNode());
+	      s.add(s.size(), unary.getChild());
 	    } else if (node instanceof BinaryNode) {
 	      BinaryNode binary = (BinaryNode) node;
-	      s.add(s.size(), binary.getOuterNode());
-	      s.add(s.size(), binary.getInnerNode());
+	      s.add(s.size(), binary.getLeftChild());
+	      s.add(s.size(), binary.getRightChild());
 	    } else if (node instanceof ScanNode) {
 	      scan.add((ScanNode)node);
 	    }
@@ -178,7 +177,7 @@ public class QueryUnit implements EventHandler<TaskEvent> {
   }
 
   public void setFragment2(Fragment fragment) {
-    this.fragMap.put(fragment.getId(), fragment);
+    this.fragMap.put(fragment.getName(), fragment);
     if (fragment.hasDataLocations()) {
       setDataLocations(fragment.getDataLocations());
     }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Repartitioner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Repartitioner.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Repartitioner.java
index 3957d57..ff590f3 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Repartitioner.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/Repartitioner.java
@@ -265,7 +265,7 @@ public class Repartitioner {
     tablePath = subQuery.getContext().getStorageManager().getTablePath(scan.getTableId());
 
     StoreTableNode store = (StoreTableNode) childSubQuery.getBlock().getPlan();
-    SortNode sort = (SortNode) store.getSubNode();
+    SortNode sort = (SortNode) store.getChild();
     SortSpec[] sortSpecs = sort.getSortKeys();
     Schema sortSchema = PlannerUtil.sortSpecsToSchema(sort.getSortKeys());
 
@@ -414,7 +414,7 @@ public class Repartitioner {
     }
 
     GroupbyNode groupby = (GroupbyNode) childSubQuery.getBlock().getStoreTableNode().
-        getSubNode();
+        getChild();
     // the number of tasks cannot exceed the number of merged fetch uris.
     int determinedTaskNum = Math.min(maxNum, finalFetchURI.size());
     if (groupby.getGroupingColumns().length == 0) {
@@ -547,7 +547,7 @@ public class Repartitioner {
     // TODO: the union handling is required when a join has unions as its child
     ExecutionBlock parentBlock = execBlock.getParentBlock();
     if (parentBlock != null) {
-      if (parentBlock.getStoreTableNode().getSubNode().getType() == ExprType.JOIN) {
+      if (parentBlock.getStoreTableNode().getChild().getType() == NodeType.JOIN) {
         execBlock.getStoreTableNode().setPartitions(execBlock.getPartitionType(),
             execBlock.getStoreTableNode().getPartitionKeys(), n);
         keys = execBlock.getStoreTableNode().getPartitionKeys();
@@ -557,13 +557,13 @@ public class Repartitioner {
     StoreTableNode store = execBlock.getStoreTableNode();
     // set the partition number for group by and sort
     if (execBlock.getPartitionType() == PartitionType.HASH) {
-      if (store.getSubNode().getType() == ExprType.GROUP_BY) {
-        GroupbyNode groupby = (GroupbyNode)store.getSubNode();
+      if (store.getChild().getType() == NodeType.GROUP_BY) {
+        GroupbyNode groupby = (GroupbyNode)store.getChild();
         keys = groupby.getGroupingColumns();
       }
     } else if (execBlock.getPartitionType() == PartitionType.RANGE) {
-      if (store.getSubNode().getType() == ExprType.SORT) {
-        SortNode sort = (SortNode)store.getSubNode();
+      if (store.getChild().getType() == NodeType.SORT) {
+        SortNode sort = (SortNode)store.getChild();
         keys = new Column[sort.getSortKeys().length];
         for (int i = 0; i < keys.length; i++) {
           keys[i] = sort.getSortKeys()[i].getSortKey();

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/SubQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/SubQuery.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/SubQuery.java
index 305ef1b..d5d4dfd 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/SubQuery.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/querymaster/SubQuery.java
@@ -42,8 +42,8 @@ import org.apache.tajo.catalog.statistics.StatisticsUtil;
 import org.apache.tajo.catalog.statistics.TableStat;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.engine.planner.PlannerUtil;
-import org.apache.tajo.engine.planner.logical.ExprType;
 import org.apache.tajo.engine.planner.logical.GroupbyNode;
+import org.apache.tajo.engine.planner.logical.NodeType;
 import org.apache.tajo.engine.planner.logical.ScanNode;
 import org.apache.tajo.engine.planner.logical.StoreTableNode;
 import org.apache.tajo.master.ExecutionBlock;
@@ -497,7 +497,7 @@ public class SubQuery implements EventHandler<SubQueryEvent> {
       GroupbyNode grpNode = null;
       if (parent != null) {
         grpNode = (GroupbyNode) PlannerUtil.findTopNode(
-            parent.getPlan(), ExprType.GROUP_BY);
+            parent.getPlan(), NodeType.GROUP_BY);
       }
 
       // Is this subquery the first step of join?

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/util/IndexUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/util/IndexUtil.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/util/IndexUtil.java
index 5557b2a..59ba129 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/util/IndexUtil.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/util/IndexUtil.java
@@ -23,11 +23,7 @@ import org.apache.tajo.catalog.Column;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.SortSpec;
 import org.apache.tajo.datum.Datum;
-import org.apache.tajo.engine.eval.ConstEval;
-import org.apache.tajo.engine.eval.EvalNode;
-import org.apache.tajo.engine.eval.EvalNode.Type;
-import org.apache.tajo.engine.eval.EvalNodeVisitor;
-import org.apache.tajo.engine.eval.FieldEval;
+import org.apache.tajo.engine.eval.*;
 import org.apache.tajo.engine.json.CoreGsonHelper;
 import org.apache.tajo.engine.planner.logical.IndexScanNode;
 import org.apache.tajo.engine.planner.logical.ScanNode;
@@ -135,14 +131,14 @@ public class IndexUtil {
       case AND:
         break;
       case EQUAL:
-        if( node.getLeftExpr().getType() == Type.FIELD 
-          && node.getRightExpr().getType() == Type.CONST ) {
+        if( node.getLeftExpr().getType() == EvalType.FIELD
+          && node.getRightExpr().getType() == EvalType.CONST ) {
           nodeList.add(node);
         }
         break;
-      case IS:
-        if( node.getLeftExpr().getType() == Type.FIELD 
-          && node.getRightExpr().getType() == Type.CONST) {
+      case IS_NULL:
+        if( node.getLeftExpr().getType() == EvalType.FIELD
+          && node.getRightExpr().getType() == EvalType.CONST) {
           nodeList.add(node);
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Task.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Task.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Task.java
index a56841b..559f29b 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Task.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/worker/Task.java
@@ -153,7 +153,7 @@ public class Task {
       StoreTableNode store = (StoreTableNode) plan;
       this.partitionType = store.getPartitionType();
       if (partitionType == PartitionType.RANGE) {
-        SortNode sortNode = (SortNode) store.getSubNode();
+        SortNode sortNode = (SortNode) store.getChild();
         this.finalSchema = PlannerUtil.sortSpecsToSchema(sortNode.getSortKeys());
         this.sortComp = new TupleComparator(finalSchema, sortNode.getSortKeys());
       }
@@ -176,7 +176,7 @@ public class Task {
 
     LOG.info("* Fragments (num: " + request.getFragments().size() + ")");
     for (Fragment f: request.getFragments()) {
-      LOG.info("==> Table Id:" + f.getId() + ", path:" + f.getPath() + "(" + f.getMeta().getStoreType() + "), " +
+      LOG.info("==> Table Id:" + f.getName() + ", path:" + f.getPath() + "(" + f.getMeta().getStoreType() + "), " +
           "(start:" + f.getStartOffset() + ", length: " + f.getLength() + ")");
     }
     LOG.info("* Fetches (total:" + request.getFetches().size() + ") :");

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
index 9f50fe3..fd492be 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
@@ -197,7 +197,7 @@ public class TestTajoClient {
     assertTrue(tajo.existTable(tableName1));
     TableDesc desc = tajo.getTableDesc(tableName1);
     assertNotNull(desc);
-    assertEquals(tableName1, desc.getId());
+    assertEquals(tableName1, desc.getName());
     assertTrue(desc.getMeta().getStat().getNumBytes() > 0);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestEvalTree.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestEvalTree.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestEvalTree.java
index 7aa60d5..20dea3d 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestEvalTree.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestEvalTree.java
@@ -28,7 +28,6 @@ import org.apache.tajo.catalog.proto.CatalogProtos.StoreType;
 import org.apache.tajo.common.TajoDataTypes.DataType;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.DatumFactory;
-import org.apache.tajo.engine.eval.EvalNode.Type;
 import org.apache.tajo.engine.json.CoreGsonHelper;
 import org.apache.tajo.engine.parser.SQLAnalyzer;
 import org.apache.tajo.engine.planner.LogicalPlan;
@@ -128,13 +127,19 @@ public class TestEvalTree {
   public static Target[] getRawTargets(String query) {
     Expr expr = analyzer.parse(query);
     LogicalPlan plan = planner.createPlan(expr);
-    return plan.getRootBlock().getTargetListManager().getUnEvaluatedTargets();
+    Target [] targets = plan.getRootBlock().getTargetListManager().getUnEvaluatedTargets();
+    for (Target t : targets) {
+      assertJsonSerDer(t.getEvalTree());
+    }
+    return targets;
   }
 
   public static EvalNode getRootSelection(String query) {
     Expr block = analyzer.parse(query);
     LogicalPlan plan = planner.createPlan(block);
-    return plan.getRootBlock().getSelectionNode().getQual();
+    EvalNode qual = plan.getRootBlock().getSelectionNode().getQual();
+    assertJsonSerDer(qual);
+    return qual;
   }
 
   @Test
@@ -200,7 +205,7 @@ public class TestEvalTree {
     schema1.addColumn("table1.id", INT4);
     schema1.addColumn("table1.score", INT4);
     
-    BinaryEval expr = new BinaryEval(Type.PLUS, e1, e2);
+    BinaryEval expr = new BinaryEval(EvalType.PLUS, e1, e2);
     EvalContext evalCtx = expr.newContext();
     assertCloneEqual(expr);
     VTuple tuple = new VTuple(2);
@@ -215,7 +220,7 @@ public class TestEvalTree {
   public static class MockTrueEval extends EvalNode {
 
     public MockTrueEval() {
-      super(Type.CONST);
+      super(EvalType.CONST);
     }
 
     @Override
@@ -248,7 +253,7 @@ public class TestEvalTree {
   public static class MockFalseExpr extends EvalNode {
 
     public MockFalseExpr() {
-      super(Type.CONST);
+      super(EvalType.CONST);
     }
 
     @Override
@@ -282,22 +287,22 @@ public class TestEvalTree {
     MockTrueEval trueExpr = new MockTrueEval();
     MockFalseExpr falseExpr = new MockFalseExpr();
 
-    BinaryEval andExpr = new BinaryEval(Type.AND, trueExpr, trueExpr);
+    BinaryEval andExpr = new BinaryEval(EvalType.AND, trueExpr, trueExpr);
     EvalContext evalCtx = andExpr.newContext();
     andExpr.eval(evalCtx, null, null);
     assertTrue(andExpr.terminate(evalCtx).asBool());
 
-    andExpr = new BinaryEval(Type.AND, falseExpr, trueExpr);
+    andExpr = new BinaryEval(EvalType.AND, falseExpr, trueExpr);
     evalCtx = andExpr.newContext();
     andExpr.eval(evalCtx, null, null);
     assertFalse(andExpr.terminate(evalCtx).asBool());
 
-    andExpr = new BinaryEval(Type.AND, trueExpr, falseExpr);
+    andExpr = new BinaryEval(EvalType.AND, trueExpr, falseExpr);
     evalCtx= andExpr.newContext();
     andExpr.eval(evalCtx, null, null);
     assertFalse(andExpr.terminate(evalCtx).asBool());
 
-    andExpr = new BinaryEval(Type.AND, falseExpr, falseExpr);
+    andExpr = new BinaryEval(EvalType.AND, falseExpr, falseExpr);
     evalCtx= andExpr.newContext();
     andExpr.eval(evalCtx, null, null);
     assertFalse(andExpr.terminate(evalCtx).asBool());
@@ -308,22 +313,22 @@ public class TestEvalTree {
     MockTrueEval trueExpr = new MockTrueEval();
     MockFalseExpr falseExpr = new MockFalseExpr();
 
-    BinaryEval orExpr = new BinaryEval(Type.OR, trueExpr, trueExpr);
+    BinaryEval orExpr = new BinaryEval(EvalType.OR, trueExpr, trueExpr);
     EvalContext evalCtx= orExpr.newContext();
     orExpr.eval(evalCtx, null, null);
     assertTrue(orExpr.terminate(evalCtx).asBool());
 
-    orExpr = new BinaryEval(Type.OR, falseExpr, trueExpr);
+    orExpr = new BinaryEval(EvalType.OR, falseExpr, trueExpr);
     evalCtx= orExpr.newContext();
     orExpr.eval(evalCtx, null, null);
     assertTrue(orExpr.terminate(evalCtx).asBool());
 
-    orExpr = new BinaryEval(Type.OR, trueExpr, falseExpr);
+    orExpr = new BinaryEval(EvalType.OR, trueExpr, falseExpr);
     evalCtx= orExpr.newContext();
     orExpr.eval(evalCtx, null, null);
     assertTrue(orExpr.terminate(evalCtx).asBool());
 
-    orExpr = new BinaryEval(Type.OR, falseExpr, falseExpr);
+    orExpr = new BinaryEval(EvalType.OR, falseExpr, falseExpr);
     evalCtx = orExpr.newContext();
     orExpr.eval(evalCtx, null, null);
     assertFalse(orExpr.terminate(evalCtx).asBool());
@@ -338,71 +343,71 @@ public class TestEvalTree {
     // Constant
     e1 = new ConstEval(DatumFactory.createInt4(9));
     e2 = new ConstEval(DatumFactory.createInt4(34));
-    expr = new BinaryEval(Type.LTH, e1, e2);
+    expr = new BinaryEval(EvalType.LTH, e1, e2);
     EvalContext evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.LEQ, e1, e2);
+    expr = new BinaryEval(EvalType.LEQ, e1, e2);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.LTH, e2, e1);
+    expr = new BinaryEval(EvalType.LTH, e2, e1);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertFalse(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.LEQ, e2, e1);
+    expr = new BinaryEval(EvalType.LEQ, e2, e1);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertFalse(expr.terminate(evalCtx).asBool());
 
-    expr = new BinaryEval(Type.GTH, e2, e1);
+    expr = new BinaryEval(EvalType.GTH, e2, e1);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.GEQ, e2, e1);
+    expr = new BinaryEval(EvalType.GEQ, e2, e1);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.GTH, e1, e2);
+    expr = new BinaryEval(EvalType.GTH, e1, e2);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertFalse(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.GEQ, e1, e2);
+    expr = new BinaryEval(EvalType.GEQ, e1, e2);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertFalse(expr.terminate(evalCtx).asBool());
 
-    BinaryEval plus = new BinaryEval(Type.PLUS, e1, e2);
-    expr = new BinaryEval(Type.LTH, e1, plus);
+    BinaryEval plus = new BinaryEval(EvalType.PLUS, e1, e2);
+    expr = new BinaryEval(EvalType.LTH, e1, plus);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.LEQ, e1, plus);
+    expr = new BinaryEval(EvalType.LEQ, e1, plus);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.LTH, plus, e1);
+    expr = new BinaryEval(EvalType.LTH, plus, e1);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertFalse(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.LEQ, plus, e1);
+    expr = new BinaryEval(EvalType.LEQ, plus, e1);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertFalse(expr.terminate(evalCtx).asBool());
 
-    expr = new BinaryEval(Type.GTH, plus, e1);
+    expr = new BinaryEval(EvalType.GTH, plus, e1);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.GEQ, plus, e1);
+    expr = new BinaryEval(EvalType.GEQ, plus, e1);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.GTH, e1, plus);
+    expr = new BinaryEval(EvalType.GTH, e1, plus);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertFalse(expr.terminate(evalCtx).asBool());
-    expr = new BinaryEval(Type.GEQ, e1, plus);
+    expr = new BinaryEval(EvalType.GEQ, e1, plus);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertFalse(expr.terminate(evalCtx).asBool());
@@ -417,7 +422,7 @@ public class TestEvalTree {
     // PLUS
     e1 = new ConstEval(DatumFactory.createInt4(9));
     e2 = new ConstEval(DatumFactory.createInt4(34));
-    BinaryEval expr = new BinaryEval(Type.PLUS, e1, e2);
+    BinaryEval expr = new BinaryEval(EvalType.PLUS, e1, e2);
     EvalContext evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertEquals(expr.terminate(evalCtx).asInt4(), 43);
@@ -426,7 +431,7 @@ public class TestEvalTree {
     // MINUS
     e1 = new ConstEval(DatumFactory.createInt4(5));
     e2 = new ConstEval(DatumFactory.createInt4(2));
-    expr = new BinaryEval(Type.MINUS, e1, e2);
+    expr = new BinaryEval(EvalType.MINUS, e1, e2);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertEquals(expr.terminate(evalCtx).asInt4(), 3);
@@ -435,7 +440,7 @@ public class TestEvalTree {
     // MULTIPLY
     e1 = new ConstEval(DatumFactory.createInt4(5));
     e2 = new ConstEval(DatumFactory.createInt4(2));
-    expr = new BinaryEval(Type.MULTIPLY, e1, e2);
+    expr = new BinaryEval(EvalType.MULTIPLY, e1, e2);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertEquals(expr.terminate(evalCtx).asInt4(), 10);
@@ -444,7 +449,7 @@ public class TestEvalTree {
     // DIVIDE
     e1 = new ConstEval(DatumFactory.createInt4(10));
     e2 = new ConstEval(DatumFactory.createInt4(5));
-    expr = new BinaryEval(Type.DIVIDE, e1, e2);
+    expr = new BinaryEval(EvalType.DIVIDE, e1, e2);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertEquals(expr.terminate(evalCtx).asInt4(), 2);
@@ -459,10 +464,10 @@ public class TestEvalTree {
     // PLUS
     e1 = new ConstEval(DatumFactory.createInt4(9));
     e2 = new ConstEval(DatumFactory.createInt4(34));
-    BinaryEval expr = new BinaryEval(Type.PLUS, e1, e2);
+    BinaryEval expr = new BinaryEval(EvalType.PLUS, e1, e2);
     assertEquals(CatalogUtil.newDataTypeWithoutLen(INT4), expr.getValueType()[0]);
 
-    expr = new BinaryEval(Type.LTH, e1, e2);
+    expr = new BinaryEval(EvalType.LTH, e1, e2);
     EvalContext evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
@@ -470,7 +475,7 @@ public class TestEvalTree {
 
     e1 = new ConstEval(DatumFactory.createFloat8(9.3));
     e2 = new ConstEval(DatumFactory.createFloat8(34.2));
-    expr = new BinaryEval(Type.PLUS, e1, e2);
+    expr = new BinaryEval(EvalType.PLUS, e1, e2);
     assertEquals(CatalogUtil.newDataTypeWithoutLen(FLOAT8), expr.getValueType()[0]);
   }
   
@@ -484,23 +489,23 @@ public class TestEvalTree {
     e2 = new ConstEval(DatumFactory.createInt4(34));
     assertEquals(e1, e2);
     
-    BinaryEval plus1 = new BinaryEval(Type.PLUS, e1, e2);
-    BinaryEval plus2 = new BinaryEval(Type.PLUS, e2, e1);
+    BinaryEval plus1 = new BinaryEval(EvalType.PLUS, e1, e2);
+    BinaryEval plus2 = new BinaryEval(EvalType.PLUS, e2, e1);
     assertEquals(plus1, plus2);
     
     ConstEval e3 = new ConstEval(DatumFactory.createInt4(29));
-    BinaryEval plus3 = new BinaryEval(Type.PLUS, e1, e3);
+    BinaryEval plus3 = new BinaryEval(EvalType.PLUS, e1, e3);
     assertFalse(plus1.equals(plus3));
     
     // LTH
     ConstEval e4 = new ConstEval(DatumFactory.createInt4(9));
     ConstEval e5 = new ConstEval(DatumFactory.createInt4(34));
-    BinaryEval compExpr1 = new BinaryEval(Type.LTH, e4, e5);
+    BinaryEval compExpr1 = new BinaryEval(EvalType.LTH, e4, e5);
     assertCloneEqual(compExpr1);
     
     ConstEval e6 = new ConstEval(DatumFactory.createInt4(9));
     ConstEval e7 = new ConstEval(DatumFactory.createInt4(34));
-    BinaryEval compExpr2 = new BinaryEval(Type.LTH, e6, e7);
+    BinaryEval compExpr2 = new BinaryEval(EvalType.LTH, e6, e7);
     assertCloneEqual(compExpr2);
     
     assertTrue(compExpr1.equals(compExpr2));
@@ -516,15 +521,15 @@ public class TestEvalTree {
     e2 = new ConstEval(DatumFactory.createInt4(5));
     assertCloneEqual(e1); 
     
-    BinaryEval plus1 = new BinaryEval(Type.PLUS, e1, e2);
+    BinaryEval plus1 = new BinaryEval(EvalType.PLUS, e1, e2);
     assertCloneEqual(plus1);
-    BinaryEval plus2 = new BinaryEval(Type.PLUS, e2, e1);
+    BinaryEval plus2 = new BinaryEval(EvalType.PLUS, e2, e1);
     assertCloneEqual(plus2);
-    BinaryEval plus3 = new BinaryEval(Type.PLUS, plus2, plus1);
+    BinaryEval plus3 = new BinaryEval(EvalType.PLUS, plus2, plus1);
     assertCloneEqual(plus3);
     
     ConstEval e3 = new ConstEval(DatumFactory.createInt4(29));
-    BinaryEval gth = new BinaryEval(Type.GTH, e3, plus3);
+    BinaryEval gth = new BinaryEval(EvalType.GTH, e3, plus3);
     assertCloneEqual(gth);
     
     String json = gth.toJson();
@@ -561,7 +566,7 @@ public class TestEvalTree {
     // Constant
     e1 = new ConstEval(DatumFactory.createInt4(9));
     e2 = new ConstEval(DatumFactory.createInt4(34));
-    expr = new BinaryEval(Type.LTH, e1, e2);
+    expr = new BinaryEval(EvalType.LTH, e1, e2);
     EvalContext evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
@@ -570,7 +575,7 @@ public class TestEvalTree {
     not.eval(evalCtx, null, null);
     assertFalse(not.terminate(evalCtx).asBool());
     
-    expr = new BinaryEval(Type.LEQ, e1, e2);
+    expr = new BinaryEval(EvalType.LEQ, e1, e2);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
@@ -579,7 +584,7 @@ public class TestEvalTree {
     not.eval(evalCtx, null, null);
     assertFalse(not.terminate(evalCtx).asBool());
     
-    expr = new BinaryEval(Type.LTH, e2, e1);
+    expr = new BinaryEval(EvalType.LTH, e2, e1);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertFalse(expr.terminate(evalCtx).asBool());
@@ -588,7 +593,7 @@ public class TestEvalTree {
     not.eval(evalCtx, null, null);
     assertTrue(not.terminate(evalCtx).asBool());
     
-    expr = new BinaryEval(Type.LEQ, e2, e1);
+    expr = new BinaryEval(EvalType.LEQ, e2, e1);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertFalse(expr.terminate(evalCtx).asBool());
@@ -671,12 +676,16 @@ public class TestEvalTree {
   }
 
   private void assertIsNull(EvalNode isNullEval) {
-    assertEquals(Type.IS, isNullEval.getType());
-    assertEquals(Type.FIELD, isNullEval.getLeftExpr().getType());
+    assertEquals(EvalType.IS_NULL, isNullEval.getType());
+    assertEquals(EvalType.FIELD, isNullEval.getLeftExpr().getType());
     FieldEval left = (FieldEval) isNullEval.getLeftExpr();
     assertEquals("name", left.getColumnName());
-    assertEquals(Type.CONST, isNullEval.getRightExpr().getType());
-    ConstEval constEval = (ConstEval) isNullEval.getRightExpr();
-    assertEquals(DatumFactory.createNullDatum(), constEval.getValue());
+    assertEquals(EvalType.CONST, isNullEval.getRightExpr().getType());
+  }
+
+  private static void assertJsonSerDer(EvalNode expr) {
+    String json = expr.toJson();
+    EvalNode fromJson = CoreGsonHelper.fromJson(json, EvalNode.class);
+    assertEquals(expr, fromJson);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java
index 3638352..1a24ec8 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java
@@ -27,14 +27,13 @@ import org.apache.tajo.catalog.proto.CatalogProtos.FunctionType;
 import org.apache.tajo.catalog.proto.CatalogProtos.StoreType;
 import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.datum.DatumFactory;
-import org.apache.tajo.engine.eval.EvalNode.Type;
 import org.apache.tajo.engine.eval.TestEvalTree.TestSum;
-import org.apache.tajo.engine.planner.LogicalPlanner;
-import org.apache.tajo.engine.planner.Target;
 import org.apache.tajo.engine.parser.SQLAnalyzer;
 import org.apache.tajo.engine.planner.LogicalPlan;
+import org.apache.tajo.engine.planner.LogicalPlanner;
+import org.apache.tajo.engine.planner.Target;
 import org.apache.tajo.engine.planner.logical.EvalExprNode;
-import org.apache.tajo.engine.planner.logical.ExprType;
+import org.apache.tajo.engine.planner.logical.NodeType;
 import org.apache.tajo.exception.InternalException;
 import org.apache.tajo.master.TajoMaster;
 import org.junit.AfterClass;
@@ -98,7 +97,7 @@ public class TestEvalTreeUtil {
   public static Target [] getRawTargets(String query) {
     Expr expr = analyzer.parse(query);
     LogicalPlan plan = planner.createPlan(expr);
-    if (plan.getRootBlock().getRoot().getType() == ExprType.EXPRS) {
+    if (plan.getRootBlock().getRoot().getType() == NodeType.EXPRS) {
       return ((EvalExprNode)plan.getRootBlock().getRoot()).getExprs();
     } else {
       return plan.getRootBlock().getTargetListManager().getUnEvaluatedTargets();
@@ -182,14 +181,14 @@ public class TestEvalTreeUtil {
     Collection<EvalNode> exprs =
         EvalTreeUtil.getContainExpr(targets[0].getEvalTree(), col1);
     EvalNode node = exprs.iterator().next();
-    assertEquals(Type.LTH, node.getType());
-    assertEquals(Type.PLUS, node.getLeftExpr().getType());
+    assertEquals(EvalType.LTH, node.getType());
+    assertEquals(EvalType.PLUS, node.getLeftExpr().getType());
     assertEquals(new ConstEval(DatumFactory.createInt4(4)), node.getRightExpr());
     
     Column col2 = new Column("people.age", TajoDataTypes.Type.INT4);
     exprs = EvalTreeUtil.getContainExpr(targets[1].getEvalTree(), col2);
     node = exprs.iterator().next();
-    assertEquals(Type.GTH, node.getType());
+    assertEquals(EvalType.GTH, node.getType());
     assertEquals("people.age", node.getLeftExpr().getName());
     assertEquals(new ConstEval(DatumFactory.createInt4(5)), node.getRightExpr());
   }
@@ -208,14 +207,14 @@ public class TestEvalTreeUtil {
     
     FieldEval field = (FieldEval) first.getLeftExpr();
     assertEquals(col1, field.getColumnRef());
-    assertEquals(Type.LTH, first.getType());
+    assertEquals(EvalType.LTH, first.getType());
     EvalContext firstRCtx = first.getRightExpr().newContext();
     first.getRightExpr().eval(firstRCtx, null,  null);
     assertEquals(10, first.getRightExpr().terminate(firstRCtx).asInt4());
     
     field = (FieldEval) second.getRightExpr();
     assertEquals(col1, field.getColumnRef());
-    assertEquals(Type.LTH, second.getType());
+    assertEquals(EvalType.LTH, second.getType());
     EvalContext secondLCtx = second.getLeftExpr().newContext();
     second.getLeftExpr().eval(secondLCtx, null,  null);
     assertEquals(4, second.getLeftExpr().terminate(secondLCtx).asInt4());
@@ -241,11 +240,11 @@ public class TestEvalTreeUtil {
     Target [] targets = getRawTargets(QUERIES[0]);
     EvalNode node = AlgebraicUtil.simplify(targets[0].getEvalTree());
     EvalContext nodeCtx = node.newContext();
-    assertEquals(Type.CONST, node.getType());
+    assertEquals(EvalType.CONST, node.getType());
     node.eval(nodeCtx, null, null);
     assertEquals(7, node.terminate(nodeCtx).asInt4());
     node = AlgebraicUtil.simplify(targets[1].getEvalTree());
-    assertEquals(Type.CONST, node.getType());
+    assertEquals(EvalType.CONST, node.getType());
     nodeCtx = node.newContext();
     node.eval(nodeCtx, null, null);
     assertTrue(7.0d == node.terminate(nodeCtx).asFloat8());
@@ -276,7 +275,7 @@ public class TestEvalTreeUtil {
     EvalNode node = getRootSelection(QUERIES[3]);
     // we expect that score < 3
     EvalNode transposed = AlgebraicUtil.transpose(node, col1);
-    assertEquals(Type.GTH, transposed.getType());
+    assertEquals(EvalType.GTH, transposed.getType());
     FieldEval field = (FieldEval) transposed.getLeftExpr(); 
     assertEquals(col1, field.getColumnRef());
     EvalContext evalCtx = transposed.getRightExpr().newContext();
@@ -286,7 +285,7 @@ public class TestEvalTreeUtil {
     node = getRootSelection(QUERIES[4]);
     // we expect that score < 3
     transposed = AlgebraicUtil.transpose(node, col1);
-    assertEquals(Type.LTH, transposed.getType());
+    assertEquals(EvalType.LTH, transposed.getType());
     field = (FieldEval) transposed.getLeftExpr(); 
     assertEquals(col1, field.getColumnRef());
     evalCtx = transposed.getRightExpr().newContext();

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/49607a54/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/plan/global/TestGlobalQueryPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/plan/global/TestGlobalQueryPlanner.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/plan/global/TestGlobalQueryPlanner.java
index cf0d70a..cc75726 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/plan/global/TestGlobalQueryPlanner.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/plan/global/TestGlobalQueryPlanner.java
@@ -163,8 +163,8 @@ public class TestGlobalQueryPlanner {
     assertEquals(PartitionType.LIST, unit.getPartitionType());
 
     LogicalNode plan2 = unit.getPlan();
-    assertEquals(ExprType.STORE, plan2.getType());
-    assertEquals(ExprType.SCAN, ((StoreTableNode)plan2).getSubNode().getType());
+    assertEquals(NodeType.STORE, plan2.getType());
+    assertEquals(NodeType.SCAN, ((StoreTableNode)plan2).getChild().getType());
   }
 
   @Test
@@ -218,15 +218,15 @@ public class TestGlobalQueryPlanner {
     ExecutionBlock next, prev;
     
     next = globalPlan.getRoot();
-    assertEquals(ExprType.PROJECTION,
-        next.getStoreTableNode().getSubNode().getType());
+    assertEquals(NodeType.PROJECTION,
+        next.getStoreTableNode().getChild().getType());
     assertTrue(next.hasChildBlock());
     assertEquals(PartitionType.LIST, next.getPartitionType());
     Iterator<ExecutionBlock> it= next.getChildBlocks().iterator();
 
     prev = it.next();
-    assertEquals(ExprType.SORT,
-        prev.getStoreTableNode().getSubNode().getType());
+    assertEquals(NodeType.SORT,
+        prev.getStoreTableNode().getChild().getType());
     assertTrue(prev.hasChildBlock());
     assertEquals(PartitionType.LIST, prev.getPartitionType());
     it= prev.getChildBlocks().iterator();
@@ -265,13 +265,13 @@ public class TestGlobalQueryPlanner {
     next = globalPlan.getRoot();
     assertTrue(next.hasChildBlock());
     assertEquals(PartitionType.LIST, next.getPartitionType());
-    assertEquals(ExprType.PROJECTION, next.getStoreTableNode().getSubNode().getType());
+    assertEquals(NodeType.PROJECTION, next.getStoreTableNode().getChild().getType());
     ScanNode []scans = next.getScanNodes();
     assertEquals(1, scans.length);
     Iterator<ExecutionBlock> it= next.getChildBlocks().iterator();
 
     prev = it.next();
-    assertEquals(ExprType.SORT, prev.getStoreTableNode().getSubNode().getType());
+    assertEquals(NodeType.SORT, prev.getStoreTableNode().getChild().getType());
     assertEquals(PartitionType.LIST, prev.getPartitionType());
     scans = prev.getScanNodes();
     assertEquals(1, scans.length);
@@ -279,7 +279,7 @@ public class TestGlobalQueryPlanner {
     
     // the first phase of the sort
     prev = it.next();
-    assertEquals(ExprType.SORT, prev.getStoreTableNode().getSubNode().getType());
+    assertEquals(NodeType.SORT, prev.getStoreTableNode().getChild().getType());
     assertEquals(scans[0].getInSchema(), prev.getOutputSchema());
     assertTrue(prev.hasChildBlock());
     assertEquals(PartitionType.RANGE, prev.getPartitionType());
@@ -291,7 +291,7 @@ public class TestGlobalQueryPlanner {
     
     // the second phase of the join
     prev = it.next();
-    assertEquals(ExprType.JOIN, prev.getStoreTableNode().getSubNode().getType());
+    assertEquals(NodeType.JOIN, prev.getStoreTableNode().getChild().getType());
     assertEquals(scans[0].getInSchema(), prev.getOutputSchema());
     assertTrue(prev.hasChildBlock());
     assertEquals(PartitionType.LIST, prev.getPartitionType());
@@ -303,13 +303,13 @@ public class TestGlobalQueryPlanner {
     
     // the first phase of the join
     prev = it.next();
-    assertEquals(ExprType.SCAN, prev.getStoreTableNode().getSubNode().getType());
+    assertEquals(NodeType.SCAN, prev.getStoreTableNode().getChild().getType());
     assertFalse(prev.hasChildBlock());
     assertEquals(PartitionType.HASH, prev.getPartitionType());
     assertEquals(1, prev.getScanNodes().length);
     
     prev = it.next();
-    assertEquals(ExprType.SCAN, prev.getStoreTableNode().getSubNode().getType());
+    assertEquals(NodeType.SCAN, prev.getStoreTableNode().getChild().getType());
     assertFalse(prev.hasChildBlock());
     assertEquals(PartitionType.HASH, prev.getPartitionType());
     assertEquals(1, prev.getScanNodes().length);
@@ -327,7 +327,7 @@ public class TestGlobalQueryPlanner {
 
     ExecutionBlock unit = globalPlan.getRoot();
     StoreTableNode store = unit.getStoreTableNode();
-    assertEquals(ExprType.JOIN, store.getSubNode().getType());
+    assertEquals(NodeType.JOIN, store.getChild().getType());
     assertTrue(unit.hasChildBlock());
     ScanNode [] scans = unit.getScanNodes();
     assertEquals(2, scans.length);
@@ -335,7 +335,7 @@ public class TestGlobalQueryPlanner {
     for (ScanNode scan : scans) {
       prev = unit.getChildBlock(scan);
       store = prev.getStoreTableNode();
-      assertEquals(ExprType.SCAN, store.getSubNode().getType());
+      assertEquals(NodeType.SCAN, store.getChild().getType());
     }
   }
   
@@ -350,32 +350,32 @@ public class TestGlobalQueryPlanner {
 
     ExecutionBlock unit = globalPlan.getRoot();
     StoreTableNode store = unit.getStoreTableNode();
-    assertEquals(ExprType.PROJECTION, store.getSubNode().getType());
+    assertEquals(NodeType.PROJECTION, store.getChild().getType());
 
     ScanNode[] scans = unit.getScanNodes();
     assertEquals(1, scans.length);
 
     unit = unit.getChildBlock(scans[0]);
     store = unit.getStoreTableNode();
-    assertEquals(ExprType.UNION, store.getSubNode().getType());
-    UnionNode union = (UnionNode) store.getSubNode();
-    assertEquals(ExprType.SCAN, union.getOuterNode().getType());
-    assertEquals(ExprType.UNION, union.getInnerNode().getType());
-    union = (UnionNode) union.getInnerNode();
-    assertEquals(ExprType.SCAN, union.getOuterNode().getType());
-    assertEquals(ExprType.UNION, union.getInnerNode().getType());
-    union = (UnionNode) union.getInnerNode();
-    assertEquals(ExprType.SCAN, union.getOuterNode().getType());
-    assertEquals(ExprType.SCAN, union.getInnerNode().getType());
+    assertEquals(NodeType.UNION, store.getChild().getType());
+    UnionNode union = (UnionNode) store.getChild();
+    assertEquals(NodeType.SCAN, union.getLeftChild().getType());
+    assertEquals(NodeType.UNION, union.getRightChild().getType());
+    union = (UnionNode) union.getRightChild();
+    assertEquals(NodeType.SCAN, union.getLeftChild().getType());
+    assertEquals(NodeType.UNION, union.getRightChild().getType());
+    union = (UnionNode) union.getRightChild();
+    assertEquals(NodeType.SCAN, union.getLeftChild().getType());
+    assertEquals(NodeType.SCAN, union.getRightChild().getType());
     assertTrue(unit.hasChildBlock());
     
     String tableId = "";
     for (ScanNode scan : unit.getScanNodes()) {
       ExecutionBlock prev = unit.getChildBlock(scan);
       store = prev.getStoreTableNode();
-      assertEquals(ExprType.GROUP_BY, store.getSubNode().getType());
-      GroupbyNode groupby = (GroupbyNode) store.getSubNode();
-      assertEquals(ExprType.SCAN, groupby.getSubNode().getType());
+      assertEquals(NodeType.GROUP_BY, store.getChild().getType());
+      GroupbyNode groupby = (GroupbyNode) store.getChild();
+      assertEquals(NodeType.SCAN, groupby.getChild().getType());
       if (tableId.equals("")) {
         tableId = store.getTableName();
       } else {
@@ -384,9 +384,9 @@ public class TestGlobalQueryPlanner {
       assertEquals(1, prev.getScanNodes().length);
       prev = prev.getChildBlock(prev.getScanNodes()[0]);
       store = prev.getStoreTableNode();
-      assertEquals(ExprType.GROUP_BY, store.getSubNode().getType());
-      groupby = (GroupbyNode) store.getSubNode();
-      assertEquals(ExprType.SCAN, groupby.getSubNode().getType());
+      assertEquals(NodeType.GROUP_BY, store.getChild().getType());
+      groupby = (GroupbyNode) store.getChild();
+      assertEquals(NodeType.SCAN, groupby.getChild().getType());
     }
   }
 }


Mime
View raw message