Updated Branches:
  refs/heads/master fc4743686 -> c1c6f83ea

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/test/java/tajo/storage/index/TestBSTIndex.java
----------------------------------------------------------------------
diff --git 
a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/index/TestBSTIndex.java
 
b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/index/TestBSTIndex.java
index 85c7beb..8d06d9b 100644
--- 
a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/index/TestBSTIndex.java
+++ 
b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/index/TestBSTIndex.java
@@ -24,8 +24,8 @@ import org.apache.hadoop.fs.Path;
 import org.junit.Before;
 import org.junit.Test;
 import tajo.catalog.*;
-import tajo.catalog.proto.CatalogProtos.DataType;
 import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes.Type;
 import tajo.conf.TajoConf;
 import tajo.datum.DatumFactory;
 import tajo.storage.*;
@@ -54,11 +54,11 @@ public class TestBSTIndex {
     conf = new TajoConf();
     conf.setVar(TajoConf.ConfVars.ROOT_DIR, TEST_PATH);
     schema = new Schema();
-    schema.addColumn(new Column("int", DataType.INT));
-    schema.addColumn(new Column("long", DataType.LONG));
-    schema.addColumn(new Column("double", DataType.DOUBLE));
-    schema.addColumn(new Column("float", DataType.FLOAT));
-    schema.addColumn(new Column("string", DataType.STRING));
+    schema.addColumn(new Column("int", Type.INT4));
+    schema.addColumn(new Column("long", Type.INT8));
+    schema.addColumn(new Column("double", Type.FLOAT8));
+    schema.addColumn(new Column("float", Type.FLOAT4));
+    schema.addColumn(new Column("string", Type.TEXT));
   }
 
    
@@ -70,7 +70,7 @@ public class TestBSTIndex {
   
   @Test
   public void testFindValueInCSV() throws IOException {
-    meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
     
     Path tablePath = new Path(testDir, "FindValueInCSV.csv");
     Appender appender  = StorageManager.getAppender(conf, meta, tablePath);
@@ -78,11 +78,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i ++ ) {
         tuple = new VTuple(5);
-        tuple.put(0, DatumFactory.createInt(i));
-        tuple.put(1, DatumFactory.createLong(i));
-        tuple.put(2, DatumFactory.createDouble(i));
-        tuple.put(3, DatumFactory.createFloat(i));
-        tuple.put(4, DatumFactory.createString("field_"+i));
+        tuple.put(0, DatumFactory.createInt4(i));
+        tuple.put(1, DatumFactory.createInt8(i));
+        tuple.put(2, DatumFactory.createFloat8(i));
+        tuple.put(3, DatumFactory.createFloat4(i));
+        tuple.put(4, DatumFactory.createText("field_" + i));
         appender.addTuple(tuple);
       }
     appender.close();
@@ -96,8 +96,8 @@ public class TestBSTIndex {
     sortKeys[1] = new SortSpec(schema.getColumn("double"), true, false);
 
     Schema keySchema = new Schema();
-    keySchema.addColumn(new Column("long", DataType.LONG));
-    keySchema.addColumn(new Column("double", DataType.DOUBLE));
+    keySchema.addColumn(new Column("long", Type.INT8));
+    keySchema.addColumn(new Column("double", Type.FLOAT8));
 
     TupleComparator comp = new TupleComparator(keySchema, sortKeys);
     
@@ -131,13 +131,13 @@ public class TestBSTIndex {
     reader.open();
     scanner  = (SeekableScanner)(StorageManager.getScanner(conf, meta, 
tablet));
     for(int i = 0 ; i < TUPLE_NUM -1 ; i ++) {
-      tuple.put(0, DatumFactory.createLong(i));
-      tuple.put(1, DatumFactory.createDouble(i));
+      tuple.put(0, DatumFactory.createInt8(i));
+      tuple.put(1, DatumFactory.createFloat8(i));
       long offsets = reader.find(tuple);
       scanner.seek(offsets);
       tuple = scanner.next();
-      assertTrue("seek check [" + (i) + " ," +(tuple.get(1).asLong())+ "]" , 
(i) == (tuple.get(1).asLong()));
-      assertTrue("seek check [" + (i) + " ,"  +(tuple.get(2).asDouble())+"]" , 
(i) == (tuple.get(2).asDouble()));
+      assertTrue("seek check [" + (i) + " ," +(tuple.get(1).asInt8())+ "]" , 
(i) == (tuple.get(1).asInt8()));
+      assertTrue("seek check [" + (i) + " ,"  +(tuple.get(2).asFloat8())+"]" , 
(i) == (tuple.get(2).asFloat8()));
       
       offsets = reader.next();
       if (offsets == -1) {
@@ -145,14 +145,14 @@ public class TestBSTIndex {
       }
       scanner.seek(offsets);
       tuple = scanner.next();
-      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(tuple.get(0).asInt()));
-      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(tuple.get(1).asLong()));
+      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(tuple.get(0).asInt4()));
+      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(tuple.get(1).asInt8()));
     }
   }
 
   @Test
   public void testBuildIndexWithAppender() throws IOException {
-    meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
 
     Path tablePath = new Path(testDir, "BuildIndexWithAppender.csv");
     FileAppender appender  = (FileAppender) StorageManager.getAppender(conf, 
meta, tablePath);
@@ -163,8 +163,8 @@ public class TestBSTIndex {
     sortKeys[1] = new SortSpec(schema.getColumn("double"), true, false);
 
     Schema keySchema = new Schema();
-    keySchema.addColumn(new Column("long", DataType.LONG));
-    keySchema.addColumn(new Column("double", DataType.DOUBLE));
+    keySchema.addColumn(new Column("long", Type.INT8));
+    keySchema.addColumn(new Column("double", Type.FLOAT8));
 
     TupleComparator comp = new TupleComparator(keySchema, sortKeys);
 
@@ -178,11 +178,11 @@ public class TestBSTIndex {
     long offset;
     for(int i = 0 ; i < TUPLE_NUM; i ++ ) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_" + i));
 
       offset = appender.getOffset();
       appender.addTuple(tuple);
@@ -205,13 +205,13 @@ public class TestBSTIndex {
     reader.open();
     SeekableScanner scanner  = 
(SeekableScanner)(StorageManager.getScanner(conf, meta, tablet));
     for(int i = 0 ; i < TUPLE_NUM -1 ; i ++) {
-      tuple.put(0, DatumFactory.createLong(i));
-      tuple.put(1, DatumFactory.createDouble(i));
+      tuple.put(0, DatumFactory.createInt8(i));
+      tuple.put(1, DatumFactory.createFloat8(i));
       long offsets = reader.find(tuple);
       scanner.seek(offsets);
       tuple = scanner.next();
-      assertTrue("[seek check " + (i) + " ]", (i) == (tuple.get(1).asLong()));
-      assertTrue("[seek check " + (i) + " ]" , (i) == 
(tuple.get(2).asDouble()));
+      assertTrue("[seek check " + (i) + " ]", (i) == (tuple.get(1).asInt8()));
+      assertTrue("[seek check " + (i) + " ]" , (i) == 
(tuple.get(2).asFloat8()));
 
       offsets = reader.next();
       if (offsets == -1) {
@@ -219,14 +219,14 @@ public class TestBSTIndex {
       }
       scanner.seek(offsets);
       tuple = scanner.next();
-      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(tuple.get(0).asInt()));
-      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(tuple.get(1).asLong()));
+      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(tuple.get(0).asInt4()));
+      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(tuple.get(1).asInt8()));
     }
   }
   
   @Test
   public void testFindOmittedValueInCSV() throws IOException {
-    meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
     
     Path tablePath = StorageUtil.concatPath(testDir, 
"FindOmittedValueInCSV.csv");
     Appender appender = StorageManager.getAppender(conf, meta, tablePath);
@@ -234,11 +234,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i += 2 ) {
         tuple = new VTuple(5);
-        tuple.put(0, DatumFactory.createInt(i));
-        tuple.put(1, DatumFactory.createLong(i));
-        tuple.put(2, DatumFactory.createDouble(i));
-        tuple.put(3, DatumFactory.createFloat(i));
-        tuple.put(4, DatumFactory.createString("field_"+i));
+        tuple.put(0, DatumFactory.createInt4(i));
+        tuple.put(1, DatumFactory.createInt8(i));
+        tuple.put(2, DatumFactory.createFloat8(i));
+        tuple.put(3, DatumFactory.createFloat4(i));
+        tuple.put(4, DatumFactory.createText("field_" + i));
         appender.addTuple(tuple);
       }
     appender.close();
@@ -251,8 +251,8 @@ public class TestBSTIndex {
     sortKeys[1] = new SortSpec(schema.getColumn("double"), true, false);
 
     Schema keySchema = new Schema();
-    keySchema.addColumn(new Column("long", DataType.LONG));
-    keySchema.addColumn(new Column("double", DataType.DOUBLE));
+    keySchema.addColumn(new Column("long", Type.INT8));
+    keySchema.addColumn(new Column("double", Type.FLOAT8));
 
     TupleComparator comp = new TupleComparator(keySchema, sortKeys);
     
@@ -283,8 +283,8 @@ public class TestBSTIndex {
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, 
"FindOmittedValueInCSV.idx"), keySchema, comp);
     reader.open();
     for(int i = 1 ; i < TUPLE_NUM -1 ; i+=2) {
-      keyTuple.put(0, DatumFactory.createLong(i));
-      keyTuple.put(1, DatumFactory.createDouble(i));
+      keyTuple.put(0, DatumFactory.createInt8(i));
+      keyTuple.put(1, DatumFactory.createFloat8(i));
       long offsets = reader.find(keyTuple);
       assertEquals(-1, offsets);
     }
@@ -292,7 +292,7 @@ public class TestBSTIndex {
   
   @Test
   public void testFindNextKeyValueInCSV() throws IOException {
-    meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
 
     Path tablePath = new Path(testDir, "FindNextKeyValueInCSV.csv");
     Appender appender = StorageManager.getAppender(conf, meta, tablePath);
@@ -300,11 +300,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i ++ ) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_" + i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -318,8 +318,8 @@ public class TestBSTIndex {
     sortKeys[1] = new SortSpec(schema.getColumn("long"), true, false);
 
     Schema keySchema = new Schema();
-    keySchema.addColumn(new Column("int", DataType.INT));
-    keySchema.addColumn(new Column("long", DataType.LONG));
+    keySchema.addColumn(new Column("int", Type.INT4));
+    keySchema.addColumn(new Column("long", Type.INT8));
 
     TupleComparator comp = new TupleComparator(keySchema, sortKeys);
     
@@ -354,14 +354,14 @@ public class TestBSTIndex {
     Tuple result;
     for(int i = 0 ; i < TUPLE_NUM -1 ; i ++) {
       keyTuple = new VTuple(2);
-      keyTuple.put(0, DatumFactory.createInt(i));
-      keyTuple.put(1, DatumFactory.createLong(i));
+      keyTuple.put(0, DatumFactory.createInt4(i));
+      keyTuple.put(1, DatumFactory.createInt8(i));
       long offsets = reader.find(keyTuple, true);
       scanner.seek(offsets);
       result = scanner.next();
       assertTrue("[seek check " + (i + 1) + " ]",
-          (i + 1) == (result.get(0).asInt()));
-      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(result.get(1).asLong()));
+          (i + 1) == (result.get(0).asInt4()));
+      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(result.get(1).asInt8()));
       
       offsets = reader.next();
       if (offsets == -1) {
@@ -369,14 +369,14 @@ public class TestBSTIndex {
       }
       scanner.seek(offsets);
       result = scanner.next();
-      assertTrue("[seek check " + (i + 2) + " ]" , (i + 2) == 
(result.get(0).asLong()));
-      assertTrue("[seek check " + (i + 2) + " ]" , (i + 2) == 
(result.get(1).asDouble()));
+      assertTrue("[seek check " + (i + 2) + " ]" , (i + 2) == 
(result.get(0).asInt8()));
+      assertTrue("[seek check " + (i + 2) + " ]" , (i + 2) == 
(result.get(1).asFloat8()));
     }
   }
   
   @Test
   public void testFindNextKeyOmittedValueInCSV() throws IOException {
-    meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
 
     Path tablePath = new Path(testDir, "FindNextKeyOmittedValueInCSV.csv");
     Appender appender = StorageManager.getAppender(conf, meta, tablePath);
@@ -384,11 +384,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i+=2) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_" + i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -402,8 +402,8 @@ public class TestBSTIndex {
     sortKeys[1] = new SortSpec(schema.getColumn("long"), true, false);
 
     Schema keySchema = new Schema();
-    keySchema.addColumn(new Column("int", DataType.INT));
-    keySchema.addColumn(new Column("long", DataType.LONG));
+    keySchema.addColumn(new Column("int", Type.INT4));
+    keySchema.addColumn(new Column("long", Type.INT8));
 
     TupleComparator comp = new TupleComparator(keySchema, sortKeys);
     
@@ -438,13 +438,13 @@ public class TestBSTIndex {
     Tuple result;
     for(int i = 1 ; i < TUPLE_NUM -1 ; i+=2) {
       keyTuple = new VTuple(2);
-      keyTuple.put(0, DatumFactory.createInt(i));
-      keyTuple.put(1, DatumFactory.createLong(i));
+      keyTuple.put(0, DatumFactory.createInt4(i));
+      keyTuple.put(1, DatumFactory.createInt8(i));
       long offsets = reader.find(keyTuple, true);
       scanner.seek(offsets);
       result = scanner.next();
-      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(result.get(0).asInt()));
-      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(result.get(1).asLong()));
+      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(result.get(0).asInt4()));
+      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(result.get(1).asInt8()));
     }
   }
 
@@ -458,11 +458,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i ++ ) {
         tuple = new VTuple(5);
-        tuple.put(0, DatumFactory.createInt(i));
-        tuple.put(1, DatumFactory.createLong(i));
-        tuple.put(2, DatumFactory.createDouble(i));
-        tuple.put(3, DatumFactory.createFloat(i));
-        tuple.put(4, DatumFactory.createString("field_"+i));
+        tuple.put(0, DatumFactory.createInt4(i));
+        tuple.put(1, DatumFactory.createInt8(i));
+        tuple.put(2, DatumFactory.createFloat8(i));
+        tuple.put(3, DatumFactory.createFloat4(i));
+        tuple.put(4, DatumFactory.createText("field_"+i));
         appender.addTuple(tuple);
       }
     appender.close();
@@ -512,8 +512,8 @@ public class TestBSTIndex {
     reader.open();
     scanner  = (SeekableScanner)(sm.getScanner(meta, new Fragment[]{tablet}));
     for(int i = 0 ; i < TUPLE_NUM -1 ; i ++) {
-      tuple.put(0, DatumFactory.createLong(i));
-      tuple.put(1, DatumFactory.createDouble(i));
+      tuple.put(0, DatumFactory.createInt8(i));
+      tuple.put(1, DatumFactory.createFloat8(i));
       long offsets = reader.find(tuple, false);
       scanner.seek(offsets);
       tuple = scanner.next();
@@ -531,11 +531,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i += 2 ) {
         tuple = new VTuple(5);
-        tuple.put(0, DatumFactory.createInt(i));
-        tuple.put(1, DatumFactory.createLong(i));
-        tuple.put(2, DatumFactory.createDouble(i));
-        tuple.put(3, DatumFactory.createFloat(i));
-        tuple.put(4, DatumFactory.createString("field_"+i));
+        tuple.put(0, DatumFactory.createInt4(i));
+        tuple.put(1, DatumFactory.createInt8(i));
+        tuple.put(2, DatumFactory.createFloat8(i));
+        tuple.put(3, DatumFactory.createFloat4(i));
+        tuple.put(4, DatumFactory.createText("field_"+i));
         appender.addTuple(tuple);
       }
     appender.close();
@@ -585,8 +585,8 @@ public class TestBSTIndex {
         keySchema, comp);
     reader.open();
     for(int i = 1 ; i < TUPLE_NUM -1 ; i+=2) {
-      tuple.put(0, DatumFactory.createLong(i));
-      tuple.put(1, DatumFactory.createDouble(i));
+      tuple.put(0, DatumFactory.createInt8(i));
+      tuple.put(1, DatumFactory.createFloat8(i));
       long offsets = reader.find(tuple, false);
       assertEquals(-1, offsets);
     }
@@ -601,11 +601,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i ++ ) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_"+i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -654,8 +654,8 @@ public class TestBSTIndex {
     Tuple result;
     for(int i = 0 ; i < TUPLE_NUM -1 ; i ++) {
       keyTuple = new VTuple(2);
-      keyTuple.put(0, DatumFactory.createInt(i));
-      keyTuple.put(1, DatumFactory.createLong(i));
+      keyTuple.put(0, DatumFactory.createInt4(i));
+      keyTuple.put(1, DatumFactory.createInt8(i));
       long offsets = reader.find(keyTuple, true);
       scanner.seek(offsets);
       result = scanner.next();
@@ -683,11 +683,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i+=2) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_"+i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -737,8 +737,8 @@ public class TestBSTIndex {
     Tuple result;
     for(int i = 1 ; i < TUPLE_NUM -1 ; i+=2) {
       keyTuple = new VTuple(2);
-      keyTuple.put(0, DatumFactory.createInt(i));
-      keyTuple.put(1, DatumFactory.createLong(i));
+      keyTuple.put(0, DatumFactory.createInt4(i));
+      keyTuple.put(1, DatumFactory.createInt8(i));
       long offsets = reader.find(keyTuple, true);
       scanner.seek(offsets);
       result = scanner.next();
@@ -756,11 +756,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i ++ ) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_"+i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -810,8 +810,8 @@ public class TestBSTIndex {
     Tuple result;
 
     keyTuple = new VTuple(2);
-    keyTuple.put(0, DatumFactory.createInt(0));
-    keyTuple.put(1, DatumFactory.createLong(0));
+    keyTuple.put(0, DatumFactory.createInt4(0));
+    keyTuple.put(1, DatumFactory.createInt8(0));
     long offsets = reader.find(keyTuple);
     scanner.seek(offsets);
     result = scanner.next();
@@ -837,11 +837,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 5 ; i < TUPLE_NUM + 5; i ++ ) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_"+i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -890,8 +890,8 @@ public class TestBSTIndex {
     BSTIndexReader reader = bst.getIndexReader(new Path(testDir, "Test.idx"), 
keySchema, comp);
     reader.open();
     scanner  = (SeekableScanner)(sm.getScanner(meta, new Fragment[]{tablet}));
-    tuple.put(0, DatumFactory.createLong(0));
-    tuple.put(1, DatumFactory.createDouble(0));
+    tuple.put(0, DatumFactory.createInt8(0));
+    tuple.put(1, DatumFactory.createFloat8(0));
 
     offset = reader.find(tuple);
     assertEquals(-1, offset);
@@ -913,11 +913,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 5 ; i < TUPLE_NUM; i ++ ) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_"+i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -992,8 +992,8 @@ public class TestBSTIndex {
       int keyVal;
       for (int i = 0; i < 10000; i++) {
         keyVal = rnd.nextInt(10000);
-        findKey.put(0, DatumFactory.createInt(keyVal));
-        findKey.put(1, DatumFactory.createLong(keyVal));
+        findKey.put(0, DatumFactory.createInt4(keyVal));
+        findKey.put(1, DatumFactory.createInt8(keyVal));
         try {
           assertTrue(reader.find(findKey) != -1);
         } catch (Exception e) {
@@ -1013,11 +1013,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i ++ ) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_"+i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -1087,11 +1087,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = (TUPLE_NUM - 1); i >= 0; i -- ) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_"+i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -1141,8 +1141,8 @@ public class TestBSTIndex {
     reader.open();
     scanner  = (SeekableScanner)(sm.getScanner(meta, new Fragment[]{tablet}));
     for(int i = (TUPLE_NUM - 1) ; i > 0  ; i --) {
-      tuple.put(0, DatumFactory.createLong(i));
-      tuple.put(1, DatumFactory.createDouble(i));
+      tuple.put(0, DatumFactory.createInt8(i));
+      tuple.put(1, DatumFactory.createFloat8(i));
       long offsets = reader.find(tuple);
       scanner.seek(offsets);
       tuple = scanner.next();
@@ -1169,11 +1169,11 @@ public class TestBSTIndex {
     Tuple tuple;
     for(int i = (TUPLE_NUM - 1); i >= 0; i --) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_"+i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -1226,8 +1226,8 @@ public class TestBSTIndex {
     Tuple result;
     for(int i = (TUPLE_NUM - 1) ; i > 0 ; i --) {
       keyTuple = new VTuple(2);
-      keyTuple.put(0, DatumFactory.createInt(i));
-      keyTuple.put(1, DatumFactory.createLong(i));
+      keyTuple.put(0, DatumFactory.createInt4(i));
+      keyTuple.put(1, DatumFactory.createInt8(i));
       long offsets = reader.find(keyTuple, true);
       scanner.seek(offsets);
       result = scanner.next();

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/test/java/tajo/storage/index/TestSingleCSVFileBSTIndex.java
----------------------------------------------------------------------
diff --git 
a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/index/TestSingleCSVFileBSTIndex.java
 
b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/index/TestSingleCSVFileBSTIndex.java
index e0ae7b3..23c4ee1 100644
--- 
a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/index/TestSingleCSVFileBSTIndex.java
+++ 
b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/index/TestSingleCSVFileBSTIndex.java
@@ -24,8 +24,8 @@ import org.apache.hadoop.fs.Path;
 import org.junit.Before;
 import org.junit.Test;
 import tajo.catalog.*;
-import tajo.catalog.proto.CatalogProtos.DataType;
 import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes.Type;
 import tajo.conf.TajoConf;
 import tajo.conf.TajoConf.ConfVars;
 import tajo.datum.DatumFactory;
@@ -57,11 +57,11 @@ public class TestSingleCSVFileBSTIndex {
     conf = new TajoConf();
     conf.setVar(ConfVars.ROOT_DIR, TEST_PATH);
     schema = new Schema();
-    schema.addColumn(new Column("int", DataType.INT));
-    schema.addColumn(new Column("long", DataType.LONG));
-    schema.addColumn(new Column("double", DataType.DOUBLE));
-    schema.addColumn(new Column("float", DataType.FLOAT));
-    schema.addColumn(new Column("string", DataType.STRING));
+    schema.addColumn(new Column("int", Type.INT4));
+    schema.addColumn(new Column("long", Type.INT8));
+    schema.addColumn(new Column("double", Type.FLOAT8));
+    schema.addColumn(new Column("float", Type.FLOAT4));
+    schema.addColumn(new Column("string", Type.TEXT));
   }
 
   @Before
@@ -72,7 +72,7 @@ public class TestSingleCSVFileBSTIndex {
 
   @Test
   public void testFindValueInSingleCSV() throws IOException {
-    meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
 
     Path tablePath = StorageUtil.concatPath(testDir, 
"testFindValueInSingleCSV", "table.csv");
     fs.mkdirs(tablePath.getParent());
@@ -82,11 +82,11 @@ public class TestSingleCSVFileBSTIndex {
     Tuple tuple;
     for (int i = 0; i < TUPLE_NUM; i++) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_" + i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_" + i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -101,8 +101,8 @@ public class TestSingleCSVFileBSTIndex {
     sortKeys[1] = new SortSpec(schema.getColumn("double"), true, false);
 
     Schema keySchema = new Schema();
-    keySchema.addColumn(new Column("long", DataType.LONG));
-    keySchema.addColumn(new Column("double", DataType.DOUBLE));
+    keySchema.addColumn(new Column("long", Type.INT8));
+    keySchema.addColumn(new Column("double", Type.FLOAT8));
 
     TupleComparator comp = new TupleComparator(keySchema, sortKeys);
 
@@ -137,13 +137,13 @@ public class TestSingleCSVFileBSTIndex {
     reader.open();
     fileScanner = new CSVScanner(conf, meta, tablet);
     for (int i = 0; i < TUPLE_NUM - 1; i++) {
-      tuple.put(0, DatumFactory.createLong(i));
-      tuple.put(1, DatumFactory.createDouble(i));
+      tuple.put(0, DatumFactory.createInt8(i));
+      tuple.put(1, DatumFactory.createFloat8(i));
       long offsets = reader.find(tuple);
       fileScanner.seek(offsets);
       tuple = fileScanner.next();
-      assertEquals(i,  (tuple.get(1).asLong()));
-      assertEquals(i, (tuple.get(2).asDouble()) , 0.01);
+      assertEquals(i,  (tuple.get(1).asInt8()));
+      assertEquals(i, (tuple.get(2).asFloat8()) , 0.01);
 
       offsets = reader.next();
       if (offsets == -1) {
@@ -152,15 +152,15 @@ public class TestSingleCSVFileBSTIndex {
       fileScanner.seek(offsets);
       tuple = fileScanner.next();
       assertTrue("[seek check " + (i + 1) + " ]",
-          (i + 1) == (tuple.get(0).asInt()));
+          (i + 1) == (tuple.get(0).asInt4()));
       assertTrue("[seek check " + (i + 1) + " ]",
-          (i + 1) == (tuple.get(1).asLong()));
+          (i + 1) == (tuple.get(1).asInt8()));
     }
   }
 
   @Test
   public void testFindNextKeyValueInSingleCSV() throws IOException {
-    meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+    meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
 
     Path tablePath = StorageUtil.concatPath(testDir, 
"testFindNextKeyValueInSingleCSV",
         "table1.csv");
@@ -170,11 +170,11 @@ public class TestSingleCSVFileBSTIndex {
     Tuple tuple;
     for(int i = 0 ; i < TUPLE_NUM; i ++ ) {
       tuple = new VTuple(5);
-      tuple.put(0, DatumFactory.createInt(i));
-      tuple.put(1, DatumFactory.createLong(i));
-      tuple.put(2, DatumFactory.createDouble(i));
-      tuple.put(3, DatumFactory.createFloat(i));
-      tuple.put(4, DatumFactory.createString("field_"+i));
+      tuple.put(0, DatumFactory.createInt4(i));
+      tuple.put(1, DatumFactory.createInt8(i));
+      tuple.put(2, DatumFactory.createFloat8(i));
+      tuple.put(3, DatumFactory.createFloat4(i));
+      tuple.put(4, DatumFactory.createText("field_" + i));
       appender.addTuple(tuple);
     }
     appender.close();
@@ -188,8 +188,8 @@ public class TestSingleCSVFileBSTIndex {
     sortKeys[1] = new SortSpec(schema.getColumn("long"), true, false);
 
     Schema keySchema = new Schema();
-    keySchema.addColumn(new Column("int", DataType.INT));
-    keySchema.addColumn(new Column("long", DataType.LONG));
+    keySchema.addColumn(new Column("int", Type.INT4));
+    keySchema.addColumn(new Column("long", Type.INT8));
 
     TupleComparator comp = new TupleComparator(keySchema, sortKeys);
     
@@ -223,13 +223,13 @@ public class TestSingleCSVFileBSTIndex {
     Tuple result;
     for(int i = 0 ; i < TUPLE_NUM -1 ; i ++) {
       keyTuple = new VTuple(2);
-      keyTuple.put(0, DatumFactory.createInt(i));
-      keyTuple.put(1, DatumFactory.createLong(i));
+      keyTuple.put(0, DatumFactory.createInt4(i));
+      keyTuple.put(1, DatumFactory.createInt8(i));
       long offsets = reader.find(keyTuple, true);
       fileScanner.seek(offsets);
       result = fileScanner.next();
-      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(result.get(0).asInt()));
-      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(result.get(1).asLong()));
+      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(result.get(0).asInt4()));
+      assertTrue("[seek check " + (i + 1) + " ]" , (i + 1) == 
(result.get(1).asInt8()));
       
       offsets = reader.next();
       if (offsets == -1) {
@@ -237,8 +237,8 @@ public class TestSingleCSVFileBSTIndex {
       }
       fileScanner.seek(offsets);
       result = fileScanner.next();
-      assertTrue("[seek check " + (i + 2) + " ]" , (i + 2) == 
(result.get(0).asLong()));
-      assertTrue("[seek check " + (i + 2) + " ]" , (i + 2) == 
(result.get(1).asDouble()));
+      assertTrue("[seek check " + (i + 2) + " ]" , (i + 2) == 
(result.get(0).asInt8()));
+      assertTrue("[seek check " + (i + 2) + " ]" , (i + 2) == 
(result.get(1).asFloat8()));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/test/java/tajo/storage/rcfile/TestRCFile.java
----------------------------------------------------------------------
diff --git 
a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/rcfile/TestRCFile.java 
b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/rcfile/TestRCFile.java
index 315b0ed..0df4026 100644
--- 
a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/rcfile/TestRCFile.java
+++ 
b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/rcfile/TestRCFile.java
@@ -127,11 +127,11 @@ public class TestRCFile {
 
     Datum [] r1 = new Datum[7];
     int idx = 0;
-    r1[idx++] = DatumFactory.createInt(123);
-    r1[idx++] = DatumFactory.createLong(456);
-    r1[idx++] = DatumFactory.createFloat(7.89f);
-    r1[idx++] = DatumFactory.createDouble(10.11d);
-    r1[idx] = DatumFactory.createString("tajo and hadoop");
+    r1[idx++] = DatumFactory.createInt4(123);
+    r1[idx++] = DatumFactory.createInt8(456);
+    r1[idx++] = DatumFactory.createFloat4(7.89f);
+    r1[idx++] = DatumFactory.createFloat8(10.11d);
+    r1[idx] = DatumFactory.createText("tajo and hadoop");
 
 //    byte[][] record_1 = {
 //        "123".getBytes("UTF-8"), "456".getBytes("UTF-8"),
@@ -151,11 +151,11 @@ public class TestRCFile {
 
     Datum [] r2 = new Datum[7];
     idx = 0;
-    r2[idx++] = DatumFactory.createInt(100);
-    r2[idx++] = DatumFactory.createLong(200);
-    r2[idx++] = DatumFactory.createFloat(5.3f);
-    r2[idx++] = DatumFactory.createDouble(11.12d);
-    r2[idx] = DatumFactory.createString("the second str");
+    r2[idx++] = DatumFactory.createInt4(100);
+    r2[idx++] = DatumFactory.createInt8(200);
+    r2[idx++] = DatumFactory.createFloat4(5.3f);
+    r2[idx++] = DatumFactory.createFloat8(11.12d);
+    r2[idx] = DatumFactory.createText("the second str");
 
     byte [][] record_2 = {
         r2[0].asByteArray(),
@@ -221,22 +221,22 @@ public class TestRCFile {
     BytesRefArrayWritable cols = new BytesRefArrayWritable();
     reader.getCurrentRow(cols);
     cols.resetValid(7);
-    assertEquals(r1[0], new IntDatum(cols.get(0).getBytesCopy()));
-    assertEquals(r1[1], new LongDatum(cols.get(1).getBytesCopy()));
-    assertEquals(r1[2], new FloatDatum(cols.get(2).getBytesCopy()));
-    assertEquals(r1[3], new DoubleDatum(cols.get(3).getBytesCopy()));
-    assertEquals(r1[4], new StringDatum(cols.get(4).getBytesCopy()));
+    assertEquals(r1[0], new Int4Datum(cols.get(0).getBytesCopy()));
+    assertEquals(r1[1], new Int8Datum(cols.get(1).getBytesCopy()));
+    assertEquals(r1[2], new Float4Datum(cols.get(2).getBytesCopy()));
+    assertEquals(r1[3], new Float8Datum(cols.get(3).getBytesCopy()));
+    assertEquals(r1[4], new TextDatum(cols.get(4).getBytesCopy()));
 
 
     reader.next(rowID);
     cols = new BytesRefArrayWritable();
     reader.getCurrentRow(cols);
     cols.resetValid(7);
-    assertEquals(r2[0], new IntDatum(cols.get(0).getBytesCopy()));
-    assertEquals(r2[1], new LongDatum(cols.get(1).getBytesCopy()));
-    assertEquals(r2[2], new FloatDatum(cols.get(2).getBytesCopy()));
-    assertEquals(r2[3], new DoubleDatum(cols.get(3).getBytesCopy()));
-    assertEquals(r2[4], new StringDatum(cols.get(4).getBytesCopy()));
+    assertEquals(r2[0], new Int4Datum(cols.get(0).getBytesCopy()));
+    assertEquals(r2[1], new Int8Datum(cols.get(1).getBytesCopy()));
+    assertEquals(r2[2], new Float4Datum(cols.get(2).getBytesCopy()));
+    assertEquals(r2[3], new Float8Datum(cols.get(3).getBytesCopy()));
+    assertEquals(r2[4], new TextDatum(cols.get(4).getBytesCopy()));
     /*
       cols.resetValid(8);
       Object row = serDe.deserialize(cols);

Reply via email to