You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2013/05/09 07:38:38 UTC

[06/11] TAJO-57: Recognize Parser and Catalog Standard SQL data types. (hyunsik)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/eval/TestEvalTree.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/eval/TestEvalTree.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/eval/TestEvalTree.java
index 6e811b6..e9a3bff 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/eval/TestEvalTree.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/eval/TestEvalTree.java
@@ -25,9 +25,9 @@ import org.junit.Test;
 import tajo.TajoTestingCluster;
 import tajo.catalog.*;
 import tajo.catalog.function.GeneralFunction;
-import tajo.catalog.proto.CatalogProtos.DataType;
 import tajo.catalog.proto.CatalogProtos.FunctionType;
 import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes.DataType;
 import tajo.datum.Datum;
 import tajo.datum.DatumFactory;
 import tajo.engine.eval.EvalNode.Type;
@@ -39,6 +39,7 @@ import tajo.storage.Tuple;
 import tajo.storage.VTuple;
 
 import static org.junit.Assert.*;
+import static tajo.common.TajoDataTypes.Type.*;
 
 public class TestEvalTree {
   private static TajoTestingCluster util;
@@ -56,36 +57,36 @@ public class TestEvalTree {
     }
 
     Schema schema = new Schema();
-    schema.addColumn("name", DataType.STRING);
-    schema.addColumn("score", DataType.INT);
-    schema.addColumn("age", DataType.INT);
+    schema.addColumn("name", TEXT);
+    schema.addColumn("score", INT4);
+    schema.addColumn("age", INT4);
 
-    TableMeta meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    TableMeta meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
     TableDesc desc = new TableDescImpl("people", meta, new Path("file:///"));
     cat.addTable(desc);
 
     FunctionDesc funcMeta = new FunctionDesc("sum", TestSum.class, FunctionType.GENERAL,
-        new DataType [] {DataType.INT},
-        new DataType [] {DataType.INT, DataType.INT});
+        CatalogUtil.newDataTypesWithoutLen(INT4),
+        CatalogUtil.newDataTypesWithoutLen(INT4, INT4));
     cat.registerFunction(funcMeta);
 
     analyzer = new QueryAnalyzer(cat);
     
     tuples[0] = new VTuple(3);
     tuples[0].put(new Datum[] {
-        DatumFactory.createString("aabc"),
-        DatumFactory.createInt(100), 
-        DatumFactory.createInt(10)});
+        DatumFactory.createText("aabc"),
+        DatumFactory.createInt4(100),
+        DatumFactory.createInt4(10)});
     tuples[1] = new VTuple(3);
     tuples[1].put(new Datum[] {
-        DatumFactory.createString("aaba"),
-        DatumFactory.createInt(200), 
-        DatumFactory.createInt(20)});
+        DatumFactory.createText("aaba"),
+        DatumFactory.createInt4(200),
+        DatumFactory.createInt4(20)});
     tuples[2] = new VTuple(3);
     tuples[2].put(new Datum[] {
-        DatumFactory.createString("kabc"),
-        DatumFactory.createInt(300), 
-        DatumFactory.createInt(30)});
+        DatumFactory.createText("kabc"),
+        DatumFactory.createInt4(300),
+        DatumFactory.createInt4(30)});
   }
 
   @AfterClass
@@ -98,15 +99,15 @@ public class TestEvalTree {
     private Integer y;
 
     public TestSum() {
-      super(new Column[] { new Column("arg1", DataType.INT),
-          new Column("arg2", DataType.INT) });
+      super(new Column[] { new Column("arg1", INT4),
+          new Column("arg2", INT4) });
     }
 
     @Override
     public Datum eval(Tuple params) {
-      x =  params.get(0).asInt();
-      y =  params.get(1).asInt();
-      return DatumFactory.createInt(x + y);
+      x =  params.get(0).asInt4();
+      y =  params.get(1).asInt4();
+      return DatumFactory.createInt4(x + y);
     }
     
     public String toJSON() {
@@ -128,9 +129,9 @@ public class TestEvalTree {
     Tuple tuple = new VTuple(3);
     tuple.put(
         new Datum[] {
-          DatumFactory.createString("hyunsik"),
-          DatumFactory.createInt(500),
-          DatumFactory.createInt(30)});
+          DatumFactory.createText("hyunsik"),
+          DatumFactory.createInt4(500),
+          DatumFactory.createInt4(30)});
 
     QueryBlock block;
     EvalNode expr;
@@ -147,21 +148,21 @@ public class TestEvalTree {
     expr = block.getWhereCondition();
     evalCtx = expr.newContext();
     expr.eval(evalCtx, peopleSchema, tuple);
-    assertEquals(15000, expr.terminate(evalCtx).asInt());
+    assertEquals(15000, expr.terminate(evalCtx).asInt4());
     assertCloneEqual(expr);
 
     block = (QueryBlock) analyzer.parse(QUERIES[2]).getParseTree();
     expr = block.getWhereCondition();
     evalCtx = expr.newContext();
     expr.eval(evalCtx, peopleSchema, tuple);
-    assertEquals(15050, expr.terminate(evalCtx).asInt());
+    assertEquals(15050, expr.terminate(evalCtx).asInt4());
     assertCloneEqual(expr);
     
     block = (QueryBlock) analyzer.parse(QUERIES[2]).getParseTree();
     expr = block.getWhereCondition();
     evalCtx = expr.newContext();
     expr.eval(evalCtx, peopleSchema, tuple);
-    assertEquals(15050, expr.terminate(evalCtx).asInt());
+    assertEquals(15050, expr.terminate(evalCtx).asInt4());
     assertCloneEqual(expr);
     
     // Aggregation function test
@@ -173,41 +174,41 @@ public class TestEvalTree {
     Tuple [] tuples = new Tuple[tuplenum];
     for (int i=0; i < tuplenum; i++) {
       tuples[i] = new VTuple(3);
-      tuples[i].put(0, DatumFactory.createString("hyunsik"));
-      tuples[i].put(1, DatumFactory.createInt(i+1));
-      tuples[i].put(2, DatumFactory.createInt(30));
+      tuples[i].put(0, DatumFactory.createText("hyunsik"));
+      tuples[i].put(1, DatumFactory.createInt4(i + 1));
+      tuples[i].put(2, DatumFactory.createInt4(30));
     }
     
     int sum = 0;
     for (int i=0; i < tuplenum; i++) {
       expr.eval(evalCtx, peopleSchema, tuples[i]);
       sum = sum + (i+1);
-      assertEquals(sum, expr.terminate(evalCtx).asInt());
+      assertEquals(sum, expr.terminate(evalCtx).asInt4());
     }
   }
   
   
   @Test
   public void testTupleEval() throws CloneNotSupportedException {
-    ConstEval e1 = new ConstEval(DatumFactory.createInt(1));
+    ConstEval e1 = new ConstEval(DatumFactory.createInt4(1));
     assertCloneEqual(e1);
-    FieldEval e2 = new FieldEval("table1.score", DataType.INT); // it indicates
+    FieldEval e2 = new FieldEval("table1.score", CatalogUtil.newDataTypeWithoutLen(INT4)); // it indicates
     assertCloneEqual(e2);
 
     Schema schema1 = new Schema();
-    schema1.addColumn("table1.id", DataType.INT);
-    schema1.addColumn("table1.score", DataType.INT);
+    schema1.addColumn("table1.id", INT4);
+    schema1.addColumn("table1.score", INT4);
     
     BinaryEval expr = new BinaryEval(Type.PLUS, e1, e2);
     EvalContext evalCtx = expr.newContext();
     assertCloneEqual(expr);
     VTuple tuple = new VTuple(2);
-    tuple.put(0, DatumFactory.createInt(1)); // put 0th field
-    tuple.put(1, DatumFactory.createInt(99)); // put 0th field
+    tuple.put(0, DatumFactory.createInt4(1)); // put 0th field
+    tuple.put(1, DatumFactory.createInt4(99)); // put 0th field
 
     // the result of evaluation must be 100.
     expr.eval(evalCtx, schema1, tuple);
-    assertEquals(expr.terminate(evalCtx).asInt(), 100);
+    assertEquals(expr.terminate(evalCtx).asInt4(), 100);
   }
 
   public static class MockTrueEval extends EvalNode {
@@ -238,7 +239,7 @@ public class TestEvalTree {
 
     @Override
     public DataType [] getValueType() {
-      return new DataType [] {DataType.BOOLEAN};
+      return CatalogUtil.newDataTypesWithoutLen(BOOLEAN);
     }
 
   }
@@ -271,7 +272,7 @@ public class TestEvalTree {
 
     @Override
     public DataType [] getValueType() {
-      return new DataType [] {DataType.BOOLEAN};
+      return CatalogUtil.newDataTypesWithoutLen(BOOLEAN);
     }
   }
 
@@ -334,8 +335,8 @@ public class TestEvalTree {
     BinaryEval expr;
 
     // Constant
-    e1 = new ConstEval(DatumFactory.createInt(9));
-    e2 = new ConstEval(DatumFactory.createInt(34));
+    e1 = new ConstEval(DatumFactory.createInt4(9));
+    e2 = new ConstEval(DatumFactory.createInt4(34));
     expr = new BinaryEval(Type.LTH, e1, e2);
     EvalContext evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
@@ -414,39 +415,39 @@ public class TestEvalTree {
     ConstEval e2;
 
     // PLUS
-    e1 = new ConstEval(DatumFactory.createInt(9));
-    e2 = new ConstEval(DatumFactory.createInt(34));
+    e1 = new ConstEval(DatumFactory.createInt4(9));
+    e2 = new ConstEval(DatumFactory.createInt4(34));
     BinaryEval expr = new BinaryEval(Type.PLUS, e1, e2);
     EvalContext evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
-    assertEquals(expr.terminate(evalCtx).asInt(), 43);
+    assertEquals(expr.terminate(evalCtx).asInt4(), 43);
     assertCloneEqual(expr);
     
     // MINUS
-    e1 = new ConstEval(DatumFactory.createInt(5));
-    e2 = new ConstEval(DatumFactory.createInt(2));
+    e1 = new ConstEval(DatumFactory.createInt4(5));
+    e2 = new ConstEval(DatumFactory.createInt4(2));
     expr = new BinaryEval(Type.MINUS, e1, e2);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
-    assertEquals(expr.terminate(evalCtx).asInt(), 3);
+    assertEquals(expr.terminate(evalCtx).asInt4(), 3);
     assertCloneEqual(expr);
     
     // MULTIPLY
-    e1 = new ConstEval(DatumFactory.createInt(5));
-    e2 = new ConstEval(DatumFactory.createInt(2));
+    e1 = new ConstEval(DatumFactory.createInt4(5));
+    e2 = new ConstEval(DatumFactory.createInt4(2));
     expr = new BinaryEval(Type.MULTIPLY, e1, e2);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
-    assertEquals(expr.terminate(evalCtx).asInt(), 10);
+    assertEquals(expr.terminate(evalCtx).asInt4(), 10);
     assertCloneEqual(expr);
     
     // DIVIDE
-    e1 = new ConstEval(DatumFactory.createInt(10));
-    e2 = new ConstEval(DatumFactory.createInt(5));
+    e1 = new ConstEval(DatumFactory.createInt4(10));
+    e2 = new ConstEval(DatumFactory.createInt4(5));
     expr = new BinaryEval(Type.DIVIDE, e1, e2);
     evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
-    assertEquals(expr.terminate(evalCtx).asInt(), 2);
+    assertEquals(expr.terminate(evalCtx).asInt4(), 2);
     assertCloneEqual(expr);
   }
 
@@ -456,21 +457,21 @@ public class TestEvalTree {
     ConstEval e2;
 
     // PLUS
-    e1 = new ConstEval(DatumFactory.createInt(9));
-    e2 = new ConstEval(DatumFactory.createInt(34));
+    e1 = new ConstEval(DatumFactory.createInt4(9));
+    e2 = new ConstEval(DatumFactory.createInt4(34));
     BinaryEval expr = new BinaryEval(Type.PLUS, e1, e2);
-    assertEquals(DataType.INT, expr.getValueType()[0]);
+    assertEquals(CatalogUtil.newDataTypeWithoutLen(INT4), expr.getValueType()[0]);
 
     expr = new BinaryEval(Type.LTH, e1, e2);
     EvalContext evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);
     assertTrue(expr.terminate(evalCtx).asBool());
-    assertEquals(DataType.BOOLEAN, expr.getValueType()[0]);
+    assertEquals(CatalogUtil.newDataTypeWithoutLen(BOOLEAN), expr.getValueType()[0]);
 
-    e1 = new ConstEval(DatumFactory.createDouble(9.3));
-    e2 = new ConstEval(DatumFactory.createDouble(34.2));
+    e1 = new ConstEval(DatumFactory.createFloat8(9.3));
+    e2 = new ConstEval(DatumFactory.createFloat8(34.2));
     expr = new BinaryEval(Type.PLUS, e1, e2);
-    assertEquals(DataType.DOUBLE, expr.getValueType()[0]);
+    assertEquals(CatalogUtil.newDataTypeWithoutLen(FLOAT8), expr.getValueType()[0]);
   }
   
   @Test
@@ -479,26 +480,26 @@ public class TestEvalTree {
     ConstEval e2;
 
     // PLUS
-    e1 = new ConstEval(DatumFactory.createInt(34));
-    e2 = new ConstEval(DatumFactory.createInt(34));
+    e1 = new ConstEval(DatumFactory.createInt4(34));
+    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);
     assertEquals(plus1, plus2);
     
-    ConstEval e3 = new ConstEval(DatumFactory.createInt(29));
+    ConstEval e3 = new ConstEval(DatumFactory.createInt4(29));
     BinaryEval plus3 = new BinaryEval(Type.PLUS, e1, e3);
     assertFalse(plus1.equals(plus3));
     
     // LTH
-    ConstEval e4 = new ConstEval(DatumFactory.createInt(9));
-    ConstEval e5 = new ConstEval(DatumFactory.createInt(34));
+    ConstEval e4 = new ConstEval(DatumFactory.createInt4(9));
+    ConstEval e5 = new ConstEval(DatumFactory.createInt4(34));
     BinaryEval compExpr1 = new BinaryEval(Type.LTH, e4, e5);
     assertCloneEqual(compExpr1);
     
-    ConstEval e6 = new ConstEval(DatumFactory.createInt(9));
-    ConstEval e7 = new ConstEval(DatumFactory.createInt(34));
+    ConstEval e6 = new ConstEval(DatumFactory.createInt4(9));
+    ConstEval e7 = new ConstEval(DatumFactory.createInt4(34));
     BinaryEval compExpr2 = new BinaryEval(Type.LTH, e6, e7);
     assertCloneEqual(compExpr2);
     
@@ -511,8 +512,8 @@ public class TestEvalTree {
     ConstEval e2;
 
     // 29 > (34 + 5) + (5 + 34)
-    e1 = new ConstEval(DatumFactory.createInt(34));
-    e2 = new ConstEval(DatumFactory.createInt(5));
+    e1 = new ConstEval(DatumFactory.createInt4(34));
+    e2 = new ConstEval(DatumFactory.createInt4(5));
     assertCloneEqual(e1); 
     
     BinaryEval plus1 = new BinaryEval(Type.PLUS, e1, e2);
@@ -522,7 +523,7 @@ public class TestEvalTree {
     BinaryEval plus3 = new BinaryEval(Type.PLUS, plus2, plus1);
     assertCloneEqual(plus3);
     
-    ConstEval e3 = new ConstEval(DatumFactory.createInt(29));
+    ConstEval e3 = new ConstEval(DatumFactory.createInt4(29));
     BinaryEval gth = new BinaryEval(Type.GTH, e3, plus3);
     assertCloneEqual(gth);
     
@@ -558,8 +559,8 @@ public class TestEvalTree {
     EvalNode expr;
 
     // Constant
-    e1 = new ConstEval(DatumFactory.createInt(9));
-    e2 = new ConstEval(DatumFactory.createInt(34));
+    e1 = new ConstEval(DatumFactory.createInt4(9));
+    e2 = new ConstEval(DatumFactory.createInt4(34));
     expr = new BinaryEval(Type.LTH, e1, e2);
     EvalContext evalCtx = expr.newContext();
     expr.eval(evalCtx, null, null);

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/eval/TestEvalTreeUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/eval/TestEvalTreeUtil.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/eval/TestEvalTreeUtil.java
index 0bb9b32..2eae279 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/eval/TestEvalTreeUtil.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/eval/TestEvalTreeUtil.java
@@ -25,9 +25,9 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import tajo.TajoTestingCluster;
 import tajo.catalog.*;
-import tajo.catalog.proto.CatalogProtos.DataType;
 import tajo.catalog.proto.CatalogProtos.FunctionType;
 import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes;
 import tajo.datum.DatumFactory;
 import tajo.engine.eval.EvalNode.Type;
 import tajo.engine.eval.TestEvalTree.TestSum;
@@ -65,18 +65,18 @@ public class TestEvalTreeUtil {
     }
 
     Schema schema = new Schema();
-    schema.addColumn("name", DataType.STRING);
-    schema.addColumn("score", DataType.INT);
-    schema.addColumn("age", DataType.INT);
+    schema.addColumn("name", TajoDataTypes.Type.TEXT);
+    schema.addColumn("score", TajoDataTypes.Type.INT4);
+    schema.addColumn("age", TajoDataTypes.Type.INT4);
 
-    TableMeta meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    TableMeta meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
     TableDesc desc = new TableDescImpl("people", meta, new Path("file:///"));
     catalog.addTable(desc);
 
     FunctionDesc funcMeta = new FunctionDesc("sum", TestSum.class,
         FunctionType.GENERAL,
-        new DataType [] {DataType.INT},
-        new DataType [] {DataType.INT,DataType.INT});
+        CatalogUtil.newDataTypesWithoutLen(TajoDataTypes.Type.INT4),
+        CatalogUtil.newDataTypesWithoutLen(TajoDataTypes.Type.INT4, TajoDataTypes.Type.INT4));
     catalog.registerFunction(funcMeta);
 
     analyzer = new QueryAnalyzer(catalog);
@@ -105,38 +105,38 @@ public class TestEvalTreeUtil {
     EvalTreeUtil.changeColumnRef(copy, "people.score", "newscore");
     Set<Column> set = EvalTreeUtil.findDistinctRefColumns(copy);
     assertEquals(1, set.size());
-    assertTrue(set.contains(new Column("newscore", DataType.INT)));
+    assertTrue(set.contains(new Column("newscore", TajoDataTypes.Type.INT4)));
     
     copy = (EvalNode)expr2.clone();
     EvalTreeUtil.changeColumnRef(copy, "people.age", "sum_age");
     set = EvalTreeUtil.findDistinctRefColumns(copy);
     assertEquals(2, set.size());
-    assertTrue(set.contains(new Column("people.score", DataType.INT)));
-    assertTrue(set.contains(new Column("sum_age", DataType.INT)));
+    assertTrue(set.contains(new Column("people.score", TajoDataTypes.Type.INT4)));
+    assertTrue(set.contains(new Column("sum_age", TajoDataTypes.Type.INT4)));
     
     copy = (EvalNode)expr3.clone();
     EvalTreeUtil.changeColumnRef(copy, "people.age", "sum_age");
     set = EvalTreeUtil.findDistinctRefColumns(copy);
     assertEquals(2, set.size());
-    assertTrue(set.contains(new Column("people.score", DataType.INT)));
-    assertTrue(set.contains(new Column("sum_age", DataType.INT)));
+    assertTrue(set.contains(new Column("people.score", TajoDataTypes.Type.INT4)));
+    assertTrue(set.contains(new Column("sum_age", TajoDataTypes.Type.INT4)));
   }
 
   @Test
   public final void testFindAllRefColumns() {    
     Set<Column> set = EvalTreeUtil.findDistinctRefColumns(expr1);
     assertEquals(1, set.size());
-    assertTrue(set.contains(new Column("people.score", DataType.INT)));
+    assertTrue(set.contains(new Column("people.score", TajoDataTypes.Type.INT4)));
     
     set = EvalTreeUtil.findDistinctRefColumns(expr2);
     assertEquals(2, set.size());
-    assertTrue(set.contains(new Column("people.score", DataType.INT)));
-    assertTrue(set.contains(new Column("people.age", DataType.INT)));
+    assertTrue(set.contains(new Column("people.score", TajoDataTypes.Type.INT4)));
+    assertTrue(set.contains(new Column("people.age", TajoDataTypes.Type.INT4)));
     
     set = EvalTreeUtil.findDistinctRefColumns(expr3);
     assertEquals(2, set.size());
-    assertTrue(set.contains(new Column("people.score", DataType.INT)));
-    assertTrue(set.contains(new Column("people.age", DataType.INT)));
+    assertTrue(set.contains(new Column("people.score", TajoDataTypes.Type.INT4)));
+    assertTrue(set.contains(new Column("people.age", TajoDataTypes.Type.INT4)));
   }
   
   public static final String [] QUERIES = {
@@ -157,9 +157,9 @@ public class TestEvalTreeUtil {
     Column col1 = schema.getColumn(0);
     Column col2 = schema.getColumn(1);
     assertEquals("plus", col1.getColumnName());
-    assertEquals(DataType.INT, col1.getDataType());
+    assertEquals(TajoDataTypes.Type.INT4, col1.getDataType().getType());
     assertEquals("mul", col2.getColumnName());
-    assertEquals(DataType.DOUBLE, col2.getDataType());
+    assertEquals(TajoDataTypes.Type.FLOAT8, col2.getDataType().getType());
   }
   
   @Test
@@ -167,20 +167,20 @@ public class TestEvalTreeUtil {
     QueryBlock block = (QueryBlock) analyzer.parse(QUERIES[1]).getParseTree();
     Target [] targets = block.getTargetList();
     
-    Column col1 = new Column("people.score", DataType.INT);
+    Column col1 = new Column("people.score", TajoDataTypes.Type.INT4);
     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(new ConstEval(DatumFactory.createInt(4)), node.getRightExpr());
+    assertEquals(new ConstEval(DatumFactory.createInt4(4)), node.getRightExpr());
     
-    Column col2 = new Column("people.age", DataType.INT);
+    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("people.age", node.getLeftExpr().getName());
-    assertEquals(new ConstEval(DatumFactory.createInt(5)), node.getRightExpr());
+    assertEquals(new ConstEval(DatumFactory.createInt4(5)), node.getRightExpr());
   }
   
   @Test
@@ -190,7 +190,7 @@ public class TestEvalTreeUtil {
     EvalNode node = block.getWhereCondition();
     EvalNode [] cnf = EvalTreeUtil.getConjNormalForm(node);
     
-    Column col1 = new Column("people.score", DataType.INT);
+    Column col1 = new Column("people.score", TajoDataTypes.Type.INT4);
     
     assertEquals(2, cnf.length);
     EvalNode first = cnf[0];
@@ -201,14 +201,14 @@ public class TestEvalTreeUtil {
     assertEquals(Type.LTH, first.getType());
     EvalContext firstRCtx = first.getRightExpr().newContext();
     first.getRightExpr().eval(firstRCtx, null,  null);
-    assertEquals(10, first.getRightExpr().terminate(firstRCtx).asInt());
+    assertEquals(10, first.getRightExpr().terminate(firstRCtx).asInt4());
     
     field = (FieldEval) second.getRightExpr();
     assertEquals(col1, field.getColumnRef());
     assertEquals(Type.LTH, second.getType());
     EvalContext secondLCtx = second.getLeftExpr().newContext();
     second.getLeftExpr().eval(secondLCtx, null,  null);
-    assertEquals(4, second.getLeftExpr().terminate(secondLCtx).asInt());
+    assertEquals(4, second.getLeftExpr().terminate(secondLCtx).asInt4());
   }
   
   @Test
@@ -235,16 +235,16 @@ public class TestEvalTreeUtil {
     EvalContext nodeCtx = node.newContext();
     assertEquals(Type.CONST, node.getType());
     node.eval(nodeCtx, null, null);
-    assertEquals(7, node.terminate(nodeCtx).asInt());
+    assertEquals(7, node.terminate(nodeCtx).asInt4());
     node = AlgebraicUtil.simplify(targets[1].getEvalTree());
     assertEquals(Type.CONST, node.getType());
     nodeCtx = node.newContext();
     node.eval(nodeCtx, null, null);
-    assertTrue(7.0d == node.terminate(nodeCtx).asDouble());
+    assertTrue(7.0d == node.terminate(nodeCtx).asFloat8());
 
     block = (QueryBlock) analyzer.parse(QUERIES[1]).getParseTree();
     targets = block.getTargetList();
-    Column col1 = new Column("people.score", DataType.INT);
+    Column col1 = new Column("people.score", TajoDataTypes.Type.INT4);
     Collection<EvalNode> exprs =
         EvalTreeUtil.getContainExpr(targets[0].getEvalTree(), col1);
     node = exprs.iterator().next();
@@ -268,7 +268,7 @@ public class TestEvalTreeUtil {
     EvalNode node = block.getWhereCondition();
     assertEquals(true, AlgebraicUtil.containSingleVar(node));
     
-    Column col1 = new Column("people.score", DataType.INT);
+    Column col1 = new Column("people.score", TajoDataTypes.Type.INT4);
     block = (QueryBlock) analyzer.parse(QUERIES[3]).getParseTree();
     node = block.getWhereCondition();    
     // we expect that score < 3
@@ -278,7 +278,7 @@ public class TestEvalTreeUtil {
     assertEquals(col1, field.getColumnRef());
     EvalContext evalCtx = transposed.getRightExpr().newContext();
     transposed.getRightExpr().eval(evalCtx, null, null);
-    assertEquals(1, transposed.getRightExpr().terminate(evalCtx).asInt());
+    assertEquals(1, transposed.getRightExpr().terminate(evalCtx).asInt4());
 
     block = (QueryBlock) analyzer.parse(QUERIES[4]).getParseTree();
     node = block.getWhereCondition();    
@@ -289,7 +289,7 @@ public class TestEvalTreeUtil {
     assertEquals(col1, field.getColumnRef());
     evalCtx = transposed.getRightExpr().newContext();
     transposed.getRightExpr().eval(evalCtx, null, null);
-    assertEquals(2, transposed.getRightExpr().terminate(evalCtx).asInt());
+    assertEquals(2, transposed.getRightExpr().terminate(evalCtx).asInt4());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/function/TestAggFunction.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/function/TestAggFunction.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/function/TestAggFunction.java
index 35c8859..3544bb9 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/function/TestAggFunction.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/function/TestAggFunction.java
@@ -36,7 +36,7 @@ public class TestAggFunction {
 
     for (int i = 1; i <= 5; i++) {
       tuples[i-1] = new VTuple(1);
-      tuples[i-1].put(0, DatumFactory.createInt(i));
+      tuples[i-1].put(0, DatumFactory.createInt4(i));
     }
 
     AvgLong avg = new AvgLong();
@@ -45,7 +45,7 @@ public class TestAggFunction {
       avg.eval(ctx, tuples[i-1]);
     }
 
-    assertTrue(15 / 5 == avg.terminate(ctx).asDouble());
+    assertTrue(15 / 5 == avg.terminate(ctx).asFloat8());
 
 
     Tuple [] tuples2 = new Tuple[10];
@@ -53,13 +53,13 @@ public class TestAggFunction {
     FunctionContext ctx2 = avg.newContext();
     for (int i = 1; i <= 10; i++) {
       tuples2[i-1] = new VTuple(1);
-      tuples2[i-1].put(0, DatumFactory.createInt(i));
+      tuples2[i-1].put(0, DatumFactory.createInt4(i));
       avg.eval(ctx2, tuples2[i-1]);
     }
-    assertTrue((double)55 / 10 == avg.terminate(ctx2).asDouble());
+    assertTrue((double)55 / 10 == avg.terminate(ctx2).asFloat8());
 
 
     avg.merge(ctx, new VTuple(new Datum[] {avg.getPartialResult(ctx2)}));
-    assertTrue((double)(15 + 55) / (5 + 10) == avg.terminate(ctx).asDouble());
+    assertTrue((double)(15 + 55) / (5 + 10) == avg.terminate(ctx).asFloat8());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/function/TestGeneralFunction.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/function/TestGeneralFunction.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/function/TestGeneralFunction.java
index 5a85eeb..889d57b 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/function/TestGeneralFunction.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/function/TestGeneralFunction.java
@@ -20,8 +20,8 @@ package tajo.engine.function;
 
 import org.junit.Test;
 import tajo.datum.Datum;
-import tajo.datum.LongDatum;
-import tajo.datum.StringDatum;
+import tajo.datum.Int8Datum;
+import tajo.datum.TextDatum;
 import tajo.engine.function.builtin.Date;
 import tajo.storage.Tuple;
 import tajo.storage.VTuple;
@@ -35,10 +35,10 @@ public class TestGeneralFunction {
   @Test
   public void testDate() {
     Date date = new Date();
-    Tuple tuple = new VTuple(new Datum[] {new StringDatum("25/12/2012 00:00:00")});
-    LongDatum unixtime = (LongDatum) date.eval(tuple);
+    Tuple tuple = new VTuple(new Datum[] {new TextDatum("25/12/2012 00:00:00")});
+    Int8Datum unixtime = (Int8Datum) date.eval(tuple);
     Calendar c = Calendar.getInstance();
-    c.setTimeInMillis(unixtime.asLong());
+    c.setTimeInMillis(unixtime.asInt8());
     assertEquals(2012, c.get(Calendar.YEAR));
     assertEquals(11, c.get(Calendar.MONTH));
     assertEquals(25, c.get(Calendar.DAY_OF_MONTH));

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/parser/TestNQLParser.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/parser/TestNQLParser.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/parser/TestNQLParser.java
index ae72ee4..29d815a 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/parser/TestNQLParser.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/parser/TestNQLParser.java
@@ -93,13 +93,13 @@ public class TestNQLParser {
     int cubeIdx = 0;
     Tree cube = groupby.getChild(grpIdx);
     assertEquals(NQLParser.FIELD_NAME, cube.getChild(cubeIdx++).getType());
-    assertEquals(NQLParser.FIELD_NAME, cube.getChild(cubeIdx++).getType());
+    assertEquals(NQLParser.FIELD_NAME, cube.getChild(cubeIdx).getType());
     grpIdx++;
     assertEquals(NQLParser.ROLLUP, groupby.getChild(grpIdx).getType());
     
     int rollupIdx = 0;
     Tree rollup = groupby.getChild(grpIdx);
-    assertEquals(NQLParser.FIELD_NAME, rollup.getChild(rollupIdx++).getType());
+    assertEquals(NQLParser.FIELD_NAME, rollup.getChild(rollupIdx).getType());
     
     idx++;
     assertEquals(NQLParser.HAVING, ast.getChild(idx).getType());
@@ -443,15 +443,64 @@ public class TestNQLParser {
   }
 
   static String[] schemaStmts = { 
-    "drop table abc",
-    "create table name (name string, age int)",
-    "create table name (name string, age int) using rcfile",
-    "create table name (name string, age int) using rcfile with ('rcfile.buffer'=4096)",
+    "drop table abc", // 0
+    "create table name (name text, age int)", // 1
+    "create table name (name text, age int) using rcfile", // 2
+    "create table name (name text, age int) using rcfile with ('rcfile.buffer'=4096)", // 3
     "create table name as select * from test", // 4
-    "create table name (name string, age int) as select * from test", // 5
-    "create table name (name string, age int) using rcfile as select * from test", // 6
-    "create table name (name string, age int) using rcfile with ('rcfile.buffer'= 4096) as select * from test", // 7
-    "create external table table1 (name string, age int, earn long, score float) using csv location '/tmp/data'", // 8
+    "create table name (name text, age int) as select * from test", // 5
+    "create table name (name text, age int) using rcfile as select * from test", // 6
+    "create table name (name text, age int) using rcfile with ('rcfile.buffer'= 4096) as select * from test", // 7
+    "create table widetable (" +
+        "col0 bit," +
+        "col0 bit(10)," +
+        "col0 bit varying," +
+        "col0 bit varying(10)," +
+        "col1 tinyint, " +
+        "col2 smallint, " +
+        "col3 integer, " +
+        "col4 bigint, " +
+        "col5 real, " +
+        "col5 float, " +
+        "col5 float(53), " +
+        "col6 double, " +
+        "col6 double precision, " +
+        "col7 numeric, " +
+        "col7 numeric(10), " +
+        "col7 numeric(10,2), " +
+        "col8 decimal," +
+        "col8 decimal(10)," +
+        "col8 decimal(10,2)," +
+        "col9 char," +
+        "col9 character," +
+        "col10 char(10)," +
+        "col10 character(10)," +
+        "col11 varchar," +
+        "col11 character varying," +
+        "col12 varchar(255)," +
+        "col11 character varying (255)," +
+        "col11 nchar," +
+        "col11 nchar(255)," +
+        "col11 national character," +
+        "col11 national character(255)," +
+        "col11 nvarchar," +
+        "col11 nvarchar(255)," +
+        "col11 national character varying," +
+        "col11 national character varying (255)," +
+        "col11 date," +
+        "col11 time," +
+        "col11 timetz," +
+        "col11 time with time zone," +
+        "col11 timestamptz," +
+        "col11 timestamp with time zone," +
+        "col11 binary," +
+        "col11 binary(10)," +
+        "col11 varbinary(10)," +
+        "col11 binary varying(10)," +
+        "col11 blob" +
+        ") as select * from test", // 8
+    "create table widetable (col1 float(10), col2 float) as select * from test", // 9
+    "create external table table1 (name text, age int, earn bigint, score float) using csv location '/tmp/data'", // 10
   };
 
   @Test
@@ -524,10 +573,31 @@ public class TestNQLParser {
     assertEquals(NQLParser.AS, ast.getChild(4).getType());
     assertEquals(NQLParser.SELECT, ast.getChild(4).getChild(0).getType());
   }
+
+  @Test
+  public void testCreateTableWithVariousDataType1() throws RecognitionException, TQLSyntaxError {
+    Tree ast = parseQuery(schemaStmts[8]);
+    assertEquals(ast.getType(), NQLParser.CREATE_TABLE);
+    assertEquals(NQLParser.ID, ast.getChild(0).getType());
+    assertEquals(NQLParser.TABLE_DEF, ast.getChild(1).getType());
+    assertEquals(NQLParser.AS, ast.getChild(2).getType());
+    assertEquals(NQLParser.SELECT, ast.getChild(2).getChild(0).getType());
+  }
+
+  @Test
+  public void testCreateTableWithVariousDataType2() throws RecognitionException, TQLSyntaxError {
+    Tree ast = parseQuery(schemaStmts[9]);
+    assertEquals(ast.getType(), NQLParser.CREATE_TABLE);
+    assertEquals(NQLParser.ID, ast.getChild(0).getType());
+    assertEquals(NQLParser.TABLE_DEF, ast.getChild(1).getType());
+    assertEquals("10", ast.getChild(1).getChild(0).getChild(1).getChild(0).getText());
+    assertEquals(NQLParser.AS, ast.getChild(2).getType());
+    assertEquals(NQLParser.SELECT, ast.getChild(2).getChild(0).getType());
+  }
   
   @Test
   public void testCreateTableLocation1() throws RecognitionException, TQLSyntaxError {
-    Tree ast = parseQuery(schemaStmts[8]);
+    Tree ast = parseQuery(schemaStmts[10]);
     assertEquals(ast.getType(), NQLParser.CREATE_TABLE);
     assertEquals(NQLParser.ID, ast.getChild(0).getType());
     assertEquals(NQLParser.EXTERNAL, ast.getChild(1).getType());

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/parser/TestQueryAnalyzer.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/parser/TestQueryAnalyzer.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/parser/TestQueryAnalyzer.java
index dbfe71b..99865dc 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/parser/TestQueryAnalyzer.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/parser/TestQueryAnalyzer.java
@@ -25,10 +25,10 @@ import org.junit.Test;
 import tajo.TajoTestingCluster;
 import tajo.benchmark.TPCH;
 import tajo.catalog.*;
-import tajo.catalog.proto.CatalogProtos.DataType;
 import tajo.catalog.proto.CatalogProtos.FunctionType;
 import tajo.catalog.proto.CatalogProtos.IndexMethod;
 import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes;
 import tajo.datum.DatumFactory;
 import tajo.engine.eval.ConstEval;
 import tajo.engine.eval.EvalNode;
@@ -65,47 +65,47 @@ public class TestQueryAnalyzer {
     cat = util.getMiniCatalogCluster().getCatalog();
     
     schema1 = new Schema();
-    schema1.addColumn("id", DataType.INT);
-    schema1.addColumn("name", DataType.STRING);
-    schema1.addColumn("score", DataType.INT);
-    schema1.addColumn("age", DataType.INT);
+    schema1.addColumn("id", TajoDataTypes.Type.INT4);
+    schema1.addColumn("name", TajoDataTypes.Type.TEXT);
+    schema1.addColumn("score", TajoDataTypes.Type.INT4);
+    schema1.addColumn("age", TajoDataTypes.Type.INT4);
     
     Schema schema2 = new Schema();
-    schema2.addColumn("id", DataType.INT);
-    schema2.addColumn("people_id", DataType.INT);
-    schema2.addColumn("dept", DataType.STRING);
-    schema2.addColumn("year", DataType.INT);
+    schema2.addColumn("id", TajoDataTypes.Type.INT4);
+    schema2.addColumn("people_id", TajoDataTypes.Type.INT4);
+    schema2.addColumn("dept", TajoDataTypes.Type.TEXT);
+    schema2.addColumn("year", TajoDataTypes.Type.INT4);
     
     Schema schema3 = new Schema();
-    schema3.addColumn("id", DataType.INT);
-    schema3.addColumn("people_id", DataType.INT);
-    schema3.addColumn("class", DataType.STRING);
-    schema3.addColumn("branch_name", DataType.STRING);
+    schema3.addColumn("id", TajoDataTypes.Type.INT4);
+    schema3.addColumn("people_id", TajoDataTypes.Type.INT4);
+    schema3.addColumn("class", TajoDataTypes.Type.TEXT);
+    schema3.addColumn("branch_name", TajoDataTypes.Type.TEXT);
 
     Schema schema4 = new Schema();
-    schema4.addColumn("char_col", DataType.CHAR);
-    schema4.addColumn("short_col", DataType.SHORT);
-    schema4.addColumn("int_col", DataType.INT);
-    schema4.addColumn("long_col", DataType.LONG);
-    schema4.addColumn("float_col", DataType.FLOAT);
-    schema4.addColumn("double_col", DataType.DOUBLE);
-    schema4.addColumn("string_col", DataType.STRING);
-
-    TableMeta meta = TCatUtil.newTableMeta(schema1, StoreType.CSV);
+    schema4.addColumn("char_col", TajoDataTypes.Type.CHAR);
+    schema4.addColumn("short_col", TajoDataTypes.Type.INT2);
+    schema4.addColumn("int_col", TajoDataTypes.Type.INT4);
+    schema4.addColumn("long_col", TajoDataTypes.Type.INT8);
+    schema4.addColumn("float_col", TajoDataTypes.Type.FLOAT4);
+    schema4.addColumn("double_col", TajoDataTypes.Type.FLOAT8);
+    schema4.addColumn("string_col", TajoDataTypes.Type.TEXT);
+
+    TableMeta meta = CatalogUtil.newTableMeta(schema1, StoreType.CSV);
     TableDesc people = new TableDescImpl("people", meta, new Path("file:///"));
     cat.addTable(people);
     
-    TableDesc student = TCatUtil.newTableDesc("student", schema2, StoreType.CSV,
+    TableDesc student = CatalogUtil.newTableDesc("student", schema2, StoreType.CSV,
         new Options(),
         new Path("file:///"));
     cat.addTable(student);
     
-    TableDesc branch = TCatUtil.newTableDesc("branch", schema3, StoreType.CSV,
+    TableDesc branch = CatalogUtil.newTableDesc("branch", schema3, StoreType.CSV,
         new Options(),
         new Path("file:///"));
     cat.addTable(branch);
 
-    TableDesc allType = TCatUtil.newTableDesc("alltype", schema4, StoreType.CSV,
+    TableDesc allType = CatalogUtil.newTableDesc("alltype", schema4, StoreType.CSV,
         new Options(),
         new Path("file:///"));
     cat.addTable(allType);
@@ -114,18 +114,18 @@ public class TestQueryAnalyzer {
     tpch.loadSchemas();
     Schema lineitemSchema = tpch.getSchema("lineitem");
     Schema partSchema = tpch.getSchema("part");
-    TableDesc lineitem = TCatUtil.newTableDesc("lineitem", lineitemSchema, StoreType.CSV,
+    TableDesc lineitem = CatalogUtil.newTableDesc("lineitem", lineitemSchema, StoreType.CSV,
         new Options(),
         new Path("file:///"));
-    TableDesc part = TCatUtil.newTableDesc("part", partSchema, StoreType.CSV,
+    TableDesc part = CatalogUtil.newTableDesc("part", partSchema, StoreType.CSV,
         new Options(),
         new Path("file:///"));
     cat.addTable(lineitem);
     cat.addTable(part);
     
     FunctionDesc funcMeta = new FunctionDesc("sumtest", TestSum.class, FunctionType.GENERAL,
-        new DataType [] {DataType.INT},
-        new DataType [] {DataType.INT});
+        CatalogUtil.newDataTypesWithoutLen(TajoDataTypes.Type.INT4),
+        CatalogUtil.newDataTypesWithoutLen(TajoDataTypes.Type.INT4));
 
     cat.registerFunction(funcMeta);
     
@@ -273,19 +273,19 @@ public class TestQueryAnalyzer {
   }
 
   static final String [] createTableStmts = {
-    "create table table1 (name string, age int)",
-    "create table table1 (name string, age int) using rcfile",
-    "create table table1 (name string, age int) using rcfile with ('rcfile.buffer'=4096)",
+    "create table table1 (name text, age int)", // 0
+    "create table table1 (name text, age int) using rcfile", // 1
+    "create table table1 (name text, age int) using rcfile with ('rcfile.buffer'=4096)", // 2
     // create table test
-    "create table store1 as select name, score from people order by score asc, age desc null first",// 0
+    "create table store1 as select name, score from people order by score asc, age desc null first",// 3
     // create table test
-    "create table store1 (c1 string, c2 long) as select name, score from people order by score asc, age desc null first",// 1
+    "create table store1 (c1 text, c2 bigint) as select name, score from people order by score asc, age desc null first",// 4
     // create table test
-    "create table store2 using rcfile with ('rcfile.buffer' = 4096) as select name, score from people order by score asc, age desc null first", // 2
+    "create table store2 using rcfile with ('rcfile.buffer' = 4096) as select name, score from people order by score asc, age desc null first", // 5
     // create table def
-    "create table table1 (name string, age int, earn long, score float) using rcfile with ('rcfile.buffer' = 4096)", // 4
+    "create table table1 (name text, age int, earn float(10), score float(30)) using rcfile with ('rcfile.buffer' = 4096)", // 6
     // create table def with location
-    "create external table table1 (name string, age int, earn long, score float) using csv with ('csv.delimiter'='|') location '/tmp/data'" // 5
+    "create external table table1 (name text, age int, earn bigint, score float) using csv with ('csv.delimiter'='|') location '/tmp/data'" // 7
   };
 
   @Test
@@ -333,13 +333,13 @@ public class TestQueryAnalyzer {
     assertEquals("table1", stmt.getTableName());
     Schema def = stmt.getTableDef();
     assertEquals("name", def.getColumn(0).getColumnName());
-    assertEquals(DataType.STRING, def.getColumn(0).getDataType());
+    assertEquals(TajoDataTypes.Type.TEXT, def.getColumn(0).getDataType().getType());
     assertEquals("age", def.getColumn(1).getColumnName());
-    assertEquals(DataType.INT, def.getColumn(1).getDataType());
+    assertEquals(TajoDataTypes.Type.INT4, def.getColumn(1).getDataType().getType());
     assertEquals("earn", def.getColumn(2).getColumnName());
-    assertEquals(DataType.LONG, def.getColumn(2).getDataType());
+    assertEquals(TajoDataTypes.Type.FLOAT4, def.getColumn(2).getDataType().getType()); // float(10)
     assertEquals("score", def.getColumn(3).getColumnName());
-    assertEquals(DataType.FLOAT, def.getColumn(3).getDataType());
+    assertEquals(TajoDataTypes.Type.FLOAT8, def.getColumn(3).getDataType().getType()); // float(30)
     assertEquals(StoreType.RCFILE, stmt.getStoreType());
     assertFalse(stmt.hasPath());
     assertTrue(stmt.hasOptions());
@@ -352,13 +352,13 @@ public class TestQueryAnalyzer {
     assertEquals("table1", stmt.getTableName());
     Schema def = stmt.getTableDef();
     assertEquals("name", def.getColumn(0).getColumnName());
-    assertEquals(DataType.STRING, def.getColumn(0).getDataType());
+    assertEquals(TajoDataTypes.Type.TEXT, def.getColumn(0).getDataType().getType());
     assertEquals("age", def.getColumn(1).getColumnName());
-    assertEquals(DataType.INT, def.getColumn(1).getDataType());
+    assertEquals(TajoDataTypes.Type.INT4, def.getColumn(1).getDataType().getType());
     assertEquals("earn", def.getColumn(2).getColumnName());
-    assertEquals(DataType.LONG, def.getColumn(2).getDataType());
+    assertEquals(TajoDataTypes.Type.INT8, def.getColumn(2).getDataType().getType());
     assertEquals("score", def.getColumn(3).getColumnName());
-    assertEquals(DataType.FLOAT, def.getColumn(3).getDataType());    
+    assertEquals(TajoDataTypes.Type.FLOAT8, def.getColumn(3).getDataType().getType()); // float
     assertEquals(StoreType.CSV, stmt.getStoreType());    
     assertEquals("/tmp/data", stmt.getPath().toString());
     assertTrue(stmt.hasOptions());
@@ -380,9 +380,9 @@ public class TestQueryAnalyzer {
     SortSpec [] sortKeys = stmt.getSortSpecs();
     assertEquals(2, sortKeys.length);
     assertEquals("score", sortKeys[0].getSortKey().getColumnName());
-    assertEquals(DataType.INT, sortKeys[0].getSortKey().getDataType());
+    assertEquals(TajoDataTypes.Type.INT4, sortKeys[0].getSortKey().getDataType().getType());
     assertEquals("age", sortKeys[1].getSortKey().getColumnName());
-    assertEquals(DataType.INT, sortKeys[1].getSortKey().getDataType());
+    assertEquals(TajoDataTypes.Type.INT4, sortKeys[1].getSortKey().getDataType().getType());
     assertEquals(false, sortKeys[1].isAscending());
     assertEquals(true, sortKeys[1].isNullFirst());
     
@@ -605,31 +605,31 @@ public class TestQueryAnalyzer {
   @Test
   public final void testTypeInferring() {
     QueryBlock block = (QueryBlock) analyzer.parse("select 1 from alltype where char_col = 'a'").getParseTree();
-    assertEquals(DataType.CHAR, block.getWhereCondition().getRightExpr().getValueType()[0]);
+    assertEquals(TajoDataTypes.Type.CHAR, block.getWhereCondition().getRightExpr().getValueType()[0].getType());
 
     block = (QueryBlock) analyzer.parse("select 1 from alltype where short_col = 1").getParseTree();
-    assertEquals(DataType.SHORT, block.getWhereCondition().getRightExpr().getValueType()[0]);
+    assertEquals(TajoDataTypes.Type.INT2, block.getWhereCondition().getRightExpr().getValueType()[0].getType());
 
     block = (QueryBlock) analyzer.parse("select 1 from alltype where int_col = 1").getParseTree();
-    assertEquals(DataType.INT, block.getWhereCondition().getRightExpr().getValueType()[0]);
+    assertEquals(TajoDataTypes.Type.INT4, block.getWhereCondition().getRightExpr().getValueType()[0].getType());
 
     block = (QueryBlock) analyzer.parse("select 1 from alltype where long_col = 1").getParseTree();
-    assertEquals(DataType.LONG, block.getWhereCondition().getRightExpr().getValueType()[0]);
+    assertEquals(TajoDataTypes.Type.INT8, block.getWhereCondition().getRightExpr().getValueType()[0].getType());
 
     block = (QueryBlock) analyzer.parse("select 1 from alltype where float_col = 1").getParseTree();
-    assertEquals(DataType.INT, block.getWhereCondition().getRightExpr().getValueType()[0]);
+    assertEquals(TajoDataTypes.Type.INT4, block.getWhereCondition().getRightExpr().getValueType()[0].getType());
 
     block = (QueryBlock) analyzer.parse("select 1 from alltype where float_col = 1.0").getParseTree();
-    assertEquals(DataType.FLOAT, block.getWhereCondition().getRightExpr().getValueType()[0]);
+    assertEquals(TajoDataTypes.Type.FLOAT4, block.getWhereCondition().getRightExpr().getValueType()[0].getType());
 
     block = (QueryBlock) analyzer.parse("select 1 from alltype where int_col = 1.0").getParseTree();
-    assertEquals(DataType.DOUBLE, block.getWhereCondition().getRightExpr().getValueType()[0]);
+    assertEquals(TajoDataTypes.Type.FLOAT4, block.getWhereCondition().getRightExpr().getValueType()[0].getType());
 
     block = (QueryBlock) analyzer.parse("select 1 from alltype where double_col = 1.0").getParseTree();
-    assertEquals(DataType.DOUBLE, block.getWhereCondition().getRightExpr().getValueType()[0]);
+    assertEquals(TajoDataTypes.Type.FLOAT4, block.getWhereCondition().getRightExpr().getValueType()[0].getType());
 
     block = (QueryBlock) analyzer.parse("select 1 from alltype where string_col = 'a'").getParseTree();
-    assertEquals(DataType.STRING, block.getWhereCondition().getRightExpr().getValueType()[0]);
+    assertEquals(TajoDataTypes.Type.TEXT, block.getWhereCondition().getRightExpr().getValueType()[0].getType());
   }
 
   @Test
@@ -641,12 +641,12 @@ public class TestQueryAnalyzer {
     QueryBlock block = (QueryBlock) tree;
     assertTrue(block.getTargetList()[0].hasAlias());
     assertEquals("cond", block.getTargetList()[0].getAlias());
-    assertEquals(DataType.DOUBLE, block.getTargetList()[0].getEvalTree().getValueType()[0]);
+    assertEquals(TajoDataTypes.Type.FLOAT8, block.getTargetList()[0].getEvalTree().getValueType()[0].getType());
   }
 
   @Test
   public void testTarget() throws CloneNotSupportedException {
-    QueryBlock.Target t1 = new QueryBlock.Target(new ConstEval(DatumFactory.createInt(5)), 0);
+    QueryBlock.Target t1 = new QueryBlock.Target(new ConstEval(DatumFactory.createInt4(5)), 0);
     QueryBlock.Target t2 = (QueryBlock.Target) t1.clone();
     assertEquals(t1,t2);
   }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/plan/global/TestGlobalQueryPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/plan/global/TestGlobalQueryPlanner.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/plan/global/TestGlobalQueryPlanner.java
index be8a7f1..ebd9d07 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/plan/global/TestGlobalQueryPlanner.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/plan/global/TestGlobalQueryPlanner.java
@@ -32,9 +32,9 @@ import tajo.QueryId;
 import tajo.QueryIdFactory;
 import tajo.TajoTestingCluster;
 import tajo.catalog.*;
-import tajo.catalog.proto.CatalogProtos.DataType;
 import tajo.catalog.proto.CatalogProtos.FunctionType;
 import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes.Type;
 import tajo.conf.TajoConf;
 import tajo.datum.Datum;
 import tajo.datum.DatumFactory;
@@ -80,10 +80,10 @@ public class TestGlobalQueryPlanner {
     int i, j;
 
     schema = new Schema();
-    schema.addColumn("id", DataType.INT);
-    schema.addColumn("age", DataType.INT);
-    schema.addColumn("name", DataType.STRING);
-    schema.addColumn("salary", DataType.INT);
+    schema.addColumn("id", Type.INT4);
+    schema.addColumn("age", Type.INT4);
+    schema.addColumn("name", Type.TEXT);
+    schema.addColumn("salary", Type.INT4);
 
     TableMeta meta;
 
@@ -95,8 +95,8 @@ public class TestGlobalQueryPlanner {
 
     sm = new StorageManager(util.getConfiguration());
     FunctionDesc funcDesc = new FunctionDesc("sumtest", TestSum.class, FunctionType.GENERAL,
-        new DataType[] {DataType.INT},
-        new DataType[] {DataType.INT});
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4));
     catalog.registerFunction(funcDesc);
     FileSystem fs = sm.getFileSystem();
 
@@ -114,11 +114,11 @@ public class TestGlobalQueryPlanner {
     Appender appender;
     Tuple t = new VTuple(4);
     t.put(new Datum[] {
-        DatumFactory.createInt(1), DatumFactory.createInt(32),
-        DatumFactory.createString("h"), DatumFactory.createInt(10)});
+        DatumFactory.createInt4(1), DatumFactory.createInt4(32),
+        DatumFactory.createText("h"), DatumFactory.createInt4(10)});
 
     for (i = 0; i < tbNum; i++) {
-      meta = TCatUtil.newTableMeta((Schema)schema.clone(), StoreType.CSV);
+      meta = CatalogUtil.newTableMeta((Schema) schema.clone(), StoreType.CSV);
       meta.putOption(CSVFile.DELIMITER, ",");
 
       Path dataRoot = sm.getBaseDir();
@@ -135,7 +135,7 @@ public class TestGlobalQueryPlanner {
       }
       appender.close();
 
-      TableDesc desc = TCatUtil.newTableDesc("table" + i, (TableMeta)meta.clone(), tablePath);
+      TableDesc desc = CatalogUtil.newTableDesc("table" + i, (TableMeta) meta.clone(), tablePath);
       catalog.addTable(desc);
     }
 
@@ -436,7 +436,7 @@ public class TestGlobalQueryPlanner {
     };
 
     Schema schema1 = new Schema();
-    schema1.addColumn("col1", DataType.INT);
+    schema1.addColumn("col1", Type.INT4);
     TableMeta meta1 = new TableMetaImpl(schema1, StoreType.CSV, Options.create());
     TableDesc desc1 = new TableDescImpl("table1", meta1, new Path("/"));
     TableDesc desc2 = new TableDescImpl("table2", meta1, new Path("/"));
@@ -499,8 +499,8 @@ public class TestGlobalQueryPlanner {
 
     Column[] originKeys = secondGroupby.getGroupingColumns();
     Column[] newKeys = new Column[2];
-    newKeys[0] = new Column("age", DataType.INT);
-    newKeys[1] = new Column("name", DataType.STRING);
+    newKeys[0] = new Column("age", Type.INT4);
+    newKeys[1] = new Column("name", Type.TEXT);
 
     mid = planner.createMultilevelGroupby(first, newKeys);
     midGroupby = (GroupbyNode) mid.getStoreTableNode().getSubNode();

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestLogicalOptimizer.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestLogicalOptimizer.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestLogicalOptimizer.java
index 1b5fd19..2333177 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestLogicalOptimizer.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestLogicalOptimizer.java
@@ -24,9 +24,9 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import tajo.TajoTestingCluster;
 import tajo.catalog.*;
-import tajo.catalog.proto.CatalogProtos.DataType;
 import tajo.catalog.proto.CatalogProtos.FunctionType;
 import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes.Type;
 import tajo.engine.function.builtin.SumInt;
 import tajo.engine.parser.QueryAnalyzer;
 import tajo.engine.planner.logical.*;
@@ -51,20 +51,20 @@ public class TestLogicalOptimizer {
     }
     
     Schema schema = new Schema();
-    schema.addColumn("name", DataType.STRING);
-    schema.addColumn("empId", DataType.INT);
-    schema.addColumn("deptName", DataType.STRING);
+    schema.addColumn("name", Type.TEXT);
+    schema.addColumn("empId", Type.INT4);
+    schema.addColumn("deptName", Type.TEXT);
 
     Schema schema2 = new Schema();
-    schema2.addColumn("deptName", DataType.STRING);
-    schema2.addColumn("manager", DataType.STRING);
+    schema2.addColumn("deptName", Type.TEXT);
+    schema2.addColumn("manager", Type.TEXT);
 
     Schema schema3 = new Schema();
-    schema3.addColumn("deptName", DataType.STRING);
-    schema3.addColumn("score", DataType.INT);
-    schema3.addColumn("phone", DataType.INT);
+    schema3.addColumn("deptName", Type.TEXT);
+    schema3.addColumn("score", Type.INT4);
+    schema3.addColumn("phone", Type.INT4);
 
-    TableMeta meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    TableMeta meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
     TableDesc people = new TableDescImpl("employee", meta,
         new Path("file:///"));
     catalog.addTable(people);
@@ -80,8 +80,8 @@ public class TestLogicalOptimizer {
     catalog.addTable(score);
 
     FunctionDesc funcDesc = new FunctionDesc("sumtest", SumInt.class, FunctionType.GENERAL,
-        new DataType[] {DataType.INT},
-        new DataType[] {DataType.INT});
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4));
 
     catalog.registerFunction(funcDesc);
     analyzer = new QueryAnalyzer(catalog);

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestLogicalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestLogicalPlanner.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestLogicalPlanner.java
index 0c8ec4f..b5fba81 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestLogicalPlanner.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestLogicalPlanner.java
@@ -28,10 +28,10 @@ import org.junit.Test;
 import tajo.TajoTestingCluster;
 import tajo.benchmark.TPCH;
 import tajo.catalog.*;
-import tajo.catalog.proto.CatalogProtos.DataType;
 import tajo.catalog.proto.CatalogProtos.FunctionType;
 import tajo.catalog.proto.CatalogProtos.IndexMethod;
 import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes.Type;
 import tajo.engine.eval.EvalNode;
 import tajo.engine.function.builtin.SumInt;
 import tajo.engine.json.GsonCreator;
@@ -64,19 +64,19 @@ public class TestLogicalPlanner {
     }
     
     Schema schema = new Schema();
-    schema.addColumn("name", DataType.STRING);
-    schema.addColumn("empId", DataType.INT);
-    schema.addColumn("deptName", DataType.STRING);
+    schema.addColumn("name", Type.TEXT);
+    schema.addColumn("empId", Type.INT4);
+    schema.addColumn("deptName", Type.TEXT);
 
     Schema schema2 = new Schema();
-    schema2.addColumn("deptName", DataType.STRING);
-    schema2.addColumn("manager", DataType.STRING);
+    schema2.addColumn("deptName", Type.TEXT);
+    schema2.addColumn("manager", Type.TEXT);
 
     Schema schema3 = new Schema();
-    schema3.addColumn("deptName", DataType.STRING);
-    schema3.addColumn("score", DataType.INT);
+    schema3.addColumn("deptName", Type.TEXT);
+    schema3.addColumn("score", Type.INT4);
 
-    TableMeta meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    TableMeta meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
     TableDesc people = new TableDescImpl("employee", meta,
         new Path("file:///"));
     catalog.addTable(people);
@@ -92,8 +92,8 @@ public class TestLogicalPlanner {
     catalog.addTable(score);
 
     FunctionDesc funcDesc = new FunctionDesc("sumtest", SumInt.class, FunctionType.AGGREGATION,
-        new DataType [] {DataType.INT},
-        new DataType [] {DataType.INT});
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4));
 
 
     // TPC-H Schema for Complex Queries
@@ -104,8 +104,8 @@ public class TestLogicalPlanner {
     tpch.loadSchemas();
     tpch.loadOutSchema();
     for (String table : tpchTables) {
-      TableMeta m = TCatUtil.newTableMeta(tpch.getSchema(table), StoreType.CSV);
-      TableDesc d = TCatUtil.newTableDesc(table, m, new Path("file:///"));
+      TableMeta m = CatalogUtil.newTableMeta(tpch.getSchema(table), StoreType.CSV);
+      TableDesc d = CatalogUtil.newTableDesc(table, m, new Path("file:///"));
       catalog.addTable(d);
     }
 
@@ -177,10 +177,10 @@ public class TestLogicalPlanner {
     TestLogicalNode.testCloneLogicalNode(root);
 
     Schema expectedSchema = new Schema();
-    expectedSchema.addColumn("name", DataType.STRING);
-    expectedSchema.addColumn("empId", DataType.INT);
-    expectedSchema.addColumn("deptName", DataType.STRING);
-    expectedSchema.addColumn("manager", DataType.STRING);
+    expectedSchema.addColumn("name", Type.TEXT);
+    expectedSchema.addColumn("empId", Type.INT4);
+    expectedSchema.addColumn("deptName", Type.TEXT);
+    expectedSchema.addColumn("manager", Type.TEXT);
     assertSchema(expectedSchema, root.getOutSchema());
 
     assertEquals(ExprType.PROJECTION, root.getSubNode().getType());
@@ -204,7 +204,7 @@ public class TestLogicalPlanner {
     plan = planner.createPlan(context);
     TestLogicalNode.testCloneLogicalNode(plan);
 
-    expectedSchema.addColumn("score", DataType.INT);
+    expectedSchema.addColumn("score", Type.INT4);
     assertSchema(expectedSchema, plan.getOutSchema());
 
     assertEquals(ExprType.ROOT, plan.getType());
@@ -246,9 +246,9 @@ public class TestLogicalPlanner {
   static Schema expectedJoinSchema;
   static {
     expectedJoinSchema = new Schema();
-    expectedJoinSchema.addColumn("name", DataType.STRING);
-    expectedJoinSchema.addColumn("deptName", DataType.STRING);
-    expectedJoinSchema.addColumn("score", DataType.INT);
+    expectedJoinSchema.addColumn("name", Type.TEXT);
+    expectedJoinSchema.addColumn("deptName", Type.TEXT);
+    expectedJoinSchema.addColumn("score", Type.INT4);
   }
   
   @Test
@@ -586,10 +586,10 @@ public class TestLogicalPlanner {
     assertEquals(false, indexNode.isUnique());
     assertEquals(2, indexNode.getSortSpecs().length);
     assertEquals("name", indexNode.getSortSpecs()[0].getSortKey().getColumnName());
-    assertEquals(DataType.STRING, indexNode.getSortSpecs()[0].getSortKey().getDataType());
+    assertEquals(Type.TEXT, indexNode.getSortSpecs()[0].getSortKey().getDataType().getType());
     assertEquals(true, indexNode.getSortSpecs()[0].isNullFirst());
     assertEquals("empid", indexNode.getSortSpecs()[1].getSortKey().getColumnName());
-    assertEquals(DataType.INT, indexNode.getSortSpecs()[1].getSortKey().getDataType());
+    assertEquals(Type.INT4, indexNode.getSortSpecs()[1].getSortKey().getDataType().getType());
     assertEquals(false, indexNode.getSortSpecs()[1].isAscending());
     assertEquals(false, indexNode.getSortSpecs()[1].isNullFirst());
     assertEquals(IndexMethod.BITMAP, indexNode.getMethod());
@@ -628,7 +628,7 @@ public class TestLogicalPlanner {
   }
   
   static final String CREATE_TABLE [] = {
-    "create external table table1 (name string, age int, earn long, score float) using csv with ('csv.delimiter'='|') location '/tmp/data'"
+    "create external table table1 (name text, age int, earn bigint, score real) using csv with ('csv.delimiter'='|') location '/tmp/data'"
   };
   
   @Test
@@ -642,13 +642,13 @@ public class TestLogicalPlanner {
     
     Schema def = createTable.getSchema();
     assertEquals("name", def.getColumn(0).getColumnName());
-    assertEquals(DataType.STRING, def.getColumn(0).getDataType());
+    assertEquals(Type.TEXT, def.getColumn(0).getDataType().getType());
     assertEquals("age", def.getColumn(1).getColumnName());
-    assertEquals(DataType.INT, def.getColumn(1).getDataType());
+    assertEquals(Type.INT4, def.getColumn(1).getDataType().getType());
     assertEquals("earn", def.getColumn(2).getColumnName());
-    assertEquals(DataType.LONG, def.getColumn(2).getDataType());
+    assertEquals(Type.INT8, def.getColumn(2).getDataType().getType());
     assertEquals("score", def.getColumn(3).getColumnName());
-    assertEquals(DataType.FLOAT, def.getColumn(3).getDataType());    
+    assertEquals(Type.FLOAT4, def.getColumn(3).getDataType().getType());
     assertEquals(StoreType.CSV, createTable.getStorageType());
     assertEquals("/tmp/data", createTable.getPath().toString());
     assertTrue(createTable.hasOptions());
@@ -664,9 +664,9 @@ public class TestLogicalPlanner {
     = Lists.newArrayList();
   private static final Column [] testCubeByCuboids = new Column[2];
   static {
-    testGenerateCuboids[0] = new Column("col1", DataType.INT);
-    testGenerateCuboids[1] = new Column("col2", DataType.LONG);
-    testGenerateCuboids[2] = new Column("col3", DataType.FLOAT);
+    testGenerateCuboids[0] = new Column("col1", Type.INT4);
+    testGenerateCuboids[1] = new Column("col2", Type.INT8);
+    testGenerateCuboids[2] = new Column("col3", Type.FLOAT4);
     
     testGenerateCuboidsResult.add(new HashSet<Column>());
     testGenerateCuboidsResult.add(Sets.newHashSet(testGenerateCuboids[0]));
@@ -681,8 +681,8 @@ public class TestLogicalPlanner {
     testGenerateCuboidsResult.add(Sets.newHashSet(testGenerateCuboids[0], 
         testGenerateCuboids[1], testGenerateCuboids[2]));
     
-    testCubeByCuboids[0] = new Column("employee.name", DataType.STRING);
-    testCubeByCuboids[1] = new Column("employee.empid", DataType.INT);
+    testCubeByCuboids[0] = new Column("employee.name", Type.TEXT);
+    testCubeByCuboids[1] = new Column("employee.empid", Type.INT4);
     testCubeByResult.add(new HashSet<Column>());
     testCubeByResult.add(Sets.newHashSet(testCubeByCuboids[0]));
     testCubeByResult.add(Sets.newHashSet(testCubeByCuboids[1]));
@@ -694,11 +694,11 @@ public class TestLogicalPlanner {
   public final void testGenerateCuboids() {
     Column [] columns = new Column[3];
     
-    columns[0] = new Column("col1", DataType.INT);
-    columns[1] = new Column("col2", DataType.LONG);
-    columns[2] = new Column("col3", DataType.FLOAT);
+    columns[0] = new Column("col1", Type.INT4);
+    columns[1] = new Column("col2", Type.INT8);
+    columns[2] = new Column("col3", Type.FLOAT4);
     
-    List<Column[]> cube = planner.generateCuboids(columns);
+    List<Column[]> cube = LogicalPlanner.generateCuboids(columns);
     assertEquals(((int)Math.pow(2, numCubeColumns)), cube.size());    
     
     Set<Set<Column>> cuboids = Sets.newHashSet();

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestPlannerUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestPlannerUtil.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestPlannerUtil.java
index 1b311ab..9b8efc0 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestPlannerUtil.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestPlannerUtil.java
@@ -24,9 +24,9 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import tajo.TajoTestingCluster;
 import tajo.catalog.*;
-import tajo.catalog.proto.CatalogProtos.DataType;
 import tajo.catalog.proto.CatalogProtos.FunctionType;
 import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes.Type;
 import tajo.datum.DatumFactory;
 import tajo.engine.eval.BinaryEval;
 import tajo.engine.eval.ConstEval;
@@ -56,19 +56,19 @@ public class TestPlannerUtil {
     catalog = util.getMiniCatalogCluster().getCatalog();
 
     Schema schema = new Schema();
-    schema.addColumn("name", DataType.STRING);
-    schema.addColumn("empId", DataType.INT);
-    schema.addColumn("deptName", DataType.STRING);
+    schema.addColumn("name", Type.TEXT);
+    schema.addColumn("empId", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    schema.addColumn("deptName", Type.TEXT);
 
     Schema schema2 = new Schema();
-    schema2.addColumn("deptName", DataType.STRING);
-    schema2.addColumn("manager", DataType.STRING);
+    schema2.addColumn("deptName", Type.TEXT);
+    schema2.addColumn("manager", Type.TEXT);
 
     Schema schema3 = new Schema();
-    schema3.addColumn("deptName", DataType.STRING);
-    schema3.addColumn("score", DataType.INT);
+    schema3.addColumn("deptName", Type.TEXT);
+    schema3.addColumn("score", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
 
-    TableMeta meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    TableMeta meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
     TableDesc people = new TableDescImpl("employee", meta,
         new Path("file:///"));
     catalog.addTable(people);
@@ -84,8 +84,8 @@ public class TestPlannerUtil {
     catalog.addTable(score);
 
     FunctionDesc funcDesc = new FunctionDesc("sumtest", SumInt.class, FunctionType.AGGREGATION,
-        new DataType [] {DataType.INT},
-        new DataType [] {DataType.INT});
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4));
 
     catalog.registerFunction(funcDesc);
     analyzer = new QueryAnalyzer(catalog);
@@ -180,8 +180,9 @@ public class TestPlannerUtil {
 
   @Test
   public final void testIsJoinQual() {
-    FieldEval f1 = new FieldEval("part.p_partkey", DataType.INT);
-    FieldEval f2 = new FieldEval("partsupp.ps_partkey", DataType.INT);
+    FieldEval f1 = new FieldEval("part.p_partkey", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    FieldEval f2 = new FieldEval("partsupp.ps_partkey",
+        CatalogUtil.newDataTypeWithoutLen(Type.INT4));
 
 
     BinaryEval [] joinQuals = new BinaryEval[5];
@@ -201,7 +202,7 @@ public class TestPlannerUtil {
     wrongJoinQuals[idx++] = new BinaryEval(EvalNode.Type.PLUS, f1, f2);
     wrongJoinQuals[idx++] = new BinaryEval(EvalNode.Type.LIKE, f1, f2);
 
-    ConstEval f3 = new ConstEval(DatumFactory.createInt(1));
+    ConstEval f3 = new ConstEval(DatumFactory.createInt4(1));
     wrongJoinQuals[idx] = new BinaryEval(EvalNode.Type.EQUAL, f1, f3);
 
     for (int i = 0; i < idx; i++) {
@@ -212,16 +213,16 @@ public class TestPlannerUtil {
   @Test
   public final void testGetJoinKeyPairs() {
     Schema outerSchema = new Schema();
-    outerSchema.addColumn("employee.id1", DataType.INT);
-    outerSchema.addColumn("employee.id2", DataType.INT);
+    outerSchema.addColumn("employee.id1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    outerSchema.addColumn("employee.id2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
     Schema innerSchema = new Schema();
-    innerSchema.addColumn("people.fid1", DataType.INT);
-    innerSchema.addColumn("people.fid2", DataType.INT);
+    innerSchema.addColumn("people.fid1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    innerSchema.addColumn("people.fid2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
 
-    FieldEval f1 = new FieldEval("employee.id1", DataType.INT);
-    FieldEval f2 = new FieldEval("people.fid1", DataType.INT);
-    FieldEval f3 = new FieldEval("employee.id2", DataType.INT);
-    FieldEval f4 = new FieldEval("people.fid2", DataType.INT);
+    FieldEval f1 = new FieldEval("employee.id1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    FieldEval f2 = new FieldEval("people.fid1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    FieldEval f3 = new FieldEval("employee.id2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    FieldEval f4 = new FieldEval("people.fid2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
 
     EvalNode joinQual = new BinaryEval(EvalNode.Type.EQUAL, f1, f2);
 
@@ -258,16 +259,16 @@ public class TestPlannerUtil {
   @Test
   public final void testGetSortKeysFromJoinQual() {
     Schema outerSchema = new Schema();
-    outerSchema.addColumn("employee.id1", DataType.INT);
-    outerSchema.addColumn("employee.id2", DataType.INT);
+    outerSchema.addColumn("employee.id1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    outerSchema.addColumn("employee.id2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
     Schema innerSchema = new Schema();
-    innerSchema.addColumn("people.fid1", DataType.INT);
-    innerSchema.addColumn("people.fid2", DataType.INT);
+    innerSchema.addColumn("people.fid1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    innerSchema.addColumn("people.fid2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
 
-    FieldEval f1 = new FieldEval("employee.id1", DataType.INT);
-    FieldEval f2 = new FieldEval("people.fid1", DataType.INT);
-    FieldEval f3 = new FieldEval("employee.id2", DataType.INT);
-    FieldEval f4 = new FieldEval("people.fid2", DataType.INT);
+    FieldEval f1 = new FieldEval("employee.id1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    FieldEval f2 = new FieldEval("people.fid1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    FieldEval f3 = new FieldEval("employee.id2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    FieldEval f4 = new FieldEval("people.fid2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
 
     EvalNode joinQual = new BinaryEval(EvalNode.Type.EQUAL, f1, f2);
     SortSpec[][] sortSpecs = PlannerUtil.getSortKeysFromJoinQual(joinQual, outerSchema, innerSchema);
@@ -294,27 +295,27 @@ public class TestPlannerUtil {
   @Test
   public final void testComparatorsFromJoinQual() {
     Schema outerSchema = new Schema();
-    outerSchema.addColumn("employee.id1", DataType.INT);
-    outerSchema.addColumn("employee.id2", DataType.INT);
+    outerSchema.addColumn("employee.id1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    outerSchema.addColumn("employee.id2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
     Schema innerSchema = new Schema();
-    innerSchema.addColumn("people.fid1", DataType.INT);
-    innerSchema.addColumn("people.fid2", DataType.INT);
+    innerSchema.addColumn("people.fid1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    innerSchema.addColumn("people.fid2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
 
-    FieldEval f1 = new FieldEval("employee.id1", DataType.INT);
-    FieldEval f2 = new FieldEval("people.fid1", DataType.INT);
-    FieldEval f3 = new FieldEval("employee.id2", DataType.INT);
-    FieldEval f4 = new FieldEval("people.fid2", DataType.INT);
+    FieldEval f1 = new FieldEval("employee.id1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    FieldEval f2 = new FieldEval("people.fid1", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    FieldEval f3 = new FieldEval("employee.id2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
+    FieldEval f4 = new FieldEval("people.fid2", CatalogUtil.newDataTypeWithoutLen(Type.INT4));
 
     EvalNode joinQual = new BinaryEval(EvalNode.Type.EQUAL, f1, f2);
     TupleComparator [] comparators = PlannerUtil.getComparatorsFromJoinQual(joinQual, outerSchema, innerSchema);
 
     Tuple t1 = new VTuple(2);
-    t1.put(0, DatumFactory.createInt(1));
-    t1.put(1, DatumFactory.createInt(2));
+    t1.put(0, DatumFactory.createInt4(1));
+    t1.put(1, DatumFactory.createInt4(2));
 
     Tuple t2 = new VTuple(2);
-    t2.put(0, DatumFactory.createInt(2));
-    t2.put(1, DatumFactory.createInt(3));
+    t2.put(0, DatumFactory.createInt4(2));
+    t2.put(1, DatumFactory.createInt4(3));
 
     TupleComparator outerComparator = comparators[0];
     assertTrue(outerComparator.compare(t1, t2) < 0);

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestUniformRangePartition.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestUniformRangePartition.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestUniformRangePartition.java
index e436c7b..521bc55 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestUniformRangePartition.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/TestUniformRangePartition.java
@@ -20,7 +20,7 @@ package tajo.engine.planner;
 
 import org.junit.Test;
 import tajo.catalog.Schema;
-import tajo.catalog.proto.CatalogProtos.DataType;
+import tajo.common.TajoDataTypes.Type;
 import tajo.datum.DatumFactory;
 import tajo.engine.utils.TupleUtil;
 import tajo.storage.Tuple;
@@ -37,14 +37,14 @@ public class TestUniformRangePartition {
   @Test
   public void testIncrement1() {
     Schema schema = new Schema()
-    .addColumn("l_returnflag", DataType.STRING)
-    .addColumn("l_linestatus", DataType.STRING);
+    .addColumn("l_returnflag", Type.TEXT)
+    .addColumn("l_linestatus", Type.TEXT);
     Tuple s = new VTuple(2);
-    s.put(0, DatumFactory.createString("A"));
-    s.put(1, DatumFactory.createString("A"));
+    s.put(0, DatumFactory.createText("A"));
+    s.put(1, DatumFactory.createText("A"));
     Tuple e = new VTuple(2);
-    e.put(0, DatumFactory.createString("D"));
-    e.put(1, DatumFactory.createString("C"));
+    e.put(0, DatumFactory.createText("D"));
+    e.put(1, DatumFactory.createText("C"));
 
     TupleRange expected = new TupleRange(schema, s, e);
 
@@ -82,14 +82,14 @@ public class TestUniformRangePartition {
   @Test
   public void testIncrement2() {
     Schema schema = new Schema()
-    .addColumn("l_returnflag", DataType.STRING)
-    .addColumn("l_linestatus", DataType.STRING);
+    .addColumn("l_returnflag", Type.TEXT)
+    .addColumn("l_linestatus", Type.TEXT);
     Tuple s = new VTuple(2);
-    s.put(0, DatumFactory.createString("A"));
-    s.put(1, DatumFactory.createString("A"));
+    s.put(0, DatumFactory.createText("A"));
+    s.put(1, DatumFactory.createText("A"));
     Tuple e = new VTuple(2);
-    e.put(0, DatumFactory.createString("D"));
-    e.put(1, DatumFactory.createString("C"));
+    e.put(0, DatumFactory.createText("D"));
+    e.put(1, DatumFactory.createText("C"));
 
     TupleRange expected = new TupleRange(schema, s, e);
 
@@ -125,18 +125,18 @@ public class TestUniformRangePartition {
   @Test
   public void testIncrement3() {
     Schema schema = new Schema()
-    .addColumn("l_returnflag", DataType.STRING)
-    .addColumn("l_linestatus", DataType.STRING)
-    .addColumn("final", DataType.STRING);
+    .addColumn("l_returnflag", Type.TEXT)
+    .addColumn("l_linestatus", Type.TEXT)
+    .addColumn("final", Type.TEXT);
 
     Tuple s = new VTuple(3);
-    s.put(0, DatumFactory.createString("A"));
-    s.put(1, DatumFactory.createString("A"));
-    s.put(2, DatumFactory.createString("A"));
+    s.put(0, DatumFactory.createText("A"));
+    s.put(1, DatumFactory.createText("A"));
+    s.put(2, DatumFactory.createText("A"));
     Tuple e = new VTuple(3);
-    e.put(0, DatumFactory.createString("D")); //  4
-    e.put(1, DatumFactory.createString("B")); //  2
-    e.put(2, DatumFactory.createString("C")); // x3 = 24
+    e.put(0, DatumFactory.createText("D")); //  4
+    e.put(1, DatumFactory.createText("B")); //  2
+    e.put(2, DatumFactory.createText("C")); // x3 = 24
 
     TupleRange expected = new TupleRange(schema, s, e);
 
@@ -157,14 +157,14 @@ public class TestUniformRangePartition {
   @Test
   public void testIncrement4() {
     Schema schema = new Schema()
-    .addColumn("l_orderkey", DataType.LONG)
-    .addColumn("l_linenumber", DataType.LONG);
+    .addColumn("l_orderkey", Type.INT8)
+    .addColumn("l_linenumber", Type.INT8);
     Tuple s = new VTuple(2);
-    s.put(0, DatumFactory.createLong(10));
-    s.put(1, DatumFactory.createLong(20));
+    s.put(0, DatumFactory.createInt8(10));
+    s.put(1, DatumFactory.createInt8(20));
     Tuple e = new VTuple(2);
-    e.put(0, DatumFactory.createLong(19));
-    e.put(1, DatumFactory.createLong(39));
+    e.put(0, DatumFactory.createInt8(19));
+    e.put(1, DatumFactory.createInt8(39));
 
     TupleRange expected = new TupleRange(schema, s, e);
 
@@ -173,26 +173,26 @@ public class TestUniformRangePartition {
     assertEquals(200, partitioner.getTotalCardinality().longValue());
 
     Tuple range2 = partitioner.increment(s, 100, 1);
-    assertEquals(15, range2.get(0).asInt());
-    assertEquals(20, range2.get(1).asInt());
+    assertEquals(15, range2.get(0).asInt4());
+    assertEquals(20, range2.get(1).asInt4());
     Tuple range3 = partitioner.increment(range2, 99, 1);
-    assertEquals(19, range3.get(0).asInt());
-    assertEquals(39, range3.get(1).asInt());
+    assertEquals(19, range3.get(0).asInt4());
+    assertEquals(39, range3.get(1).asInt4());
   }
 
   @Test public void testIncrement5() {
     Schema schema = new Schema()
-    .addColumn("l_orderkey", DataType.LONG)
-    .addColumn("l_linenumber", DataType.LONG)
-    .addColumn("final", DataType.LONG);
+    .addColumn("l_orderkey", Type.INT8)
+    .addColumn("l_linenumber", Type.INT8)
+    .addColumn("final", Type.INT8);
     Tuple s = new VTuple(3);
-    s.put(0, DatumFactory.createLong(1));
-    s.put(1, DatumFactory.createLong(1));
-    s.put(2, DatumFactory.createLong(1));
+    s.put(0, DatumFactory.createInt8(1));
+    s.put(1, DatumFactory.createInt8(1));
+    s.put(2, DatumFactory.createInt8(1));
     Tuple e = new VTuple(3);
-    e.put(0, DatumFactory.createLong(4)); // 4
-    e.put(1, DatumFactory.createLong(2)); // 2
-    e.put(2, DatumFactory.createLong(3)); //x3 = 24
+    e.put(0, DatumFactory.createInt8(4)); // 4
+    e.put(1, DatumFactory.createInt8(2)); // 2
+    e.put(2, DatumFactory.createInt8(3)); //x3 = 24
 
     TupleRange expected = new TupleRange(schema, s, e);
 
@@ -201,29 +201,29 @@ public class TestUniformRangePartition {
     assertEquals(24, partitioner.getTotalCardinality().longValue());
 
     Tuple beforeOverflow = partitioner.increment(s, 5, 2);
-    assertEquals(1, beforeOverflow.get(0).asLong());
-    assertEquals(2, beforeOverflow.get(1).asLong());
-    assertEquals(3, beforeOverflow.get(2).asLong());
+    assertEquals(1, beforeOverflow.get(0).asInt8());
+    assertEquals(2, beforeOverflow.get(1).asInt8());
+    assertEquals(3, beforeOverflow.get(2).asInt8());
     Tuple overflow = partitioner.increment(beforeOverflow, 1, 2);
-    assertEquals(2, overflow.get(0).asLong());
-    assertEquals(1, overflow.get(1).asLong());
-    assertEquals(1, overflow.get(2).asLong());
+    assertEquals(2, overflow.get(0).asInt8());
+    assertEquals(1, overflow.get(1).asInt8());
+    assertEquals(1, overflow.get(2).asInt8());
   }
 
   @Test
   public void testIncrement6() {
     Schema schema = new Schema()
-      .addColumn("l_orderkey", DataType.DOUBLE)
-      .addColumn("l_linenumber", DataType.DOUBLE)
-      .addColumn("final", DataType.DOUBLE);
+      .addColumn("l_orderkey", Type.FLOAT8)
+      .addColumn("l_linenumber", Type.FLOAT8)
+      .addColumn("final", Type.FLOAT8);
     Tuple s = new VTuple(3);
-    s.put(0, DatumFactory.createDouble(1.1d));
-    s.put(1, DatumFactory.createDouble(1.1d));
-    s.put(2, DatumFactory.createDouble(1.1d));
+    s.put(0, DatumFactory.createFloat8(1.1d));
+    s.put(1, DatumFactory.createFloat8(1.1d));
+    s.put(2, DatumFactory.createFloat8(1.1d));
     Tuple e = new VTuple(3);
-    e.put(0, DatumFactory.createDouble(4.1d)); // 4
-    e.put(1, DatumFactory.createDouble(2.1d)); // 2
-    e.put(2, DatumFactory.createDouble(3.1d)); //x3 = 24
+    e.put(0, DatumFactory.createFloat8(4.1d)); // 4
+    e.put(1, DatumFactory.createFloat8(2.1d)); // 2
+    e.put(2, DatumFactory.createFloat8(3.1d)); //x3 = 24
 
     TupleRange expected = new TupleRange(schema, s, e);
 
@@ -232,26 +232,26 @@ public class TestUniformRangePartition {
     assertEquals(24, partitioner.getTotalCardinality().longValue());
 
     Tuple beforeOverflow = partitioner.increment(s, 5, 2);
-    assertTrue(1.1d == beforeOverflow.get(0).asDouble());
-    assertTrue(2.1d == beforeOverflow.get(1).asDouble());
-    assertTrue(3.1d == beforeOverflow.get(2).asDouble());
+    assertTrue(1.1d == beforeOverflow.get(0).asFloat8());
+    assertTrue(2.1d == beforeOverflow.get(1).asFloat8());
+    assertTrue(3.1d == beforeOverflow.get(2).asFloat8());
     Tuple overflow = partitioner.increment(beforeOverflow, 1, 2);
-    assertTrue(2.1d == overflow.get(0).asDouble());
-    assertTrue(1.1d == overflow.get(1).asDouble());
-    assertTrue(1.1d == overflow.get(2).asDouble());
+    assertTrue(2.1d == overflow.get(0).asFloat8());
+    assertTrue(1.1d == overflow.get(1).asFloat8());
+    assertTrue(1.1d == overflow.get(2).asFloat8());
   }
 
   @Test
   public void testPartition() {
     Schema schema = new Schema();
-    schema.addColumn("l_returnflag", DataType.STRING);
-    schema.addColumn("l_linestatus", DataType.STRING);
+    schema.addColumn("l_returnflag", Type.TEXT);
+    schema.addColumn("l_linestatus", Type.TEXT);
     Tuple s = new VTuple(2);
-    s.put(0, DatumFactory.createString("A"));
-    s.put(1, DatumFactory.createString("F"));
+    s.put(0, DatumFactory.createText("A"));
+    s.put(1, DatumFactory.createText("F"));
     Tuple e = new VTuple(2);
-    e.put(0, DatumFactory.createString("R"));
-    e.put(1, DatumFactory.createString("O"));
+    e.put(0, DatumFactory.createText("R"));
+    e.put(1, DatumFactory.createText("O"));
     TupleRange expected = new TupleRange(schema, s, e);
     RangePartitionAlgorithm partitioner
         = new UniformRangePartition(schema, expected, true);
@@ -271,14 +271,14 @@ public class TestUniformRangePartition {
   @Test
   public void testPartitionForOnePartNum() {
     Schema schema = new Schema()
-      .addColumn("l_returnflag", DataType.STRING)
-      .addColumn("l_linestatus", DataType.STRING);
+      .addColumn("l_returnflag", Type.TEXT)
+      .addColumn("l_linestatus", Type.TEXT);
     Tuple s = new VTuple(2);
-    s.put(0, DatumFactory.createString("A"));
-    s.put(1, DatumFactory.createString("F"));
+    s.put(0, DatumFactory.createText("A"));
+    s.put(1, DatumFactory.createText("F"));
     Tuple e = new VTuple(2);
-    e.put(0, DatumFactory.createString("R"));
-    e.put(1, DatumFactory.createString("O"));
+    e.put(0, DatumFactory.createText("R"));
+    e.put(1, DatumFactory.createText("O"));
     TupleRange expected = new TupleRange(schema, s, e);
     RangePartitionAlgorithm partitioner =
         new UniformRangePartition(schema, expected, true);

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/global/TestGlobalQueryOptimizer.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/global/TestGlobalQueryOptimizer.java b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/global/TestGlobalQueryOptimizer.java
index c0d0dd2..465038c 100644
--- a/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/global/TestGlobalQueryOptimizer.java
+++ b/tajo-core/tajo-core-backend/src/test/java/tajo/engine/planner/global/TestGlobalQueryOptimizer.java
@@ -31,9 +31,9 @@ import tajo.QueryId;
 import tajo.QueryIdFactory;
 import tajo.TajoTestingCluster;
 import tajo.catalog.*;
-import tajo.catalog.proto.CatalogProtos.DataType;
 import tajo.catalog.proto.CatalogProtos.FunctionType;
 import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes.Type;
 import tajo.conf.TajoConf;
 import tajo.datum.Datum;
 import tajo.datum.DatumFactory;
@@ -70,10 +70,10 @@ public class TestGlobalQueryOptimizer {
     int i, j;
 
     schema = new Schema();
-    schema.addColumn("id", DataType.INT);
-    schema.addColumn("age", DataType.INT);
-    schema.addColumn("name", DataType.STRING);
-    schema.addColumn("salary", DataType.INT);
+    schema.addColumn("id", Type.INT4);
+    schema.addColumn("age", Type.INT4);
+    schema.addColumn("name", Type.TEXT);
+    schema.addColumn("salary", Type.INT4);
 
     TableMeta meta;
 
@@ -81,8 +81,8 @@ public class TestGlobalQueryOptimizer {
     catalog = util.getMiniCatalogCluster().getCatalog();
     StorageManager sm = new StorageManager(util.getConfiguration());
     FunctionDesc funcDesc = new FunctionDesc("sumtest", TestSum.class, FunctionType.GENERAL,
-        new DataType [] {DataType.INT},
-        new DataType [] {DataType.INT});
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4),
+        CatalogUtil.newDataTypesWithoutLen(Type.INT4));
     catalog.registerFunction(funcDesc);
     FileSystem fs = sm.getFileSystem();
 
@@ -98,11 +98,11 @@ public class TestGlobalQueryOptimizer {
     Appender appender;
     Tuple t = new VTuple(4);
     t.put(new Datum[] {
-        DatumFactory.createInt(1), DatumFactory.createInt(32),
-        DatumFactory.createString("h"), DatumFactory.createInt(10)});
+        DatumFactory.createInt4(1), DatumFactory.createInt4(32),
+        DatumFactory.createText("h"), DatumFactory.createInt4(10)});
 
     for (i = 0; i < tbNum; i++) {
-      meta = TCatUtil.newTableMeta((Schema)schema.clone(), StoreType.CSV);
+      meta = CatalogUtil.newTableMeta((Schema) schema.clone(), StoreType.CSV);
       meta.putOption(CSVFile.DELIMITER, ",");
 
       Path dataRoot = sm.getBaseDir();
@@ -119,7 +119,8 @@ public class TestGlobalQueryOptimizer {
       }
       appender.close();
 
-      TableDesc desc = TCatUtil.newTableDesc("table" + i, (TableMeta)meta.clone(), sm.getTablePath("table"+i));
+      TableDesc desc = CatalogUtil
+          .newTableDesc("table" + i, (TableMeta) meta.clone(), sm.getTablePath("table" + i));
       catalog.addTable(desc);
     }