tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject [6/7] tajo git commit: TAJO-2129: Apply new type implementation to Schema and Catalog.
Date Fri, 13 May 2016 05:32:46 GMT
http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-drivers/tajo-hive/src/test/java/org/apache/tajo/catalog/store/TestHiveCatalogStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-drivers/tajo-hive/src/test/java/org/apache/tajo/catalog/store/TestHiveCatalogStore.java b/tajo-catalog/tajo-catalog-drivers/tajo-hive/src/test/java/org/apache/tajo/catalog/store/TestHiveCatalogStore.java
index fdb1853..1260371 100644
--- a/tajo-catalog/tajo-catalog-drivers/tajo-hive/src/test/java/org/apache/tajo/catalog/store/TestHiveCatalogStore.java
+++ b/tajo-catalog/tajo-catalog-drivers/tajo-hive/src/test/java/org/apache/tajo/catalog/store/TestHiveCatalogStore.java
@@ -36,6 +36,7 @@ import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.catalog.proto.CatalogProtos.PartitionKeyProto;
 import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.storage.StorageConstants;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.KeyValueSet;
@@ -106,7 +107,7 @@ public class TestHiveCatalogStore {
         .add("c_comment", TajoDataTypes.Type.TEXT)
         .build();
 
-    TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, CUSTOMER), schema, meta,
+    TableDesc table = new TableDesc(IdentifierUtil.buildFQName(DB_NAME, CUSTOMER), schema, meta,
         new Path(warehousePath, new Path(DB_NAME, CUSTOMER)).toUri());
     store.createTable(table.getProto());
     assertTrue(store.existTable(DB_NAME, CUSTOMER));
@@ -142,7 +143,7 @@ public class TestHiveCatalogStore {
         .add("r_comment", TajoDataTypes.Type.TEXT)
         .build();
 
-    TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, REGION), schema, meta,
+    TableDesc table = new TableDesc(IdentifierUtil.buildFQName(DB_NAME, REGION), schema, meta,
         new Path(warehousePath, new Path(DB_NAME, REGION)).toUri());
     store.createTable(table.getProto());
     assertTrue(store.existTable(DB_NAME, REGION));
@@ -177,7 +178,7 @@ public class TestHiveCatalogStore {
         .add("r_comment", TajoDataTypes.Type.TEXT)
         .build();
 
-    TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, REGION), schema, meta,
+    TableDesc table = new TableDesc(IdentifierUtil.buildFQName(DB_NAME, REGION), schema, meta,
         new Path(warehousePath, new Path(DB_NAME, REGION)).toUri());
     store.createTable(table.getProto());
     assertTrue(store.existTable(DB_NAME, REGION));
@@ -216,7 +217,7 @@ public class TestHiveCatalogStore {
         .add("s_comment", TajoDataTypes.Type.TEXT)
         .build();
 
-    TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, SUPPLIER), schema, meta,
+    TableDesc table = new TableDesc(IdentifierUtil.buildFQName(DB_NAME, SUPPLIER), schema, meta,
         new Path(warehousePath, new Path(DB_NAME, SUPPLIER)).toUri());
 
     store.createTable(table.getProto());
@@ -263,7 +264,7 @@ public class TestHiveCatalogStore {
         .build();
 
 
-    TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, NATION), schema, meta,
+    TableDesc table = new TableDesc(IdentifierUtil.buildFQName(DB_NAME, NATION), schema, meta,
         new Path(warehousePath, new Path(DB_NAME, NATION)).toUri());
 
     org.apache.tajo.catalog.Schema expressionSchema = SchemaBuilder.builder()
@@ -515,7 +516,7 @@ public class TestHiveCatalogStore {
     String[] tableNames = new String[]{"table1", "table2", "table3"};
 
     for(String tableName : tableNames){
-      TableDesc table = new TableDesc(CatalogUtil.buildFQName("default", tableName), schema, meta,
+      TableDesc table = new TableDesc(IdentifierUtil.buildFQName("default", tableName), schema, meta,
           new Path(warehousePath, new Path(DB_NAME, tableName)).toUri());
       store.createTable(table.getProto());
     }
@@ -567,7 +568,7 @@ public class TestHiveCatalogStore {
         .add("r_comment", TajoDataTypes.Type.TEXT)
         .build();
 
-    TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, REGION), schema, meta,
+    TableDesc table = new TableDesc(IdentifierUtil.buildFQName(DB_NAME, REGION), schema, meta,
         new Path(warehousePath, new Path(DB_NAME, REGION)).toUri());
     store.createTable(table.getProto());
     assertTrue(store.existTable(DB_NAME, REGION));
@@ -602,7 +603,7 @@ public class TestHiveCatalogStore {
         .add("r_comment", TajoDataTypes.Type.TEXT)
         .build();
 
-    TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, REGION), schema, meta,
+    TableDesc table = new TableDesc(IdentifierUtil.buildFQName(DB_NAME, REGION), schema, meta,
         new Path(warehousePath, new Path(DB_NAME, REGION)).toUri());
     store.createTable(table.getProto());
     assertTrue(store.existTable(DB_NAME, REGION));
@@ -640,7 +641,7 @@ public class TestHiveCatalogStore {
         .add("c_comment", TajoDataTypes.Type.TEXT)
         .build();
 
-    TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, CUSTOMER), schema, meta,
+    TableDesc table = new TableDesc(IdentifierUtil.buildFQName(DB_NAME, CUSTOMER), schema, meta,
         new Path(warehousePath, new Path(DB_NAME, CUSTOMER)).toUri());
     store.createTable(table.getProto());
     assertTrue(store.existTable(DB_NAME, CUSTOMER));
@@ -663,7 +664,7 @@ public class TestHiveCatalogStore {
 
   @Test
   public void testDataTypeCompatibility() throws Exception {
-    String tableName = CatalogUtil.normalizeIdentifier("testDataTypeCompatibility");
+    String tableName = IdentifierUtil.normalizeIdentifier("testDataTypeCompatibility");
 
     TableMeta meta = new TableMeta(BuiltinStorages.TEXT, new KeyValueSet());
 
@@ -681,7 +682,7 @@ public class TestHiveCatalogStore {
         .add("col11", TajoDataTypes.Type.DATE)
         .build();
 
-    TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, tableName), schema, meta,
+    TableDesc table = new TableDesc(IdentifierUtil.buildFQName(DB_NAME, tableName), schema, meta,
       new Path(warehousePath, new Path(DB_NAME, tableName)).toUri());
     store.createTable(table.getProto());
     assertTrue(store.existTable(DB_NAME, tableName));

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
index df40b9b..6583d4e 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
@@ -49,6 +49,7 @@ import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.NullProto;
 import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.ReturnState;
 import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.StringListResponse;
 import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.StringProto;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.util.NetUtils;
 import org.apache.tajo.util.Pair;
 import org.apache.tajo.util.TUtil;
@@ -441,7 +442,7 @@ public class CatalogServer extends AbstractService {
 
     @Override
     public ReturnState alterTable(RpcController controller, AlterTableDescProto proto) {
-      String [] split = CatalogUtil.splitTableName(proto.getTableName());
+      String [] split = IdentifierUtil.splitTableName(proto.getTableName());
 
       if (linkedMetadataManager.existsDatabase(split[0])) {
         return errInsufficientPrivilege("alter a table in database '" + split[0] + "'");
@@ -666,7 +667,7 @@ public class CatalogServer extends AbstractService {
     @Override
     public ReturnState createTable(RpcController controller, TableDescProto request) {
 
-      String [] splitted = CatalogUtil.splitFQTableName(request.getTableName());
+      String [] splitted = IdentifierUtil.splitFQTableName(request.getTableName());
 
       String dbName = splitted[0];
       String tbName = splitted[1];
@@ -683,7 +684,7 @@ public class CatalogServer extends AbstractService {
       try {
         store.createTable(request);
         LOG.info(String.format("relation \"%s\" is added to the catalog (%s)",
-            CatalogUtil.getCanonicalTableName(dbName, tbName), bindAddress));
+            IdentifierUtil.getCanonicalTableName(dbName, tbName), bindAddress));
         return OK;
 
       } catch (Throwable t) {
@@ -713,7 +714,7 @@ public class CatalogServer extends AbstractService {
       try {
         store.dropTable(dbName, tbName);
         LOG.info(String.format("relation \"%s\" is deleted from the catalog (%s)",
-            CatalogUtil.getCanonicalTableName(dbName, tbName), bindAddress));
+            IdentifierUtil.getCanonicalTableName(dbName, tbName), bindAddress));
 
         return OK;
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/dictionary/AbstractTableDescriptor.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/dictionary/AbstractTableDescriptor.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/dictionary/AbstractTableDescriptor.java
index cb071aa..1cf3e64 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/dictionary/AbstractTableDescriptor.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/dictionary/AbstractTableDescriptor.java
@@ -21,6 +21,8 @@ package org.apache.tajo.catalog.dictionary;
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.proto.CatalogProtos.*;
 import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.KeyValueSetProto;
+import org.apache.tajo.schema.IdentifierUtil;
+import org.apache.tajo.type.TypeFactory;
 
 abstract class AbstractTableDescriptor implements TableDescriptor {
   
@@ -40,13 +42,7 @@ abstract class AbstractTableDescriptor implements TableDescriptor {
       columnBuilder = ColumnProto.newBuilder();
       
       columnBuilder.setName(columnDescriptor.getName().toLowerCase());
-      if (columnDescriptor.getLength() > 0) {
-        columnBuilder.setDataType(CatalogUtil.newDataTypeWithLen(columnDescriptor.getType(),
-            columnDescriptor.getLength()));
-      } else {
-        columnBuilder.setDataType(CatalogUtil.newSimpleDataType(columnDescriptor.getType()));
-      }
-      
+      columnBuilder.setType(TypeFactory.create(columnDescriptor.getType()).getProto());
       schemaBuilder.addFields(columnBuilder.build());
     }
     
@@ -71,7 +67,7 @@ abstract class AbstractTableDescriptor implements TableDescriptor {
   public TableDescProto getTableDescription() {
     TableDescProto.Builder tableBuilder = TableDescProto.newBuilder();
     
-    tableBuilder.setTableName(CatalogUtil.buildFQName(dictionary.getSystemDatabaseName(), getTableNameString()));
+    tableBuilder.setTableName(IdentifierUtil.buildFQName(dictionary.getSystemDatabaseName(), getTableNameString()));
     tableBuilder.setPath(dictionary.getTablePath());
     
     tableBuilder.setSchema(CatalogUtil.getQualfiedSchema(

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
index 88fabe2..2e2db6f 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
@@ -31,12 +31,14 @@ import org.apache.tajo.annotation.Nullable;
 import org.apache.tajo.catalog.*;
 import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.catalog.proto.CatalogProtos.*;
-import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.exception.*;
 import org.apache.tajo.plan.expr.AlgebraicUtil;
 import org.apache.tajo.plan.util.PartitionFilterAlgebraVisitor;
+import org.apache.tajo.schema.IdentifierUtil;
+import org.apache.tajo.type.TypeProtobufEncoder;
+import org.apache.tajo.type.TypeStringEncoder;
 import org.apache.tajo.util.JavaResourceUtil;
 import org.apache.tajo.util.Pair;
 
@@ -49,6 +51,8 @@ import java.util.*;
 import static org.apache.tajo.catalog.proto.CatalogProtos.AlterTablespaceProto.AlterTablespaceCommand;
 import static org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.KeyValueProto;
 import static org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.KeyValueSetProto;
+import static org.apache.tajo.schema.IdentifierUtil.extractQualifier;
+import static org.apache.tajo.schema.IdentifierUtil.extractSimpleName;
 
 public abstract class AbstractDBStore extends CatalogConstants implements CatalogStore {
   protected final Log LOG = LogFactory.getLog(getClass());
@@ -756,7 +760,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
     PreparedStatement pstmt = null;
     ResultSet res = null;
 
-    String[] splitted = CatalogUtil.splitTableName(table.getTableName());
+    final String[] splitted = IdentifierUtil.splitTableName(table.getTableName());
     if (splitted.length == 1) {
       throw new TajoInternalError(
           "createTable() requires a qualified table name, but it is '" + table.getTableName() + "'");
@@ -811,9 +815,9 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
 
       String colSql =
           "INSERT INTO " + TB_COLUMNS +
-              // 1    2            3                 4                 5          6
-              " (TID, COLUMN_NAME, ORDINAL_POSITION, NESTED_FIELD_NUM, DATA_TYPE, TYPE_LENGTH)" +
-              " VALUES(?, ?, ?, ?, ?, ?) ";
+              // 1    2            3                 4
+              " (TID, COLUMN_NAME, ORDINAL_POSITION, DATA_TYPE)" +
+              " VALUES(?, ?, ?, ?) ";
 
       if (LOG.isDebugEnabled()) {
         LOG.debug(colSql);
@@ -822,15 +826,12 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       pstmt = conn.prepareStatement(colSql);
       for (int i = 0; i < table.getSchema().getFieldsCount(); i++) {
         ColumnProto col = table.getSchema().getFields(i);
-        TajoDataTypes.DataType dataType = col.getDataType();
+        org.apache.tajo.type.Type type = TypeProtobufEncoder.decode(col.getType());
 
         pstmt.setInt(1, tableId);
-        pstmt.setString(2, CatalogUtil.extractSimpleName(col.getName()));
+        pstmt.setString(2, extractSimpleName(col.getName()));
         pstmt.setInt(3, i);
-        // the default number of nested fields is 0.
-        pstmt.setInt(4, dataType.hasNumNestedFields() ? dataType.getNumNestedFields() : 0);
-        pstmt.setString(5, dataType.getType().name());
-        pstmt.setInt(6, (col.getDataType().hasLength() ? col.getDataType().getLength() : 0));
+        pstmt.setString(4, TypeStringEncoder.encode(type));
         pstmt.addBatch();
         pstmt.clearParameters();
       }
@@ -911,7 +912,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
     PreparedStatement pstmt = null;
     ResultSet res = null;
 
-    String[] splitted = CatalogUtil.splitTableName(statsProto.getTableName());
+    String[] splitted = IdentifierUtil.splitTableName(statsProto.getTableName());
     if (splitted.length == 1) {
       throw new IllegalArgumentException("updateTableStats() requires a qualified table name, but it is \""
           + statsProto.getTableName() + "\".");
@@ -978,7 +979,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       DuplicatePartitionException, UndefinedPartitionException, UndefinedColumnException, UndefinedTableException,
       UndefinedPartitionMethodException, AmbiguousTableException {
 
-    String[] splitted = CatalogUtil.splitTableName(alterTableDescProto.getTableName());
+    String[] splitted = IdentifierUtil.splitTableName(alterTableDescProto.getTableName());
     if (splitted.length == 1) {
       throw new IllegalArgumentException("alterTable() requires a qualified table name, but it is \""
           + alterTableDescProto.getTableName() + "\".");
@@ -993,7 +994,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
 
     switch (alterTableDescProto.getAlterTableType()) {
     case RENAME_TABLE:
-      String simpleNewTableName = CatalogUtil.extractSimpleName(alterTableDescProto.getNewTableName());
+      String simpleNewTableName = extractSimpleName(alterTableDescProto.getNewTableName());
       if (existTable(databaseName, simpleNewTableName)) {
         throw new DuplicateTableException(alterTableDescProto.getNewTableName());
       }
@@ -1149,13 +1150,13 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       throws UndefinedColumnException, AmbiguousTableException {
 
     final String selectColumnSql =
-        "SELECT COLUMN_NAME, DATA_TYPE, TYPE_LENGTH, ORDINAL_POSITION, NESTED_FIELD_NUM from " + TB_COLUMNS +
+        "SELECT COLUMN_NAME, DATA_TYPE, ORDINAL_POSITION from " + TB_COLUMNS +
             " WHERE " + COL_TABLES_PK + " = ?" + " AND COLUMN_NAME = ?" ;
     final String deleteColumnNameSql =
         "DELETE FROM " + TB_COLUMNS + " WHERE TID = ? AND COLUMN_NAME = ?";
     final String insertNewColumnSql =
         "INSERT INTO " + TB_COLUMNS +
-            " (TID, COLUMN_NAME, ORDINAL_POSITION, NESTED_FIELD_NUM, DATA_TYPE, TYPE_LENGTH) VALUES(?, ?, ?, ?, ?, ?) ";
+            " (TID, COLUMN_NAME, ORDINAL_POSITION, DATA_TYPE) VALUES(?, ?, ?, ?) ";
 
     if (LOG.isDebugEnabled()) {
       LOG.debug(selectColumnSql);
@@ -1172,13 +1173,13 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       conn = getConnection();
       conn.setAutoCommit(false);
 
-      String tableName = CatalogUtil.extractQualifier(alterColumnProto.getOldColumnName());
-      String simpleOldColumnName = CatalogUtil.extractSimpleName(alterColumnProto.getOldColumnName());
-      String simpleNewColumnName = CatalogUtil.extractSimpleName(alterColumnProto.getNewColumnName());
+      String tableName = extractQualifier(alterColumnProto.getOldColumnName());
+      String simpleOldColumnName = extractSimpleName(alterColumnProto.getOldColumnName());
+      String simpleNewColumnName = extractSimpleName(alterColumnProto.getNewColumnName());
 
-      if (!tableName.equals(CatalogUtil.extractQualifier(alterColumnProto.getNewColumnName()))) {
+      if (!tableName.equals(extractQualifier(alterColumnProto.getNewColumnName()))) {
         throw new AmbiguousTableException(
-            tableName + ", " + CatalogUtil.extractQualifier(alterColumnProto.getNewColumnName()));
+            tableName + ", " + extractQualifier(alterColumnProto.getNewColumnName()));
       }
 
       //SELECT COLUMN
@@ -1188,15 +1189,15 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       resultSet = pstmt.executeQuery();
 
       CatalogProtos.ColumnProto columnProto = null;
+      String typeStr;
       int ordinalPosition = 0;
-      int nestedFieldNum = 0;
 
       if (resultSet.next()) {
         columnProto = resultToColumnProto(resultSet);
         //NOTE ==> Setting new column Name
         columnProto = columnProto.toBuilder().setName(alterColumnProto.getNewColumnName()).build();
         ordinalPosition = resultSet.getInt("ORDINAL_POSITION");
-        nestedFieldNum = resultSet.getInt("NESTED_FIELD_NUM");
+        typeStr = TypeStringEncoder.encode(TypeProtobufEncoder.decode(columnProto.getType()));
       } else {
         throw new UndefinedColumnException(alterColumnProto.getOldColumnName());
       }
@@ -1217,9 +1218,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       pstmt.setInt(1, tableId);
       pstmt.setString(2, simpleNewColumnName);
       pstmt.setInt(3, ordinalPosition);
-      pstmt.setInt(4, nestedFieldNum);
-      pstmt.setString(5, columnProto.getDataType().getType().name());
-      pstmt.setInt(6, (columnProto.getDataType().hasLength() ? columnProto.getDataType().getLength() : 0));
+      pstmt.setString(4, typeStr);
       pstmt.executeUpdate();
 
       conn.commit();
@@ -1243,7 +1242,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
 
     final String insertNewColumnSql =
         "INSERT INTO " + TB_COLUMNS +
-            " (TID, COLUMN_NAME, ORDINAL_POSITION, NESTED_FIELD_NUM, DATA_TYPE, TYPE_LENGTH) VALUES(?, ?, ?, ?, ?, ?) ";
+            " (TID, COLUMN_NAME, ORDINAL_POSITION, DATA_TYPE) VALUES(?, ?, ?, ?) ";
     final String columnCountSql =
         "SELECT MAX(ORDINAL_POSITION) AS POSITION FROM " + TB_COLUMNS + " WHERE TID = ?";
 
@@ -1251,7 +1250,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       conn = getConnection();
       pstmt = conn.prepareStatement(existColumnSql);
       pstmt.setInt(1, tableId);
-      pstmt.setString(2, CatalogUtil.extractSimpleName(columnProto.getName()));
+      pstmt.setString(2, extractSimpleName(columnProto.getName()));
       resultSet =  pstmt.executeQuery();
 
       if (resultSet.next()) {
@@ -1271,15 +1270,13 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       pstmt.close();
       resultSet = null;
 
-      TajoDataTypes.DataType dataType = columnProto.getDataType();
+      org.apache.tajo.type.Type type = TypeProtobufEncoder.decode(columnProto.getType());
 
       pstmt = conn.prepareStatement(insertNewColumnSql);
       pstmt.setInt(1, tableId);
-      pstmt.setString(2, CatalogUtil.extractSimpleName(columnProto.getName()));
+      pstmt.setString(2, extractSimpleName(columnProto.getName()));
       pstmt.setInt(3, position + 1);
-      pstmt.setInt(4, dataType.hasNumNestedFields() ? dataType.getNumNestedFields() : 0);
-      pstmt.setString(5, dataType.getType().name());
-      pstmt.setInt(6, (columnProto.getDataType().hasLength() ? columnProto.getDataType().getLength() : 0));
+      pstmt.setString(4, TypeStringEncoder.encode(type));
       pstmt.executeUpdate();
 
     } catch (SQLException sqlException) {
@@ -1600,7 +1597,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       }
 
       int tableId = res.getInt(1);
-      tableBuilder.setTableName(CatalogUtil.buildFQName(databaseName, res.getString(2).trim()));
+      tableBuilder.setTableName(IdentifierUtil.buildFQName(databaseName, res.getString(2).trim()));
       TableType tableType = TableType.valueOf(res.getString(3));
       if (tableType == TableType.EXTERNAL) {
         tableBuilder.setIsExternal(true);
@@ -1618,7 +1615,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
         // Geting Column Descriptions
         //////////////////////////////////////////
         CatalogProtos.SchemaProto.Builder schemaBuilder = CatalogProtos.SchemaProto.newBuilder();
-        sql = "SELECT COLUMN_NAME, NESTED_FIELD_NUM, DATA_TYPE, TYPE_LENGTH from " + TB_COLUMNS +
+        sql = "SELECT COLUMN_NAME, DATA_TYPE from " + TB_COLUMNS +
             " WHERE " + COL_TABLES_PK + " = ? ORDER BY ORDINAL_POSITION ASC";
 
         if (LOG.isDebugEnabled()) {
@@ -1847,7 +1844,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
 
     try {
       String sql =
-              "SELECT TID, COLUMN_NAME, ORDINAL_POSITION, NESTED_FIELD_NUM, DATA_TYPE, TYPE_LENGTH FROM " + TB_COLUMNS +
+              "SELECT TID, COLUMN_NAME, ORDINAL_POSITION, DATA_TYPE FROM " + TB_COLUMNS +
                       " ORDER BY TID ASC, ORDINAL_POSITION ASC";
 
       conn = getConnection();
@@ -1860,21 +1857,9 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
         String databaseName = getDatabaseNameOfTable(conn, tid);
         String tableName = getTableName(conn, tid);
         builder.setTid(tid);
-        builder.setName(CatalogUtil.buildFQName(databaseName, tableName, resultSet.getString("COLUMN_NAME")));
-
-        int nestedFieldNum = resultSet.getInt("NESTED_FIELD_NUM");
-
-        Type type = getDataType(resultSet.getString("DATA_TYPE").trim());
-        int typeLength = resultSet.getInt("TYPE_LENGTH");
-
-        if (nestedFieldNum > 0) {
-          builder.setDataType(CatalogUtil.newRecordType(nestedFieldNum));
-        } else if (typeLength > 0) {
-          builder.setDataType(CatalogUtil.newDataTypeWithLen(type, typeLength));
-        } else {
-          builder.setDataType(CatalogUtil.newSimpleDataType(type));
-        }
-        
+        builder.setName(IdentifierUtil.buildFQName(databaseName, tableName, resultSet.getString("COLUMN_NAME")));
+        org.apache.tajo.type.Type type = TypeStringEncoder.decode(resultSet.getString("DATA_TYPE").trim());
+        builder.setType(type.getProto());
         columns.add(builder.build());
       }
     } catch (SQLException se) {
@@ -2484,7 +2469,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
     PreparedStatement pstmt = null;
 
     final String databaseName = proto.getTableIdentifier().getDatabaseName();
-    final String tableName = CatalogUtil.extractSimpleName(proto.getTableIdentifier().getTableName());
+    final String tableName = extractSimpleName(proto.getTableIdentifier().getTableName());
 
     try {
 
@@ -2529,7 +2514,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
         // Since the key columns are always sorted in order of their occurrence position in the relation schema,
         // the concatenated name can be uniquely identified.
         columnNamesBuilder.append(columnSpec.getSortKey().getSimpleName()).append(",");
-        dataTypesBuilder.append(columnSpec.getSortKey().getDataType().getType().name()).append(",");
+        dataTypesBuilder.append(columnSpec.getSortKey().getDataType().getType().name()).append("|");
         ordersBuilder.append(columnSpec.isAscending()).append(",");
         nullOrdersBuilder.append(columnSpec.isNullsFirst()).append(",");
       }
@@ -2576,7 +2561,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       pstmt.setString(2, indexName);
       ResultSet res = pstmt.executeQuery();
       if (!res.next()) {
-        throw new UndefinedIndexException(CatalogUtil.buildFQName(databaseName, indexName));
+        throw new UndefinedIndexException(IdentifierUtil.buildFQName(databaseName, indexName));
       }
       pstmt.close();
       res.close();
@@ -2676,7 +2661,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       IndexDescProto.Builder builder = IndexDescProto.newBuilder();
       String tableName = getTableName(conn, res.getInt(COL_TABLES_PK));
       builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName));
-      resultToIndexDescProtoBuilder(CatalogUtil.buildFQName(databaseName, tableName), builder, res);
+      resultToIndexDescProtoBuilder(IdentifierUtil.buildFQName(databaseName, tableName), builder, res);
 
       try {
         builder.setTargetRelationSchema(getTable(databaseName, tableName).getSchema());
@@ -2727,7 +2712,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
       }
 
       IndexDescProto.Builder builder = IndexDescProto.newBuilder();
-      resultToIndexDescProtoBuilder(CatalogUtil.buildFQName(databaseName, tableName), builder, res);
+      resultToIndexDescProtoBuilder(IdentifierUtil.buildFQName(databaseName, tableName), builder, res);
       builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName));
       builder.setTargetRelationSchema(tableDescProto.getSchema());
       proto = builder.build();
@@ -2897,14 +2882,14 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
     builder.setIndexPath(res.getString("path"));
     String[] columnNames, dataTypes, orders, nullOrders;
     columnNames = res.getString("column_names").trim().split(",");
-    dataTypes = res.getString("data_types").trim().split(",");
+    dataTypes = res.getString("data_types").trim().split("\\|");
     orders = res.getString("orders").trim().split(",");
     nullOrders = res.getString("null_orders").trim().split(",");
     int columnNum = columnNames.length;
     for (int i = 0; i < columnNum; i++) {
       SortSpecProto.Builder colSpecBuilder = SortSpecProto.newBuilder();
-      colSpecBuilder.setColumn(ColumnProto.newBuilder().setName(CatalogUtil.buildFQName(qualifier, columnNames[i]))
-          .setDataType(CatalogUtil.newSimpleDataType(getDataType(dataTypes[i]))).build());
+      colSpecBuilder.setColumn(ColumnProto.newBuilder().setName(IdentifierUtil.buildFQName(qualifier, columnNames[i]))
+          .setType(TypeStringEncoder.decode(dataTypes[i]).getProto()).build());
       colSpecBuilder.setAscending(orders[i].equals("true"));
       colSpecBuilder.setNullFirst(nullOrders[i].equals("true"));
       builder.addKeySortSpecs(colSpecBuilder.build());
@@ -2916,20 +2901,8 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
   private ColumnProto resultToColumnProto(final ResultSet res) throws SQLException {
     ColumnProto.Builder builder = ColumnProto.newBuilder();
     builder.setName(res.getString("column_name").trim());
-
-    int nestedFieldNum = res.getInt("NESTED_FIELD_NUM");
-
-    Type type = getDataType(res.getString("data_type").trim());
-    int typeLength = res.getInt("type_length");
-
-    if (nestedFieldNum > 0) {
-      builder.setDataType(CatalogUtil.newRecordType(nestedFieldNum));
-    } else if (typeLength > 0) {
-      builder.setDataType(CatalogUtil.newDataTypeWithLen(type, typeLength));
-    } else {
-      builder.setDataType(CatalogUtil.newSimpleDataType(type));
-    }
-
+    org.apache.tajo.type.Type type = TypeStringEncoder.decode(res.getString("data_type").trim());
+    builder.setType(type.getProto());
     return builder.build();
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
index 96100e8..70ef436 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/derby/derby.xml
@@ -19,6 +19,7 @@
 <tns:store xmlns:tns="http://tajo.apache.org/catalogstore" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.xsd ">
   <!--
       Catalog base version history
+      * 13 - 2016-05-10: Apply new type implementation to Schema and Catalog. (TAJO-2129)
       * 12 - 2015-09-28: Change the variable name storeType to dataFormat (TAJO-1663)
       * 11 - 2015-09-23: Add contents length and file count for partition directory (TAJO-1493)
       * 10 - 2015-09-22: Well support for self-describing data formats (TAJO-1832)
@@ -88,9 +89,7 @@
   				TID INT NOT NULL REFERENCES TABLES (TID) ON DELETE CASCADE,
   				COLUMN_NAME VARCHAR(128) NOT NULL,
   				ORDINAL_POSITION INTEGER NOT NULL,
-  				NESTED_FIELD_NUM INTEGER NOT NULL,
-  				DATA_TYPE CHAR(16),
-  				TYPE_LENGTH INTEGER,
+  				DATA_TYPE VARCHAR(8192),
   				CONSTRAINT COLUMNS_PK PRIMARY KEY (TID, ORDINAL_POSITION)
 				)]]>
 				</tns:sql>

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/mariadb.xml
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/mariadb.xml b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/mariadb.xml
index 4611e70..cb4cddf 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/mariadb.xml
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mariadb/mariadb.xml
@@ -19,6 +19,7 @@
 <tns:store xmlns:tns="http://tajo.apache.org/catalogstore" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.xsd ">
   <!--
       Catalog base version history
+      * 14 - 2016-05-10: Apply new type implementation to Schema and Catalog. (TAJO-2129)
       * 13 - 2016-05-07: Add some missing index to MariaDBStore (TAJO-2117)
       * 12 - 2015-09-28: Change the variable name storeType to dataFormat (TAJO-1663)
       * 11 - 2015-09-23: Add contents length and file count for partition directory (TAJO-1493)
@@ -82,9 +83,7 @@
           TID INT NOT NULL,
           COLUMN_NAME VARCHAR(255) BINARY NOT NULL,
           ORDINAL_POSITION INT NOT NULL,
-          NESTED_FIELD_NUM INT NOT NULL,
-          DATA_TYPE CHAR(16),
-          TYPE_LENGTH INTEGER,
+          DATA_TYPE VARCHAR(8192),
           PRIMARY KEY (TID, ORDINAL_POSITION),
           FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
         )]]>

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/mysql.xml
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/mysql.xml b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/mysql.xml
index c0dadaa..177f1ae 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/mysql.xml
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/mysql/mysql.xml
@@ -19,6 +19,7 @@
 <tns:store xmlns:tns="http://tajo.apache.org/catalogstore" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.xsd ">
   <!--
     Catalog base version history
+    * 13 - 2016-05-10: Apply new type implementation to Schema and Catalog. (TAJO-2129)
     * 12 - 2015-09-28: Change the variable name storeType to dataFormat (TAJO-1663)
     * 11 - 2015-09-23: Add contents length and file count for partition directory (TAJO-1493)
     * 10 - 2015-09-22: Well support for self-describing data formats (TAJO-1832)
@@ -81,9 +82,7 @@
           TID INT NOT NULL,
           COLUMN_NAME VARCHAR(255) BINARY NOT NULL,
           ORDINAL_POSITION INT NOT NULL,
-          NESTED_FIELD_NUM INT NOT NULL,
-          DATA_TYPE CHAR(16),
-          TYPE_LENGTH INTEGER,
+          DATA_TYPE VARCHAR(8192),
           PRIMARY KEY (TID, ORDINAL_POSITION),
           FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
         )]]>

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
index 190270c..7caa941 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/oracle/oracle.xml
@@ -19,6 +19,7 @@
 <tns:store xmlns:tns="http://tajo.apache.org/catalogstore" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.xsd ">
   <!--
       Catalog base version history
+      * 13 - 2016-05-10: Apply new type implementation to Schema and Catalog. (TAJO-2129)
       * 12 - 2015-09-28: Change the variable name storeType to dataFormat (TAJO-1663)
       * 11 - 2015-09-23: Add contents length and file count for partition directory (TAJO-1493)
       * 10 - 2015-09-22: Well support for self-describing data formats (TAJO-1832)
@@ -134,9 +135,7 @@
 					TID INT NOT NULL,
 					COLUMN_NAME VARCHAR2(255) NOT NULL,
 					ORDINAL_POSITION INT NOT NULL,
-					NESTED_FIELD_NUM INT NOT NULL,
-					DATA_TYPE CHAR(16),
-					TYPE_LENGTH INTEGER,
+					DATA_TYPE VARCHAR(8192),
 					CONSTRAINT COLUMNS_PKEY PRIMARY KEY (TID, ORDINAL_POSITION),
 					FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
 				)]]>

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/postgresql/postgresql.xml
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/postgresql/postgresql.xml b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/postgresql/postgresql.xml
index 33a1fd2..f5678e9 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/postgresql/postgresql.xml
+++ b/tajo-catalog/tajo-catalog-server/src/main/resources/schemas/postgresql/postgresql.xml
@@ -21,6 +21,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.xsd ">
   <!--
       Catalog base version history
+      * 13 - 2016-05-10: Apply new type implementation to Schema and Catalog. (TAJO-2129)
       * 12 - 2015-09-28: Change the variable name storeType to dataFormat (TAJO-1663)
       * 11 - 2015-09-23: Add contents length and file count for partition directory (TAJO-1493)
       * 10 - 2015-09-22: Well support for self-describing data formats (TAJO-1832)
@@ -94,9 +95,7 @@ xsi:schemaLocation="http://tajo.apache.org/catalogstore ../DBMSSchemaDefinition.
   				TID INT NOT NULL,
   				COLUMN_NAME VARCHAR(255) NOT NULL,
   				ORDINAL_POSITION INT NOT NULL,
-  				NESTED_FIELD_NUM INT NOT NULL,
-  				DATA_TYPE CHAR(16),
-  				TYPE_LENGTH INTEGER,
+  				DATA_TYPE VARCHAR(8192),
   				CONSTRAINT COLUMNS_PKEY PRIMARY KEY (TID, ORDINAL_POSITION),
   				FOREIGN KEY (TID) REFERENCES TABLES (TID) ON DELETE CASCADE
 				)]]>

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/CatalogTestingUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/CatalogTestingUtil.java b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/CatalogTestingUtil.java
index 3305801..0b69de0 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/CatalogTestingUtil.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/CatalogTestingUtil.java
@@ -33,6 +33,7 @@ import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.conf.TajoConf.ConfVars;
 import org.apache.tajo.exception.UnsupportedCatalogStore;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.util.KeyValueSet;
 
 import java.io.IOException;
@@ -184,10 +185,10 @@ public class CatalogTestingUtil {
   }
 
   public static void cleanupBaseData(CatalogService catalog) throws Exception {
-    catalog.dropTable(CatalogUtil.buildFQName("TestDatabase1", "testPartition1"));
-    catalog.dropTable(CatalogUtil.buildFQName("TestDatabase1", "TestPartition1"));
-    catalog.dropTable(CatalogUtil.buildFQName("TestDatabase1", "TestTable1"));
-    catalog.dropTable(CatalogUtil.buildFQName("TestDatabase1", "testTable1"));
+    catalog.dropTable(IdentifierUtil.buildFQName("TestDatabase1", "testPartition1"));
+    catalog.dropTable(IdentifierUtil.buildFQName("TestDatabase1", "TestPartition1"));
+    catalog.dropTable(IdentifierUtil.buildFQName("TestDatabase1", "TestTable1"));
+    catalog.dropTable(IdentifierUtil.buildFQName("TestDatabase1", "testTable1"));
 
     catalog.dropDatabase("TestDatabase1");
     catalog.dropDatabase("testDatabase1");
@@ -198,13 +199,13 @@ public class CatalogTestingUtil {
 
   public static TableDesc buildTableDesc(String databaseName, String tableName, String testDir) throws IOException {
     Schema schema = SchemaBuilder.builder()
-        .add(CatalogUtil.buildFQName(tableName, "Column"), Type.BLOB)
-        .add(CatalogUtil.buildFQName(tableName, "column"), Type.INT4)
-        .add(CatalogUtil.buildFQName(tableName, "cOlumn"), Type.INT8)
+        .add(IdentifierUtil.buildFQName(tableName, "Column"), Type.BLOB)
+        .add(IdentifierUtil.buildFQName(tableName, "column"), Type.INT4)
+        .add(IdentifierUtil.buildFQName(tableName, "cOlumn"), Type.INT8)
         .build();
     Path path = new Path(testDir + "/" + UUID.randomUUID().toString(), tableName);
     TableDesc desc = new TableDesc(
-        CatalogUtil.buildFQName(databaseName, tableName),
+        IdentifierUtil.buildFQName(databaseName, tableName),
         schema,
         new TableMeta("TEXT", new KeyValueSet()),
         path.toUri(), true);
@@ -215,8 +216,8 @@ public class CatalogTestingUtil {
 
   public static TableDesc buildPartitionTableDesc(String databaseName, String tableName, String testDir) throws Exception {
     Schema partSchema = SchemaBuilder.builder()
-        .add(CatalogUtil.buildFQName(tableName, "DaTe"), Type.TEXT)
-        .add(CatalogUtil.buildFQName(tableName, "dAtE"), Type.TEXT)
+        .add(IdentifierUtil.buildFQName(tableName, "DaTe"), Type.TEXT)
+        .add(IdentifierUtil.buildFQName(tableName, "dAtE"), Type.TEXT)
         .build();
     PartitionMethodDesc partitionMethodDesc =
         new PartitionMethodDesc(DEFAULT_DATABASE_NAME, tableName,
@@ -254,7 +255,7 @@ public class CatalogTestingUtil {
     for (int i = 0; i < cols.length; i++) {
       colSpecs[i] = new SortSpec(cols[i], true, false);
     }
-    return new IndexDesc(databaseName, CatalogUtil.extractSimpleName(table.getName()),
+    return new IndexDesc(databaseName, IdentifierUtil.extractSimpleName(table.getName()),
         indexName, new URI("idx_test"), colSpecs,
         IndexMethod.TWO_LEVEL_BIN_TREE, true, true, table.getSchema());
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/MiniCatalogServer.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/MiniCatalogServer.java b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/MiniCatalogServer.java
index da375b2..edba45c 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/MiniCatalogServer.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/MiniCatalogServer.java
@@ -21,6 +21,7 @@ package org.apache.tajo.catalog;
 import org.apache.tajo.TajoConstants;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.exception.*;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.util.CommonTestingUtil;
 
 import java.io.IOException;
@@ -83,7 +84,7 @@ public class MiniCatalogServer extends CatalogServer {
   public void cleanup() throws UndefinedTableException, InsufficientPrivilegeException, UndefinedDatabaseException,
       UndefinedTablespaceException {
     for (String table : catalog.getAllTableNames(DEFAULT_DATABASE_NAME)) {
-      catalog.dropTable(CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, table));
+      catalog.dropTable(IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, table));
     }
     for (String database : catalog.getAllDatabaseNames()) {
       if (!database.equals(TajoConstants.DEFAULT_DATABASE_NAME) &&

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
index 14d6e30..f0cb208 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
@@ -33,6 +33,7 @@ import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.exception.TajoException;
 import org.apache.tajo.exception.UndefinedFunctionException;
 import org.apache.tajo.function.Function;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.KeyValueSet;
 import org.apache.tajo.util.TUtil;
@@ -189,7 +190,7 @@ public class TestCatalog {
         .build();
     Path path = new Path(CommonTestingUtil.getTestDir(), tableName);
     TableDesc table = new TableDesc(
-        CatalogUtil.buildFQName(databaseName, tableName),
+        IdentifierUtil.buildFQName(databaseName, tableName),
         schema1,
         new TableMeta("TEXT", new KeyValueSet()),
         path.toUri(), true);
@@ -290,7 +291,7 @@ public class TestCatalog {
         Collection<String> tablesForThisDatabase = catalog.getAllTableNames(entry.getKey());
         assertEquals(createdTablesMap.get(entry.getKey()).size(), tablesForThisDatabase.size());
         for (String tableName : tablesForThisDatabase) {
-          assertTrue(createdTablesMap.get(entry.getKey()).contains(CatalogUtil.extractSimpleName(tableName)));
+          assertTrue(createdTablesMap.get(entry.getKey()).contains(IdentifierUtil.extractSimpleName(tableName)));
         }
       }
     }
@@ -308,7 +309,7 @@ public class TestCatalog {
         .build();
     Path path = new Path(CommonTestingUtil.getTestDir(), "table1");
     TableDesc meta = new TableDesc(
-        CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, "getTable"),
+        IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, "getTable"),
         schema1,
         "TEXT",
         new KeyValueSet(),
@@ -318,7 +319,7 @@ public class TestCatalog {
     catalog.createTable(meta);
     assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, "getTable"));
 
-    catalog.dropTable(CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, "getTable"));
+    catalog.dropTable(IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, "getTable"));
     assertFalse(catalog.existsTable(DEFAULT_DATABASE_NAME, "getTable"));
 	}
 
@@ -328,7 +329,7 @@ public class TestCatalog {
   private static void assertSchemaEquality(String tableName, Schema schema) throws IOException, TajoException {
     Path path = new Path(CommonTestingUtil.getTestDir(), tableName);
     TableDesc tableDesc = new TableDesc(
-        CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName),
+        IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName),
         schema,
         "TEXT",
         new KeyValueSet(),
@@ -340,12 +341,12 @@ public class TestCatalog {
     assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     // change it for the equals test.
-    schema.setQualifier(CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName));
+    schema.setQualifier(IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName));
     TableDesc restored = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
     assertEquals(schema, restored.getSchema());
 
     // drop test
-    catalog.dropTable(CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName));
+    catalog.dropTable(IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName));
     assertFalse(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
   }
 
@@ -436,7 +437,7 @@ public class TestCatalog {
 
     TableMeta meta = CatalogUtil.newTableMeta(BuiltinStorages.TEXT, server.getConf());
     return new TableDesc(
-        CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, tableName), relationSchema, meta,
+        IdentifierUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, tableName), relationSchema, meta,
         new Path(CommonTestingUtil.getTestDir(), "indexed").toUri());
   }
 
@@ -632,7 +633,7 @@ public class TestCatalog {
         .add("score", Type.FLOAT8)
         .build();
 
-    String tableName = CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, "addedtable");
+    String tableName = IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, "addedtable");
     KeyValueSet opts = new KeyValueSet();
     opts.set("file.delimiter", ",");
     TableMeta meta = CatalogUtil.newTableMeta("TEXT", opts);
@@ -674,7 +675,7 @@ public class TestCatalog {
         .add("score", Type.FLOAT8)
         .build();
 
-    String tableName = CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, "addedtable");
+    String tableName = IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, "addedtable");
     KeyValueSet opts = new KeyValueSet();
     opts.set("file.delimiter", ",");
     TableMeta meta = CatalogUtil.newTableMeta("TEXT", opts);
@@ -714,7 +715,7 @@ public class TestCatalog {
         .add("score", Type.FLOAT8)
         .build();
 
-    String tableName = CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, "addedtable");
+    String tableName = IdentifierUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, "addedtable");
     KeyValueSet opts = new KeyValueSet();
     opts.set("file.delimiter", ",");
     TableMeta meta = CatalogUtil.newTableMeta("TEXT", opts);
@@ -753,7 +754,7 @@ public class TestCatalog {
         .add("score", Type.FLOAT8)
         .build();
 
-    String tableName = CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, "addedtable");
+    String tableName = IdentifierUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, "addedtable");
     KeyValueSet opts = new KeyValueSet();
     opts.set("file.delimiter", ",");
     TableMeta meta = CatalogUtil.newTableMeta("TEXT", opts);
@@ -793,7 +794,7 @@ public class TestCatalog {
         .build();
 
     String simpleTableName = "addedtable";
-    String tableName = CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, simpleTableName);
+    String tableName = IdentifierUtil.buildFQName(DEFAULT_DATABASE_NAME, simpleTableName);
     KeyValueSet opts = new KeyValueSet();
     opts.set("file.delimiter", ",");
     TableMeta meta = CatalogUtil.newTableMeta("TEXT", opts);
@@ -944,7 +945,7 @@ public class TestCatalog {
 
     catalog.alterTable(alterTableDesc);
 
-    String [] split = CatalogUtil.splitFQTableName(tableName);
+    String [] split = IdentifierUtil.splitFQTableName(tableName);
 
     CatalogProtos.PartitionDescProto resultDesc = catalog.getPartition(split[0], split[1], partitionName);
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalogAgainstCaseSensitivity.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalogAgainstCaseSensitivity.java b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalogAgainstCaseSensitivity.java
index 6b7e458..cab2e49 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalogAgainstCaseSensitivity.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalogAgainstCaseSensitivity.java
@@ -27,6 +27,7 @@ import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.exception.UndefinedPartitionException;
 import org.apache.tajo.exception.UndefinedTableException;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -112,7 +113,7 @@ public class TestCatalogAgainstCaseSensitivity {
       tableDescs.put(desc.getName(), desc);
     }
     for (TableDescriptorProto eachTableDescriptor : catalog.getAllTables()) {
-      String qualifiedTableName = CatalogUtil.buildFQName("TestDatabase1", eachTableDescriptor.getName());
+      String qualifiedTableName = IdentifierUtil.buildFQName("TestDatabase1", eachTableDescriptor.getName());
       assertTrue(tableDescs.containsKey(qualifiedTableName));
       TableDesc desc = tableDescs.get(qualifiedTableName);
       assertEquals(desc.getUri().toString(), eachTableDescriptor.getPath());
@@ -129,13 +130,13 @@ public class TestCatalogAgainstCaseSensitivity {
 
     AlterTableDesc alterTableDesc = new AlterTableDesc();
     alterTableDesc.setAlterTableType(AlterTableType.RENAME_TABLE);
-    alterTableDesc.setNewTableName(CatalogUtil.buildFQName("TestDatabase1", "renamed_table"));
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "newTable"));
+    alterTableDesc.setNewTableName(IdentifierUtil.buildFQName("TestDatabase1", "renamed_table"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "newTable"));
     catalog.alterTable(alterTableDesc);
 
     assertFalse(catalog.existsTable("TestDatabase1", "newTable"));
     assertTrue(catalog.existsTable("TestDatabase1", "renamed_table"));
-    catalog.dropTable(CatalogUtil.buildFQName("TestDatabase1", "renamed_table"));
+    catalog.dropTable(IdentifierUtil.buildFQName("TestDatabase1", "renamed_table"));
 
     //////////////////////////////////////////////////////////////////////////////
     // table stats
@@ -177,7 +178,7 @@ public class TestCatalogAgainstCaseSensitivity {
     PartitionDesc partitionDesc = CatalogTestingUtil.buildPartitionDesc(partitionName);
 
     AlterTableDesc alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestPartition1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestPartition1"));
     alterTableDesc.setPartitionDesc(partitionDesc);
     alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION);
 
@@ -195,7 +196,7 @@ public class TestCatalogAgainstCaseSensitivity {
     partitionDesc = CatalogTestingUtil.buildPartitionDesc(partitionName);
 
     alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestPartition1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestPartition1"));
     alterTableDesc.setPartitionDesc(partitionDesc);
     alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION);
 
@@ -243,7 +244,7 @@ public class TestCatalogAgainstCaseSensitivity {
     partitionDesc = CatalogTestingUtil.buildPartitionDesc(partitionName);
 
     alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestPartition1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestPartition1"));
     alterTableDesc.setPartitionDesc(partitionDesc);
     alterTableDesc.setAlterTableType(AlterTableType.DROP_PARTITION);
     catalog.alterTable(alterTableDesc);
@@ -259,7 +260,7 @@ public class TestCatalogAgainstCaseSensitivity {
     partitionDesc = CatalogTestingUtil.buildPartitionDesc(partitionName);
 
     alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestPartition1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestPartition1"));
     alterTableDesc.setPartitionDesc(partitionDesc);
     alterTableDesc.setAlterTableType(AlterTableType.DROP_PARTITION);
     catalog.alterTable(alterTableDesc);
@@ -282,32 +283,32 @@ public class TestCatalogAgainstCaseSensitivity {
     //////////////////////////////////////////////////////////////////////////////
 
     AlterTableDesc alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setAddColumn(new Column(CatalogUtil.buildFQName(databaseName, tableName, "AddedCol1"),
+    alterTableDesc.setAddColumn(new Column(IdentifierUtil.buildFQName(databaseName, tableName, "AddedCol1"),
         CatalogUtil.newSimpleDataType(Type.BLOB)));
-    alterTableDesc.setTableName(CatalogUtil.buildFQName(databaseName, tableName));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName(databaseName, tableName));
     alterTableDesc.setAlterTableType(AlterTableType.ADD_COLUMN);
     catalog.alterTable(alterTableDesc);
 
     TableDesc tableDesc = catalog.getTableDesc(databaseName, tableName);
     assertTrue(
-        tableDesc.getSchema().containsByQualifiedName(CatalogUtil.buildFQName(databaseName, tableName, "AddedCol1")));
+        tableDesc.getSchema().containsByQualifiedName(IdentifierUtil.buildFQName(databaseName, tableName, "AddedCol1")));
 
     //////////////////////////////////////////////////////////////////////////////
     // Test rename column
     //////////////////////////////////////////////////////////////////////////////
 
     alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setColumnName(CatalogUtil.buildFQName(databaseName, tableName, "AddedCol1"));
-    alterTableDesc.setNewColumnName(CatalogUtil.buildFQName(databaseName, tableName, "addedcol1"));
-    alterTableDesc.setTableName(CatalogUtil.buildFQName(databaseName, tableName));
+    alterTableDesc.setColumnName(IdentifierUtil.buildFQName(databaseName, tableName, "AddedCol1"));
+    alterTableDesc.setNewColumnName(IdentifierUtil.buildFQName(databaseName, tableName, "addedcol1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName(databaseName, tableName));
     alterTableDesc.setAlterTableType(AlterTableType.RENAME_COLUMN);
     catalog.alterTable(alterTableDesc);
 
     tableDesc = catalog.getTableDesc(databaseName, tableName);
     assertFalse(
-        tableDesc.getSchema().containsByQualifiedName(CatalogUtil.buildFQName(databaseName, tableName, "AddedCol1")));
+        tableDesc.getSchema().containsByQualifiedName(IdentifierUtil.buildFQName(databaseName, tableName, "AddedCol1")));
     assertTrue(
-        tableDesc.getSchema().containsByQualifiedName(CatalogUtil.buildFQName(databaseName, tableName, "addedcol1")));
+        tableDesc.getSchema().containsByQualifiedName(IdentifierUtil.buildFQName(databaseName, tableName, "addedcol1")));
 
     //////////////////////////////////////////////////////////////////////////////
     // Test get all columns
@@ -351,7 +352,7 @@ public class TestCatalogAgainstCaseSensitivity {
             .add("RecoRd1", new TypeDesc(schema)).build())).build();
 
     TableDesc tableDesc = new TableDesc(
-        CatalogUtil.buildFQName(databaseName, tableName),
+        IdentifierUtil.buildFQName(databaseName, tableName),
         tableSchema,
         CatalogUtil.newTableMeta(BuiltinStorages.JSON, server.getConf()),
         URI.create("hdfs://xxx.com/json_Table")
@@ -409,7 +410,7 @@ public class TestCatalogAgainstCaseSensitivity {
     
     int expected = 0;
     for (String eachTableName : catalog.getAllTableNames(databaseName)) {
-      expected += catalog.getTableDesc(databaseName, eachTableName).getSchema().getAllColumns().size();
+      expected += catalog.getTableDesc(databaseName, eachTableName).getSchema().getRootColumns().size();
     }
     assertEquals(expected, columnCount);
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalogExceptions.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalogExceptions.java b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalogExceptions.java
index 8ba3d59..3b90e21 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalogExceptions.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalogExceptions.java
@@ -29,6 +29,7 @@ import org.apache.tajo.catalog.proto.CatalogProtos.TableStatsProto;
 import org.apache.tajo.catalog.proto.CatalogProtos.UpdateTableStatsProto;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.exception.*;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.KeyValueSet;
 import org.junit.AfterClass;
@@ -116,14 +117,14 @@ public class TestCatalogExceptions {
     // TODO: currently, wrong uri does not occur any exception.
     String tableName = "wrongUri";
     Schema schema = SchemaBuilder.builder()
-        .add(CatalogUtil.buildFQName(tableName, "Column"), Type.BLOB)
-        .add(CatalogUtil.buildFQName(tableName, "column"), Type.INT4)
-        .add(CatalogUtil.buildFQName(tableName, "cOlumn"), Type.INT8)
+        .add(IdentifierUtil.buildFQName(tableName, "Column"), Type.BLOB)
+        .add(IdentifierUtil.buildFQName(tableName, "column"), Type.INT4)
+        .add(IdentifierUtil.buildFQName(tableName, "cOlumn"), Type.INT8)
         .build();
     Path path = new Path(CommonTestingUtil.getTestDir(), tableName);
     catalog.createTable(
       new TableDesc(
-        CatalogUtil.buildFQName("TestDatabase1", tableName),
+        IdentifierUtil.buildFQName("TestDatabase1", tableName),
         schema,
         new TableMeta("TEXT", new KeyValueSet()),
         path.toUri(), true));
@@ -137,19 +138,19 @@ public class TestCatalogExceptions {
 
   @Test(expected = UndefinedDatabaseException.class)
   public void dropTableOfUndefinedDatabase() throws Exception {
-    catalog.dropTable(CatalogUtil.buildFQName("undefined", "testPartition1"));
+    catalog.dropTable(IdentifierUtil.buildFQName("undefined", "testPartition1"));
   }
 
   @Test(expected = UndefinedTableException.class)
   public void dropUndefinedTable() throws Exception {
-    catalog.dropTable(CatalogUtil.buildFQName("TestDatabase1", "undefined"));
+    catalog.dropTable(IdentifierUtil.buildFQName("TestDatabase1", "undefined"));
   }
 
   @Test(expected = UndefinedTableException.class)
   public void testUpdateTableStatsOfUndefinedTable() throws Exception {
     catalog.updateTableStats(
       UpdateTableStatsProto.newBuilder().
-        setTableName(CatalogUtil.buildFQName("TestDatabase1", "undefined")).
+        setTableName(IdentifierUtil.buildFQName("TestDatabase1", "undefined")).
         setStats(
           TableStatsProto.newBuilder().
             setNumRows(0).
@@ -165,7 +166,7 @@ public class TestCatalogExceptions {
     PartitionDesc partitionDesc = CatalogTestingUtil.buildPartitionDesc(partitionName);
 
     AlterTableDesc alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestPartition1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestPartition1"));
     alterTableDesc.setPartitionDesc(partitionDesc);
     alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION);
 
@@ -178,7 +179,7 @@ public class TestCatalogExceptions {
     PartitionDesc partitionDesc = CatalogTestingUtil.buildPartitionDesc(partitionName);
 
     AlterTableDesc alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestPartition1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestPartition1"));
     alterTableDesc.setPartitionDesc(partitionDesc);
     alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION);
 
@@ -188,7 +189,7 @@ public class TestCatalogExceptions {
     partitionDesc = CatalogTestingUtil.buildPartitionDesc(partitionName);
 
     alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestPartition1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestPartition1"));
     alterTableDesc.setPartitionDesc(partitionDesc);
     alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION);
 
@@ -201,7 +202,7 @@ public class TestCatalogExceptions {
     PartitionDesc partitionDesc = CatalogTestingUtil.buildPartitionDesc(partitionName);
 
     AlterTableDesc alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "undefined"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "undefined"));
     alterTableDesc.setPartitionDesc(partitionDesc);
     alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION);
 
@@ -215,7 +216,7 @@ public class TestCatalogExceptions {
     PartitionDesc partitionDesc = CatalogTestingUtil.buildPartitionDesc(partitionName);
 
     AlterTableDesc alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestPartition1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestPartition1"));
     alterTableDesc.setPartitionDesc(partitionDesc);
     alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION);
 
@@ -228,7 +229,7 @@ public class TestCatalogExceptions {
     PartitionDesc partitionDesc = CatalogTestingUtil.buildPartitionDesc(partitionName);
 
     AlterTableDesc alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestPartition1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestPartition1"));
     alterTableDesc.setPartitionDesc(partitionDesc);
     alterTableDesc.setAlterTableType(AlterTableType.DROP_PARTITION);
     catalog.alterTable(alterTableDesc);
@@ -238,17 +239,17 @@ public class TestCatalogExceptions {
   public void testRenameUndefinedTable() throws Exception {
     AlterTableDesc alterTableDesc = new AlterTableDesc();
     alterTableDesc.setAlterTableType(AlterTableType.RENAME_TABLE);
-    alterTableDesc.setNewTableName(CatalogUtil.buildFQName("TestDatabase1", "renamed_table"));
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "undefined"));
+    alterTableDesc.setNewTableName(IdentifierUtil.buildFQName("TestDatabase1", "renamed_table"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "undefined"));
     catalog.alterTable(alterTableDesc);
   }
 
   @Test(expected = UndefinedTableException.class)
   public void testRenameColumnOfUndefinedTable() throws Exception {
     AlterTableDesc alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setColumnName(CatalogUtil.buildFQName("TestDatabase1", "undefined", "AddedCol1"));
-    alterTableDesc.setNewColumnName(CatalogUtil.buildFQName("TestDatabase1", "undefined", "addedcol1"));
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "undefined"));
+    alterTableDesc.setColumnName(IdentifierUtil.buildFQName("TestDatabase1", "undefined", "AddedCol1"));
+    alterTableDesc.setNewColumnName(IdentifierUtil.buildFQName("TestDatabase1", "undefined", "addedcol1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "undefined"));
     alterTableDesc.setAlterTableType(AlterTableType.RENAME_COLUMN);
     catalog.alterTable(alterTableDesc);
   }
@@ -256,9 +257,9 @@ public class TestCatalogExceptions {
   @Test(expected = UndefinedColumnException.class)
   public void testRenameUndefinedColumn() throws Exception {
     AlterTableDesc alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setColumnName(CatalogUtil.buildFQName("TestDatabase1", "TestTable1", "undefined"));
-    alterTableDesc.setNewColumnName(CatalogUtil.buildFQName("TestDatabase1", "TestTable1", "undefined"));
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestTable1"));
+    alterTableDesc.setColumnName(IdentifierUtil.buildFQName("TestDatabase1", "TestTable1", "undefined"));
+    alterTableDesc.setNewColumnName(IdentifierUtil.buildFQName("TestDatabase1", "TestTable1", "undefined"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestTable1"));
     alterTableDesc.setAlterTableType(AlterTableType.RENAME_COLUMN);
     catalog.alterTable(alterTableDesc);
   }
@@ -266,9 +267,9 @@ public class TestCatalogExceptions {
   @Test(expected = DuplicateColumnException.class)
   public void testAddDuplicateColumn() throws Exception {
     AlterTableDesc alterTableDesc = new AlterTableDesc();
-    alterTableDesc.setAddColumn(new Column(CatalogUtil.buildFQName("TestDatabase1", "TestTable1", "cOlumn"),
+    alterTableDesc.setAddColumn(new Column(IdentifierUtil.buildFQName("TestDatabase1", "TestTable1", "cOlumn"),
         CatalogUtil.newSimpleDataType(Type.BLOB)));
-    alterTableDesc.setTableName(CatalogUtil.buildFQName("TestDatabase1", "TestTable1"));
+    alterTableDesc.setTableName(IdentifierUtil.buildFQName("TestDatabase1", "TestTable1"));
     alterTableDesc.setAlterTableType(AlterTableType.ADD_COLUMN);
     catalog.alterTable(alterTableDesc);
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoDump.java
----------------------------------------------------------------------
diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoDump.java b/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoDump.java
index f2df0cd..7eb50bb 100644
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoDump.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tools/TajoDump.java
@@ -26,6 +26,7 @@ import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.client.TajoClient;
 import org.apache.tajo.client.TajoClientImpl;
 import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.service.ServiceTrackerFactory;
 import org.apache.tajo.util.NetUtils;
 import org.apache.tajo.util.Pair;
@@ -164,10 +165,10 @@ public class TajoDump {
       throws SQLException, ServiceException {
     writer.write("\n");
     writer.write("--\n");
-    writer.write(String.format("-- Database name: %s%n", CatalogUtil.denormalizeIdentifier(databaseName)));
+    writer.write(String.format("-- Database name: %s%n", IdentifierUtil.denormalizeIdentifier(databaseName)));
     writer.write("--\n");
     writer.write("\n");
-    writer.write(String.format("CREATE DATABASE IF NOT EXISTS %s;", CatalogUtil.denormalizeIdentifier(databaseName)));
+    writer.write(String.format("CREATE DATABASE IF NOT EXISTS %s;", IdentifierUtil.denormalizeIdentifier(databaseName)));
     writer.write("\n\n");
 
     // returned list is immutable.
@@ -175,7 +176,7 @@ public class TajoDump {
     Collections.sort(tableNames);
     for (String tableName : tableNames) {
       try {
-        String fqName = CatalogUtil.buildFQName(databaseName, tableName);
+        String fqName = IdentifierUtil.buildFQName(databaseName, tableName);
         TableDesc table = client.getTableDesc(fqName);
 
         if (table.getMeta().getDataFormat().equalsIgnoreCase("SYSTEM")) {
@@ -198,7 +199,7 @@ public class TajoDump {
 //            writer.write(DDLBuilder.buildDDLForAddPartition(table, eachPartitionProto));
 //          }
           writer.write(String.format("ALTER TABLE %s REPAIR PARTITION;",
-            CatalogUtil.denormalizeIdentifier(databaseName) + "." + CatalogUtil.denormalizeIdentifier(tableName)));
+            IdentifierUtil.denormalizeIdentifier(databaseName) + "." + IdentifierUtil.denormalizeIdentifier(tableName)));
 
           writer.write("\n\n");
         }

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/DescTableCommand.java
----------------------------------------------------------------------
diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/DescTableCommand.java b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/DescTableCommand.java
index 43fcf2e..9632b66 100644
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/DescTableCommand.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/commands/DescTableCommand.java
@@ -24,7 +24,6 @@ import jline.console.completer.StringsCompleter;
 import org.apache.commons.lang.CharUtils;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.tajo.TajoConstants;
-import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.catalog.TableDesc;
 import org.apache.tajo.catalog.partition.PartitionMethodDesc;
@@ -32,6 +31,7 @@ import org.apache.tajo.catalog.proto.CatalogProtos.IndexDescProto;
 import org.apache.tajo.catalog.proto.CatalogProtos.SortSpecProto;
 import org.apache.tajo.cli.tsql.TajoCli;
 import org.apache.tajo.exception.TajoException;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.util.FileUtil;
 import org.apache.tajo.util.StringUtils;
 
@@ -72,7 +72,7 @@ public class DescTableCommand extends TajoShellCommand {
             sb.append("\"").append(index.getIndexName()).append("\" ");
             sb.append(index.getIndexMethod()).append(" (");
             for (SortSpecProto key : index.getKeySortSpecsList()) {
-              sb.append(CatalogUtil.extractSimpleName(key.getColumn().getName()));
+              sb.append(IdentifierUtil.extractSimpleName(key.getColumn().getName()));
               sb.append(key.getAscending() ? " ASC" : " DESC");
               sb.append(key.getNullFirst() ? " NULLS FIRST, " : " NULLS LAST, ");
             }

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-client/src/main/java/org/apache/tajo/jdbc/TajoResultSetMetaData.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/jdbc/TajoResultSetMetaData.java b/tajo-client/src/main/java/org/apache/tajo/jdbc/TajoResultSetMetaData.java
index 8811c13..2f654cd 100644
--- a/tajo-client/src/main/java/org/apache/tajo/jdbc/TajoResultSetMetaData.java
+++ b/tajo-client/src/main/java/org/apache/tajo/jdbc/TajoResultSetMetaData.java
@@ -21,12 +21,12 @@
  */
 package org.apache.tajo.jdbc;
 
-import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.client.ResultSetUtil;
 import org.apache.tajo.common.TajoDataTypes.DataType;
 import org.apache.tajo.common.type.TajoTypeUtil;
+import org.apache.tajo.schema.IdentifierUtil;
 
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
@@ -53,8 +53,8 @@ public class TajoResultSetMetaData implements ResultSetMetaData {
   @Override
   public String getCatalogName(int column) throws SQLException {
     Column c = schema.getColumn(column - 1);
-    if (CatalogUtil.isFQColumnName(c.getQualifiedName())) {
-      return CatalogUtil.splitFQTableName(c.getQualifier())[0];
+    if (IdentifierUtil.isFQColumnName(c.getQualifiedName())) {
+      return IdentifierUtil.splitFQTableName(c.getQualifier())[0];
     }
     return "";
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-cluster-tests/src/test/java/org/apache/tajo/LocalTajoTestingUtility.java
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/java/org/apache/tajo/LocalTajoTestingUtility.java b/tajo-cluster-tests/src/test/java/org/apache/tajo/LocalTajoTestingUtility.java
index 9816064..282d389 100644
--- a/tajo-cluster-tests/src/test/java/org/apache/tajo/LocalTajoTestingUtility.java
+++ b/tajo-cluster-tests/src/test/java/org/apache/tajo/LocalTajoTestingUtility.java
@@ -36,6 +36,7 @@ import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.engine.planner.global.MasterPlan;
 import org.apache.tajo.engine.query.QueryContext;
 import org.apache.tajo.exception.TajoException;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.session.Session;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.FileUtil;
@@ -120,7 +121,7 @@ public class LocalTajoTestingUtility {
       TableStats stats = new TableStats();
       stats.setNumBytes(TPCH.tableVolumes.get(names[i]));
       TableDesc tableDesc = new TableDesc(
-          CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, names[i]), schemas[i], meta,
+          IdentifierUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, names[i]), schemas[i], meta,
           tablePath.toUri());
       tableDesc.setStats(stats);
       util.getMaster().getCatalog().createTable(tableDesc);

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java b/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
index aebd7b9..315f954 100644
--- a/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
+++ b/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
@@ -31,7 +31,6 @@ import org.apache.hadoop.fs.Path;
 import org.apache.tajo.algebra.*;
 import org.apache.tajo.annotation.Nullable;
 import org.apache.tajo.catalog.CatalogService;
-import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.TableDesc;
 import org.apache.tajo.cli.tsql.InvalidStatementException;
 import org.apache.tajo.cli.tsql.ParsedResult;
@@ -53,6 +52,7 @@ import org.apache.tajo.plan.LogicalPlanner;
 import org.apache.tajo.plan.verifier.LogicalPlanVerifier;
 import org.apache.tajo.plan.verifier.PreLogicalPlanVerifier;
 import org.apache.tajo.plan.verifier.VerificationState;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.storage.BufferPool;
 import org.apache.tajo.storage.StorageUtil;
 import org.apache.tajo.util.FileUtil;
@@ -221,7 +221,7 @@ public class QueryTestCaseBase {
   @AfterClass
   public static void tearDownClass() throws Exception {
     for (String tableName : createdTableGlobalSet) {
-      client.updateQuery("DROP TABLE IF EXISTS " + CatalogUtil.denormalizeIdentifier(tableName));
+      client.updateQuery("DROP TABLE IF EXISTS " + IdentifierUtil.denormalizeIdentifier(tableName));
     }
     createdTableGlobalSet.clear();
 
@@ -303,7 +303,7 @@ public class QueryTestCaseBase {
     try {
       // if the current database is "default", we don't need create it because it is already prepated at startup time.
       if (!currentDatabase.equals(TajoConstants.DEFAULT_DATABASE_NAME)) {
-        client.updateQuery("CREATE DATABASE IF NOT EXISTS " + CatalogUtil.denormalizeIdentifier(currentDatabase));
+        client.updateQuery("CREATE DATABASE IF NOT EXISTS " + IdentifierUtil.denormalizeIdentifier(currentDatabase));
       }
       client.selectDatabase(currentDatabase);
       currentResultFS = currentResultPath.getFileSystem(testBase.getTestingCluster().getConfiguration());
@@ -1047,10 +1047,10 @@ public class QueryTestCaseBase {
         DropTable dropTable = (DropTable) expr;
         String tableName = dropTable.getTableName();
         assertTrue("table '" + tableName + "' existence check",
-            client.existTable(CatalogUtil.buildFQName(currentDatabase, tableName)));
+            client.existTable(IdentifierUtil.buildFQName(currentDatabase, tableName)));
         assertTrue("table drop is failed.", client.updateQuery(parsedResult.getHistoryStatement()));
         assertFalse("table '" + tableName + "' dropped check",
-            client.existTable(CatalogUtil.buildFQName(currentDatabase, tableName)));
+            client.existTable(IdentifierUtil.buildFQName(currentDatabase, tableName)));
         if (isLocalTable) {
           createdTableGlobalSet.remove(tableName);
         }

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-cluster-tests/src/test/java/org/apache/tajo/TajoTestingCluster.java
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/java/org/apache/tajo/TajoTestingCluster.java b/tajo-cluster-tests/src/test/java/org/apache/tajo/TajoTestingCluster.java
index 8de4cb9..4b89c8e 100644
--- a/tajo-cluster-tests/src/test/java/org/apache/tajo/TajoTestingCluster.java
+++ b/tajo-cluster-tests/src/test/java/org/apache/tajo/TajoTestingCluster.java
@@ -45,10 +45,10 @@ import org.apache.tajo.querymaster.Query;
 import org.apache.tajo.querymaster.QueryMasterTask;
 import org.apache.tajo.querymaster.Stage;
 import org.apache.tajo.querymaster.StageState;
+import org.apache.tajo.schema.IdentifierUtil;
 import org.apache.tajo.service.ServiceTrackerFactory;
 import org.apache.tajo.storage.FileTablespace;
 import org.apache.tajo.storage.TablespaceManager;
-import org.apache.tajo.util.KeyValueSet;
 import org.apache.tajo.util.NetUtils;
 import org.apache.tajo.util.Pair;
 import org.apache.tajo.util.history.QueryHistory;
@@ -63,7 +63,6 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.TimeZone;
 import java.util.UUID;
 
 public class TajoTestingCluster {
@@ -652,8 +651,8 @@ public class TajoTestingCluster {
         fs.mkdirs(rootDir);
       }
       Path tablePath;
-      if (CatalogUtil.isFQTableName(tableName)) {
-        Pair<String, String> name = CatalogUtil.separateQualifierAndName(tableName);
+      if (IdentifierUtil.isFQTableName(tableName)) {
+        Pair<String, String> name = IdentifierUtil.separateQualifierAndName(tableName);
         tablePath = new Path(rootDir, new Path(name.getFirst(), name.getSecond()));
       } else {
         tablePath = new Path(rootDir, tableName);

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-common/src/main/java/org/apache/tajo/Assert.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/Assert.java b/tajo-common/src/main/java/org/apache/tajo/Assert.java
new file mode 100644
index 0000000..b5e05ad
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/Assert.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo;
+
+import org.apache.tajo.exception.TajoInternalError;
+
+public class Assert {
+
+  public static void assertNotNull(Object obj) {
+    if (obj == null) {
+      throw new TajoInternalError("The argument must not be NULL.");
+    }
+  }
+
+  public static void assertCondition(boolean condition, String message, Object... arguments) {
+    if (!condition) {
+      throw new TajoInternalError(String.format(message, arguments));
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-common/src/main/java/org/apache/tajo/exception/InvalidValueForCastException.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/exception/InvalidValueForCastException.java b/tajo-common/src/main/java/org/apache/tajo/exception/InvalidValueForCastException.java
index 6af8d1a..63ee354 100644
--- a/tajo-common/src/main/java/org/apache/tajo/exception/InvalidValueForCastException.java
+++ b/tajo-common/src/main/java/org/apache/tajo/exception/InvalidValueForCastException.java
@@ -39,6 +39,6 @@ public class InvalidValueForCastException extends TajoException {
   }
 
   public InvalidValueForCastException(Type src, Type target) {
-    super(Errors.ResultCode.INVALID_VALUE_FOR_CAST, src.baseType().name(), target.baseType().name());
+    super(Errors.ResultCode.INVALID_VALUE_FOR_CAST, src.kind().name(), target.kind().name());
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-common/src/main/java/org/apache/tajo/json/CommonGsonHelper.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/json/CommonGsonHelper.java b/tajo-common/src/main/java/org/apache/tajo/json/CommonGsonHelper.java
index d838b6a..68d4465 100644
--- a/tajo-common/src/main/java/org/apache/tajo/json/CommonGsonHelper.java
+++ b/tajo-common/src/main/java/org/apache/tajo/json/CommonGsonHelper.java
@@ -40,6 +40,7 @@ public class CommonGsonHelper {
 	private static Map<Type, GsonSerDerAdapter<?>> registerAdapters() {
     Map<Type, GsonSerDerAdapter<?>> adapters = new HashMap<>();
     adapters.put(Datum.class, new DatumAdapter());
+    adapters.put(Type.class, new TypeAdapter());
 
     return adapters;
 	}

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-common/src/main/java/org/apache/tajo/json/TypeAdapter.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/json/TypeAdapter.java b/tajo-common/src/main/java/org/apache/tajo/json/TypeAdapter.java
new file mode 100644
index 0000000..5c3c1e4
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/json/TypeAdapter.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.json;
+
+import com.google.gson.*;
+import org.apache.tajo.type.TypeStringEncoder;
+
+import java.lang.reflect.Type;
+
+
+public class TypeAdapter implements GsonSerDerAdapter<org.apache.tajo.type.Type> {
+
+  @Override
+  public org.apache.tajo.type.Type deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
+      throws JsonParseException {
+    JsonObject obj = (JsonObject) json;
+    return TypeStringEncoder.decode(CommonGsonHelper.getOrDie(obj, "type").getAsString());
+  }
+
+  @Override
+  public JsonElement serialize(org.apache.tajo.type.Type src, Type typeOfSrc, JsonSerializationContext context) {
+    JsonObject json = new JsonObject();
+    json.addProperty("type", TypeStringEncoder.encode(src));
+    return json;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/8d2bf407/tajo-common/src/main/java/org/apache/tajo/schema/ANSISQLIdentifierPolicy.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/schema/ANSISQLIdentifierPolicy.java b/tajo-common/src/main/java/org/apache/tajo/schema/ANSISQLIdentifierPolicy.java
index c195bb6..cfe91c1 100644
--- a/tajo-common/src/main/java/org/apache/tajo/schema/ANSISQLIdentifierPolicy.java
+++ b/tajo-common/src/main/java/org/apache/tajo/schema/ANSISQLIdentifierPolicy.java
@@ -29,12 +29,12 @@ public class ANSISQLIdentifierPolicy extends IdentifierPolicy {
   }
 
   @Override
-  public String getIdentifierQuoteString() {
+  public char getIdentifierQuoteString() {
     return ANSI_SQL_QUOTE_STRING;
   }
 
   @Override
-  String getIdentifierSeperator() {
+  char getIdentifierSeperator() {
     return ANSI_SQL_SEPERATOR_STRING;
   }
 


Mime
View raw message