You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2014/03/25 02:36:17 UTC

[02/13] TAJO-353: Add Database support to Tajo. (hyunsik)

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateDatabase.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateDatabase.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateDatabase.java
new file mode 100644
index 0000000..c1c2591
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateDatabase.java
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.engine.query;
+
+import org.apache.tajo.IntegrationTest;
+import org.apache.tajo.QueryTestCaseBase;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.sql.ResultSet;
+
+@Category(IntegrationTest.class)
+public class TestCreateDatabase extends QueryTestCaseBase {
+
+  @Test
+  public final void testCreateAndDropDatabase() throws Exception {
+    ResultSet res = null;
+    try {
+      res = executeString("CREATE DATABASE testCreateAndDropDatabase;");
+      assertDatabaseExists("testCreateAndDropDatabase");
+      executeString("DROP DATABASE testCreateAndDropDatabase;");
+      assertDatabaseNotExists("testCreateAndDropDatabase");
+    } finally {
+      cleanupQuery(res);
+    }
+  }
+
+  @Test
+  public final void testCreateIfNotExists() throws Exception {
+    String databaseName = "testCreateIfNotExists";
+
+    assertDatabaseNotExists(databaseName);
+    executeString("CREATE DATABASE " + databaseName + ";").close();
+    assertDatabaseExists(databaseName);
+
+    executeString("CREATE DATABASE IF NOT EXISTS " + databaseName + ";").close();
+    assertDatabaseExists(databaseName);
+
+    executeString("DROP DATABASE " + databaseName + ";").close();
+    assertDatabaseNotExists(databaseName);
+  }
+
+  @Test
+  public final void testDropIfExists() throws Exception {
+    String databaseName = "testDropIfExists";
+    assertDatabaseNotExists(databaseName);
+    executeString("CREATE DATABASE " + databaseName + ";").close();
+    assertDatabaseExists(databaseName);
+
+    executeString("DROP DATABASE " + databaseName + ";").close();
+    assertDatabaseNotExists(databaseName);
+
+    executeString("DROP DATABASE IF EXISTS " + databaseName + ";");
+    assertDatabaseNotExists(databaseName);
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
index f39ceb8..f2882dd 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
@@ -23,140 +23,209 @@ import org.apache.tajo.QueryTestCaseBase;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import java.util.List;
+
 @Category(IntegrationTest.class)
 public class TestCreateTable extends QueryTestCaseBase {
 
   @Test
   public final void testVariousTypes() throws Exception {
-    String tableName = executeDDL("create_table_various_types.sql", null);
-    assertTableExists(tableName);
+    List<String> createdNames;
+    if (testingCluster.isHCatalogStoreRunning()) {
+      createdNames = executeDDL("create_table_various_types_for_hcatalog.sql", null);
+    } else {
+      createdNames = executeDDL("create_table_various_types.sql", null);
+    }
+    assertTableExists(createdNames.get(0));
   }
 
   @Test
   public final void testCreateTable1() throws Exception {
-    String tableName = executeDDL("table1_ddl.sql", "table1.tbl", "table1");
-    assertTableExists(tableName);
+    List<String> createdNames = executeDDL("table1_ddl.sql", "table1", "table1");
+    assertTableExists(createdNames.get(0));
+  }
+
+  @Test
+  public final void testCreateTable2() throws Exception {
+    executeString("CREATE DATABASE D1;").close();
+    executeString("CREATE DATABASE D2;").close();
+
+    executeString("CREATE TABLE D1.table1 (age int);").close();
+    executeString("CREATE TABLE D1.table2 (age int);").close();
+    executeString("CREATE TABLE D2.table3 (age int);").close();
+    executeString("CREATE TABLE D2.table4 (age int);").close();
+
+    assertTableExists("D1.table1");
+    assertTableExists("D1.table2");
+    assertTableNotExists("D2.table1");
+    assertTableNotExists("D2.table2");
+
+    assertTableExists("D2.table3");
+    assertTableExists("D2.table4");
+    assertTableNotExists("D1.table3");
+    assertTableNotExists("D1.table4");
+
+    executeString("DROP TABLE D1.table1");
+    executeString("DROP TABLE D1.table2");
+    executeString("DROP TABLE D2.table3");
+    executeString("DROP TABLE D2.table4");
+
+    assertDatabaseExists("D1");
+    assertDatabaseExists("D2");
+    executeString("DROP DATABASE D1").close();
+    executeString("DROP DATABASE D2").close();
+    assertDatabaseNotExists("D1");
+    assertDatabaseNotExists("D2");
+  }
+
+  @Test
+  public final void testCreateTableIfNotExists() throws Exception {
+    executeString("CREATE DATABASE D3;").close();
+
+    assertTableNotExists("D3.table1");
+    executeString("CREATE TABLE D3.table1 (age int);").close();
+    assertTableExists("D3.table1");
+
+    executeString("CREATE TABLE IF NOT EXISTS D3.table1 (age int);").close();
+    assertTableExists("D3.table1");
+
+    executeString("DROP TABLE D3.table1");
+  }
+
+  @Test
+  public final void testDropTableIfExists() throws Exception {
+    executeString("CREATE DATABASE D4;").close();
+
+    assertTableNotExists("D4.table1");
+    executeString("CREATE TABLE D4.table1 (age int);").close();
+    assertTableExists("D4.table1");
+
+    executeString("DROP TABLE D4.table1;").close();
+    assertTableNotExists("D4.table1");
+
+    executeString("DROP TABLE IF EXISTS D4.table1");
+    assertTableNotExists("D4.table1");
   }
 
   @Test
   public final void testNonreservedKeywordTableNames() throws Exception {
-    String tableName = null;
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "filter");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "first");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "format");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "grouping");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "hash");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "index");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "insert");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "last");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "location");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "max");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "min");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "national");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "nullif");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "overwrite");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "precision");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "range");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "regexp");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "rlike");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "set");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "unknown");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "var_pop");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "var_samp");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "varying");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "zone");
-    assertTableExists(tableName);
-
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "bigint");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "bit");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "blob");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "bool");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "boolean");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "bytea");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "char");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "date");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "decimal");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "double");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "float");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "float4");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "float8");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "inet4");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "int");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "int1");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "int2");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "int4");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "int8");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "integer");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "nchar");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "numeric");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "nvarchar");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "real");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "smallint");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "text");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "time");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "timestamp");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "timestamptz");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "timetz");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "tinyint");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "varbinary");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "varbit");
-    assertTableExists(tableName);
-    tableName = executeDDL("table1_ddl.sql", "table1.tbl", "varchar");
-    assertTableExists(tableName);
+    List<String> createdNames = null;
+    createdNames = executeDDL("table1_ddl.sql", "table1", "filter");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "first");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "format");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "grouping");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "hash");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "index");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "insert");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "last");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "location");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "max");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "min");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "national");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "nullif");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "overwrite");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "precision");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "range");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "regexp");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "rlike");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "set");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "unknown");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "var_pop");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "var_samp");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "varying");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "zone");
+    assertTableExists(createdNames.get(0));
+
+    createdNames = executeDDL("table1_ddl.sql", "table1", "bigint");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "bit");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "blob");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "bool");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "boolean");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "bytea");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "char");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "date");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "decimal");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "double");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "float");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "float4");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "float8");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "inet4");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "int");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "int1");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "int2");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "int4");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "int8");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "integer");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "nchar");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "numeric");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "nvarchar");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "real");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "smallint");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "text");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "time");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "timestamp");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "timestamptz");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "timetz");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "tinyint");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "varbinary");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "varbit");
+    assertTableExists(createdNames.get(0));
+    createdNames = executeDDL("table1_ddl.sql", "table1", "varchar");
+    assertTableExists(createdNames.get(0));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
index 8ecf8ed..250d6f4 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
@@ -20,6 +20,7 @@ package org.apache.tajo.engine.query;
 
 import org.apache.tajo.IntegrationTest;
 import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.TajoConstants;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -27,6 +28,11 @@ import java.sql.ResultSet;
 
 @Category(IntegrationTest.class)
 public class TestGroupByQuery extends QueryTestCaseBase {
+
+  public TestGroupByQuery() {
+    super(TajoConstants.DEFAULT_DATABASE_NAME);
+  }
+
   @Test
   public final void testGroupBy() throws Exception {
     // select count(1) as unique_key from lineitem;

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
index 8b2db9f..250be47 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
@@ -36,6 +36,7 @@ import org.junit.experimental.categories.Category;
 import java.io.IOException;
 import java.sql.ResultSet;
 
+import static org.apache.tajo.TajoConstants.DEFAULT_DATABASE_NAME;
 import static org.junit.Assert.*;
 
 @Category(IntegrationTest.class)
@@ -57,14 +58,16 @@ public class TestInsertQuery {
     res.close();
     TajoTestingCluster cluster = tpch.getTestingCluster();
     CatalogService catalog = cluster.getMaster().getCatalog();
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = tpch.execute("insert overwrite into " + tableName
         + " select l_orderkey, l_partkey, l_quantity from lineitem");
     res.close();
 
-    TableDesc desc = catalog.getTableDesc(tableName);
-    assertEquals(5, desc.getStats().getNumRows().intValue());
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!cluster.isHCatalogStoreRunning()) {
+      assertEquals(5, desc.getStats().getNumRows().intValue());
+    }
   }
 
   @Test
@@ -74,13 +77,15 @@ public class TestInsertQuery {
     res.close();
     TajoTestingCluster cluster = tpch.getTestingCluster();
     CatalogService catalog = cluster.getMaster().getCatalog();
-    assertTrue(catalog.existsTable(tableName));
-    TableDesc originalDesc = catalog.getTableDesc(tableName);
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
+    TableDesc originalDesc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
 
     res = tpch.execute("insert overwrite into " + tableName + " select l_orderkey from lineitem");
     res.close();
-    TableDesc desc = catalog.getTableDesc(tableName);
-    assertEquals(5, desc.getStats().getNumRows().intValue());
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!cluster.isHCatalogStoreRunning()) {
+      assertEquals(5, desc.getStats().getNumRows().intValue());
+    }
     assertEquals(originalDesc.getSchema(), desc.getSchema());
   }
 
@@ -91,13 +96,15 @@ public class TestInsertQuery {
     res.close();
     TajoTestingCluster cluster = tpch.getTestingCluster();
     CatalogService catalog = cluster.getMaster().getCatalog();
-    assertTrue(catalog.existsTable(tableName));
-    TableDesc originalDesc = catalog.getTableDesc(tableName);
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
+    TableDesc originalDesc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
 
     res = tpch.execute("insert overwrite into " + tableName + " (col1, col3) select l_orderkey, l_quantity from lineitem");
     res.close();
-    TableDesc desc = catalog.getTableDesc(tableName);
-    assertEquals(5, desc.getStats().getNumRows().intValue());
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!cluster.isHCatalogStoreRunning()) {
+      assertEquals(5, desc.getStats().getNumRows().intValue());
+    }
 
     res = tpch.execute("select * from " + tableName);
 
@@ -143,12 +150,14 @@ public class TestInsertQuery {
     res.close();
     TajoTestingCluster cluster = tpch.getTestingCluster();
     CatalogService catalog = cluster.getMaster().getCatalog();
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = tpch.execute("insert overwrite into " + tableName + " select * from lineitem where l_orderkey = 3");
     res.close();
-    TableDesc desc = catalog.getTableDesc(tableName);
-    assertEquals(2, desc.getStats().getNumRows().intValue());
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!cluster.isHCatalogStoreRunning()) {
+      assertEquals(2, desc.getStats().getNumRows().intValue());
+    }
   }
 
   @Test
@@ -161,9 +170,11 @@ public class TestInsertQuery {
 
     TajoTestingCluster cluster = tpch.getTestingCluster();
     CatalogService catalog = cluster.getMaster().getCatalog();
-    assertTrue(catalog.existsTable(tableName));
-    TableDesc orderKeys = catalog.getTableDesc(tableName);
-    assertEquals(5, orderKeys.getStats().getNumRows().intValue());
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
+    TableDesc orderKeys = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!cluster.isHCatalogStoreRunning()) {
+      assertEquals(5, orderKeys.getStats().getNumRows().intValue());
+    }
 
     // this query will result in the two rows.
     res = tpch.execute(
@@ -171,9 +182,11 @@ public class TestInsertQuery {
     assertFalse(res.next());
     res.close();
 
-    assertTrue(catalog.existsTable(tableName));
-    orderKeys = catalog.getTableDesc(tableName);
-    assertEquals(2, orderKeys.getStats().getNumRows().intValue());
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
+    orderKeys = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!cluster.isHCatalogStoreRunning()) {
+      assertEquals(2, orderKeys.getStats().getNumRows().intValue());
+    }
   }
 
   @Test
@@ -183,12 +196,14 @@ public class TestInsertQuery {
     res.close();
     TajoTestingCluster cluster = tpch.getTestingCluster();
     CatalogService catalog = cluster.getMaster().getCatalog();
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = tpch.execute("insert overwrite into " + tableName + " select * from lineitem where l_orderkey = 3");
     res.close();
-    TableDesc desc = catalog.getTableDesc(tableName);
-    assertEquals(2, desc.getStats().getNumRows().intValue());
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!cluster.isHCatalogStoreRunning()) {
+      assertEquals(2, desc.getStats().getNumRows().intValue());
+    }
   }
 
   @Test
@@ -208,18 +223,20 @@ public class TestInsertQuery {
     res.close();
     TajoTestingCluster cluster = tpch.getTestingCluster();
     CatalogService catalog = cluster.getMaster().getCatalog();
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = tpch.execute("insert overwrite into " + tableName + " select  l_orderkey, l_partkey, l_quantity from lineitem where l_orderkey = 3");
     res.close();
-    TableDesc desc = catalog.getTableDesc(tableName);
-    assertEquals(2, desc.getStats().getNumRows().intValue());
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!cluster.isHCatalogStoreRunning()) {
+      assertEquals(2, desc.getStats().getNumRows().intValue());
+    }
 
     FileSystem fs = FileSystem.get(tpch.getTestingCluster().getConfiguration());
     assertTrue(fs.exists(desc.getPath()));
     CompressionCodecFactory factory = new CompressionCodecFactory(tpch.getTestingCluster().getConfiguration());
 
-    for (FileStatus file : fs.listStatus(desc.getPath())){
+    for (FileStatus file : fs.listStatus(desc.getPath())) {
       CompressionCodec codec = factory.getCodec(file.getPath());
       assertTrue(codec instanceof DeflateCodec);
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinOnPartitionedTables.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinOnPartitionedTables.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinOnPartitionedTables.java
index 4bda517..3e28f9e 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinOnPartitionedTables.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinOnPartitionedTables.java
@@ -19,14 +19,20 @@
 package org.apache.tajo.engine.query;
 
 import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.TajoConstants;
 import org.junit.Test;
 
 import java.sql.ResultSet;
 
 public class TestJoinOnPartitionedTables extends QueryTestCaseBase {
 
+  public TestJoinOnPartitionedTables() {
+    super(TajoConstants.DEFAULT_DATABASE_NAME);
+  }
+
   @Test
   public void testPartitionTableJoinSmallTable() throws Exception {
+
     executeDDL("customer_ddl.sql", null);
     ResultSet res = executeFile("insert_into_customer.sql");
     res.close();

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
index 0c68fa6..19591ea 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
@@ -20,6 +20,7 @@ package org.apache.tajo.engine.query;
 
 import org.apache.tajo.IntegrationTest;
 import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.TajoConstants;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -27,6 +28,11 @@ import java.sql.ResultSet;
 
 @Category(IntegrationTest.class)
 public class TestJoinQuery extends QueryTestCaseBase {
+
+  public TestJoinQuery() {
+    super(TajoConstants.DEFAULT_DATABASE_NAME);
+  }
+
   @Test
   public final void testCrossJoin() throws Exception {
     ResultSet res = executeQuery();
@@ -169,8 +175,8 @@ public class TestJoinQuery extends QueryTestCaseBase {
 
   @Test
   public void testOuterJoinAndCaseWhen1() throws Exception {
-    executeDDL("oj_table1_ddl.sql", "table1.tbl");
-    executeDDL("oj_table2_ddl.sql", "table2.tbl");
+    executeDDL("oj_table1_ddl.sql", "table1");
+    executeDDL("oj_table2_ddl.sql", "table2");
     ResultSet res = executeQuery();
     assertResultSet(res);
     cleanupQuery(res);
@@ -264,4 +270,16 @@ public class TestJoinQuery extends QueryTestCaseBase {
     cleanupQuery(res);
   }
 
+  @Test
+  public final void testJoinOnMultipleDatabases() throws Exception {
+    executeString("CREATE DATABASE JOINS");
+    assertDatabaseExists("JOINS");
+    executeString("CREATE TABLE JOINS.part_ as SELECT * FROM part");
+    assertTableExists("JOINS.part_");
+    executeString("CREATE TABLE JOINS.supplier_ as SELECT * FROM supplier");
+    assertTableExists("JOINS.supplier_");
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java
index bba47cc..17235a6 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java
@@ -27,48 +27,65 @@ import java.sql.ResultSet;
 public class TestNetTypes extends QueryTestCaseBase {
 
   @Before
-  public final void setup() throws Exception {
-    executeDDL("table1_ddl.sql", "table1.tbl");
-    executeDDL("table2_ddl.sql", "table2.tbl");
+  public final void setUp() throws Exception {
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      executeDDL("table1_ddl.sql", "table1");
+      executeDDL("table2_ddl.sql", "table2");
+    }
   }
 
   @Test
   public final void testSelect() throws Exception {
-    // select name, addr from table1;
-    ResultSet res = executeQuery();
-    assertResultSet(res);
-    cleanupQuery(res);
+    // Skip all tests when HCatalogStore is used.
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      // select name, addr from table1;
+      ResultSet res = executeQuery();
+      assertResultSet(res);
+      cleanupQuery(res);
+    }
   }
 
   @Test
   public final void testGroupby() throws Exception {
-    // select name, addr, count(1) from table1 group by name, addr;
-    ResultSet res = executeQuery();
-    assertResultSet(res);
-    cleanupQuery(res);
+    // Skip all tests when HCatalogStore is used.
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      // select name, addr, count(1) from table1 group by name, addr;
+      ResultSet res = executeQuery();
+      assertResultSet(res);
+      cleanupQuery(res);
+    }
   }
 
   @Test
   public final void testGroupby2() throws Exception {
-    // select addr, count(*) from table1 group by addr;
-    ResultSet res = executeQuery();
-    assertResultSet(res);
-    cleanupQuery(res);
+    // Skip all tests when HCatalogStore is used.
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      // select addr, count(*) from table1 group by addr;
+      ResultSet res = executeQuery();
+      assertResultSet(res);
+      cleanupQuery(res);
+    }
   }
 
   @Test
   public final void testSort() throws Exception {
-    // select * from table1 order by addr;
-    ResultSet res = executeQuery();
-    assertResultSet(res);
-    cleanupQuery(res);
+    // Skip all tests when HCatalogStore is used.
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      // select * from table1 order by addr;
+      ResultSet res = executeQuery();
+      assertResultSet(res);
+      cleanupQuery(res);
+    }
   }
 
   @Test
   public final void testJoin() throws Exception {
-    // select * from table1 as t1, table2 as t2 where t1.addr = t2.addr;
-    ResultSet res = executeQuery();
-    assertResultSet(res);
-    cleanupQuery(res);
+    // Skip all tests when HCatalogStore is used.
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      // select * from table1 as t1, table2 as t2 where t1.addr = t2.addr;
+      ResultSet res = executeQuery();
+      assertResultSet(res);
+      cleanupQuery(res);
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
index fece424..a75631a 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
@@ -20,6 +20,7 @@ package org.apache.tajo.engine.query;
 
 import org.apache.tajo.IntegrationTest;
 import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.TajoConstants;
 import org.apache.tajo.TajoTestingCluster;
 import org.apache.tajo.catalog.CatalogService;
 import org.apache.tajo.catalog.TableDesc;
@@ -28,12 +29,17 @@ import org.junit.experimental.categories.Category;
 
 import java.sql.ResultSet;
 
+import static org.apache.tajo.TajoConstants.DEFAULT_DATABASE_NAME;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 @Category(IntegrationTest.class)
 public class TestSelectQuery extends QueryTestCaseBase {
 
+  public TestSelectQuery() {
+    super(TajoConstants.DEFAULT_DATABASE_NAME);
+  }
+
   @Test
   public final void testSelect() throws Exception {
     // select l_orderkey, l_partkey from lineitem;
@@ -227,9 +233,11 @@ public class TestSelectQuery extends QueryTestCaseBase {
     res.close();
     TajoTestingCluster cluster = testBase.getTestingCluster();
     CatalogService catalog = cluster.getMaster().getCatalog();
-    assertTrue(catalog.existsTable("orderkeys"));
-    TableDesc orderKeys = catalog.getTableDesc("orderkeys");
-    assertEquals(5, orderKeys.getStats().getNumRows().intValue());
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, "orderkeys"));
+    TableDesc orderKeys = catalog.getTableDesc(DEFAULT_DATABASE_NAME, "orderkeys");
+    if (!cluster.isHCatalogStoreRunning()) {
+      assertEquals(5, orderKeys.getStats().getNumRows().intValue());
+    }
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
index 23d7bdb..61206cd 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
@@ -20,6 +20,7 @@ package org.apache.tajo.engine.query;
 
 import org.apache.tajo.IntegrationTest;
 import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.TajoConstants;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -28,6 +29,10 @@ import java.sql.ResultSet;
 @Category(IntegrationTest.class)
 public class TestSortQuery extends QueryTestCaseBase {
 
+  public TestSortQuery() {
+    super(TajoConstants.DEFAULT_DATABASE_NAME);
+  }
+
   @Test
   public final void testSort() throws Exception {
     ResultSet res = executeQuery();
@@ -96,12 +101,16 @@ public class TestSortQuery extends QueryTestCaseBase {
 
   @Test
   public final void testSortWithDate() throws Exception {
-    //select col1, col2, l_comment from table1 order by col1, col2;
-    executeDDL("create_table_with_date_ddl.sql", "table1.tbl");
-
-    ResultSet res = executeQuery();
-    assertResultSet(res);
-    cleanupQuery(res);
+    // skip this test if catalog uses HCatalogStore.
+    // It is because HCatalogStore does not support Time data type.
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      // create external table table1 (col1 timestamp, col2 date, col3 time) ...
+      executeDDL("create_table_with_date_ddl.sql", "table1");
+
+      ResultSet res = executeQuery();
+      assertResultSet(res);
+      cleanupQuery(res);
+    }
   }
 
   @Test
@@ -114,7 +123,7 @@ public class TestSortQuery extends QueryTestCaseBase {
 
   @Test
   public final void testSortWithAscDescKeys() throws Exception {
-    executeDDL("create_table_with_asc_desc_keys.sql", "table2.tbl");
+    executeDDL("create_table_with_asc_desc_keys.sql", "table2");
 
     ResultSet res = executeQuery();
     System.out.println(resultSetToString(res));

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
index 60c8497..a53fff7 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
@@ -26,6 +26,7 @@ import org.apache.hadoop.io.compress.CompressionCodec;
 import org.apache.hadoop.io.compress.CompressionCodecFactory;
 import org.apache.hadoop.io.compress.DeflateCodec;
 import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.TajoConstants;
 import org.apache.tajo.TajoTestingCluster;
 import org.apache.tajo.catalog.CatalogService;
 import org.apache.tajo.catalog.TableDesc;
@@ -35,13 +36,14 @@ import java.io.IOException;
 import java.sql.ResultSet;
 import java.util.Map;
 
+import static org.apache.tajo.TajoConstants.DEFAULT_DATABASE_NAME;
 import static org.junit.Assert.*;
 
 public class TestTablePartitions extends QueryTestCaseBase {
 
 
   public TestTablePartitions() throws IOException {
-    super();
+    super(TajoConstants.DEFAULT_DATABASE_NAME);
   }
 
   @Test
@@ -51,9 +53,9 @@ public class TestTablePartitions extends QueryTestCaseBase {
         "create table " + tableName + " (col1 int4, col2 int4) partition by column(key float8) ");
     res.close();
 
-    assertTrue(catalog.existsTable(tableName));
-    assertEquals(2, catalog.getTableDesc(tableName).getSchema().size());
-    assertEquals(3, catalog.getTableDesc(tableName).getLogicalSchema().size());
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
+    assertEquals(2, catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName).getSchema().size());
+    assertEquals(3, catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName).getLogicalSchema().size());
 
     res = testBase.execute(
         "insert overwrite into " + tableName + " select l_orderkey, l_partkey, l_quantity from lineitem");
@@ -67,9 +69,9 @@ public class TestTablePartitions extends QueryTestCaseBase {
         "create table " + tableName + " (col1 int4, col2 int4, null_col int4) partition by column(key float8) ");
     res.close();
 
-    assertTrue(catalog.existsTable(tableName));
-    assertEquals(3, catalog.getTableDesc(tableName).getSchema().size());
-    assertEquals(4, catalog.getTableDesc(tableName).getLogicalSchema().size());
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
+    assertEquals(3, catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName).getSchema().size());
+    assertEquals(4, catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName).getLogicalSchema().size());
 
     res = executeString("insert overwrite into " + tableName + " (col1, col2, key) select l_orderkey, " +
         "l_partkey, l_quantity from lineitem");
@@ -83,13 +85,13 @@ public class TestTablePartitions extends QueryTestCaseBase {
         "create table " + tableName + " (col1 int4, col2 int4, null_col int4) partition by column(key float8) ");
     res.close();
 
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = executeString("insert overwrite into " + tableName
         + " (col1, col2, key) select l_orderkey, l_partkey, l_quantity from lineitem");
     res.close();
 
-    TableDesc desc = catalog.getTableDesc(tableName);
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
     assertPartitionDirectories(desc);
 
     res = executeString(
@@ -116,7 +118,9 @@ public class TestTablePartitions extends QueryTestCaseBase {
     assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=38.0")));
     assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=45.0")));
     assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=49.0")));
-    assertEquals(5, desc.getStats().getNumRows().intValue());
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      assertEquals(5, desc.getStats().getNumRows().intValue());
+    }
   }
 
   @Test
@@ -126,14 +130,14 @@ public class TestTablePartitions extends QueryTestCaseBase {
         "create table " + tableName + " (col1 int4, col2 int4, null_col int4) partition by column(key float8) ");
     res.close();
 
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = executeString(
         "insert overwrite into " + tableName
             + " (col1, col2, key) select l_orderkey, l_partkey, l_quantity from lineitem");
     res.close();
 
-    TableDesc desc = catalog.getTableDesc(tableName);
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
     assertPartitionDirectories(desc);
 
     res = executeFile("case1.sql");
@@ -157,13 +161,13 @@ public class TestTablePartitions extends QueryTestCaseBase {
     res.close();
     TajoTestingCluster cluster = testBase.getTestingCluster();
     CatalogService catalog = cluster.getMaster().getCatalog();
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = executeString("insert overwrite into " + tableName
         + " select l_returnflag, l_orderkey, l_partkey, l_quantity from lineitem");
     res.close();
 
-    TableDesc desc = catalog.getTableDesc(tableName);
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
     Path path = desc.getPath();
 
     FileSystem fs = FileSystem.get(conf);
@@ -179,7 +183,9 @@ public class TestTablePartitions extends QueryTestCaseBase {
     assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=3")));
     assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=2/col3=45.0")));
     assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=3/col3=49.0")));
-    assertEquals(5, desc.getStats().getNumRows().intValue());
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      assertEquals(5, desc.getStats().getNumRows().intValue());
+    }
 
     res = executeString("select * from " + tableName + " where col2 = 2");
 
@@ -219,13 +225,15 @@ public class TestTablePartitions extends QueryTestCaseBase {
             "WITH ('csvfile.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec') " +
             "PARTITION BY column(col1 int4)");
     res.close();
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = executeString(
         "insert overwrite into " + tableName + " select l_partkey, l_quantity, l_orderkey from lineitem");
     res.close();
-    TableDesc desc = catalog.getTableDesc(tableName);
-    assertEquals(5, desc.getStats().getNumRows().intValue());
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      assertEquals(5, desc.getStats().getNumRows().intValue());
+    }
 
     FileSystem fs = FileSystem.get(conf);
     assertTrue(fs.exists(desc.getPath()));
@@ -253,14 +261,16 @@ public class TestTablePartitions extends QueryTestCaseBase {
         "PARTITION by column(col1 int4, col2 int4)");
     res.close();
 
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = executeString(
         "insert overwrite into " + tableName +
             " select  l_quantity, l_returnflag, l_orderkey, l_partkey from lineitem");
     res.close();
-    TableDesc desc = catalog.getTableDesc(tableName);
-    assertEquals(5, desc.getStats().getNumRows().intValue());
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      assertEquals(5, desc.getStats().getNumRows().intValue());
+    }
 
     FileSystem fs = FileSystem.get(conf);
     assertTrue(fs.exists(desc.getPath()));
@@ -296,14 +306,16 @@ public class TestTablePartitions extends QueryTestCaseBase {
             "partition by column(col1 int4, col2 int4, col3 float8)");
     res.close();
 
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = executeString(
         "insert overwrite into " + tableName +
             " select l_returnflag, l_orderkey, l_partkey, l_quantity from lineitem");
     res.close();
-    TableDesc desc = catalog.getTableDesc(tableName);
-    assertEquals(5, desc.getStats().getNumRows().intValue());
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      assertEquals(5, desc.getStats().getNumRows().intValue());
+    }
 
     FileSystem fs = FileSystem.get(conf);
     assertTrue(fs.exists(desc.getPath()));
@@ -377,14 +389,16 @@ public class TestTablePartitions extends QueryTestCaseBase {
             "partition by column(col1 int4, col2 int4, col3 float8)");
     res.close();
 
-    assertTrue(catalog.existsTable(tableName));
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
 
     res = executeString(
         "insert overwrite into " + tableName +
             " select l_returnflag , l_orderkey, l_partkey, l_quantity from lineitem");
     res.close();
-    TableDesc desc = catalog.getTableDesc(tableName);
-    assertEquals(5, desc.getStats().getNumRows().intValue());
+    TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
+    if (!testingCluster.isHCatalogStoreRunning()) {
+      assertEquals(5, desc.getStats().getNumRows().intValue());
+    }
 
     FileSystem fs = FileSystem.get(conf);
     assertTrue(fs.exists(desc.getPath()));

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
index bbd533f..9be0302 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
@@ -19,12 +19,17 @@
 package org.apache.tajo.engine.query;
 
 import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.TajoConstants;
 import org.junit.Test;
 
 import java.sql.ResultSet;
 
 public class TestTableSubQuery extends QueryTestCaseBase {
 
+  public TestTableSubQuery() {
+    super(TajoConstants.DEFAULT_DATABASE_NAME);
+  }
+
   @Test
   public final void testTableSubquery1() throws Exception {
     ResultSet res = executeQuery();

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestUnionQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestUnionQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestUnionQuery.java
index 22830bf..a54f670 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestUnionQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestUnionQuery.java
@@ -20,6 +20,7 @@ package org.apache.tajo.engine.query;
 
 import org.apache.tajo.IntegrationTest;
 import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.TajoConstants;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -36,6 +37,10 @@ import java.sql.ResultSet;
 @Category(IntegrationTest.class)
 public class TestUnionQuery extends QueryTestCaseBase {
 
+  public TestUnionQuery() {
+    super(TajoConstants.DEFAULT_DATABASE_NAME);
+  }
+
   @Test
   /**
    * S (SA U SA) O

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestResultSet.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestResultSet.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestResultSet.java
index 3610382..4477fa5 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestResultSet.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestResultSet.java
@@ -23,6 +23,7 @@ package org.apache.tajo.jdbc;
 
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.IntegrationTest;
+import org.apache.tajo.TajoConstants;
 import org.apache.tajo.TajoTestingCluster;
 import org.apache.tajo.TpchTestBase;
 import org.apache.tajo.catalog.CatalogUtil;
@@ -90,7 +91,8 @@ public class TestResultSet {
     stats.setAvgRows(tupleNum);
     stats.setNumBlocks(1000);
     stats.setNumShuffleOutputs(100);
-    desc = new TableDesc("score", scoreSchema, scoreMeta, p);
+    desc = new TableDesc(CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, "score"),
+        scoreSchema, scoreMeta, p);
     desc.setStats(stats);
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java
index 445cd69..1279245 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java
@@ -20,11 +20,12 @@ package org.apache.tajo.jdbc;
 
 import com.google.common.collect.Maps;
 import org.apache.tajo.IntegrationTest;
+import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.TajoConstants;
 import org.apache.tajo.TpchTestBase;
+import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Column;
 import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.util.NetUtils;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -32,42 +33,39 @@ import org.junit.experimental.categories.Category;
 
 import java.net.InetSocketAddress;
 import java.sql.*;
-import java.util.ArrayList;
-import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
+import static org.apache.tajo.TajoConstants.DEFAULT_DATABASE_NAME;
 import static org.junit.Assert.*;
 
 @Category(IntegrationTest.class)
-public class TestTajoJdbc {
+public class TestTajoJdbc extends QueryTestCaseBase {
   private static TpchTestBase tpch;
-  private static Connection conn;
 
-  private static String connUri;
+  private static InetSocketAddress tajoMasterAddress;
   @BeforeClass
   public static void setUp() throws Exception {
-    tpch = TpchTestBase.getInstance();
-
-    TajoConf tajoConf = tpch.getTestingCluster().getMaster().getContext().getConf();
-    InetSocketAddress tajoMasterAddress =
-        NetUtils.createSocketAddr(tajoConf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS));
-
+    tajoMasterAddress = testingCluster.getMaster().getTajoMasterClientService().getBindAddress();
     Class.forName("org.apache.tajo.jdbc.TajoDriver").newInstance();
-
-    connUri = "jdbc:tajo://" + tajoMasterAddress.getHostName() + ":" + tajoMasterAddress.getPort();
-    conn = DriverManager.getConnection(connUri);
   }
 
   @AfterClass
   public static void tearDown() throws Exception {
-    if(conn != null) {
-      conn.close();
-    }
+  }
+
+  private static String buildConnectionUri(String hostName, int port, String databaseNme) {
+    return "jdbc:tajo://" + hostName + ":" + port + "/" + databaseNme;
   }
 
   @Test
   public void testStatement() throws Exception {
+    String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
+        DEFAULT_DATABASE_NAME);
+    Connection conn = DriverManager.getConnection(connUri);
+
     Statement stmt = null;
     ResultSet res = null;
     try {
@@ -108,6 +106,10 @@ public class TestTajoJdbc {
 
   @Test
   public void testPreparedStatement() throws Exception {
+    String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
+        TajoConstants.DEFAULT_DATABASE_NAME);
+    Connection conn = DriverManager.getConnection(connUri);
+
     PreparedStatement stmt = null;
     ResultSet res = null;
     try {
@@ -184,6 +186,9 @@ public class TestTajoJdbc {
 
   @Test
   public void testDatabaseMetaDataGetTable() throws Exception {
+    String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
+        TajoConstants.DEFAULT_DATABASE_NAME);
+    Connection conn = DriverManager.getConnection(connUri);
     DatabaseMetaData dbmd = conn.getMetaData();
 
     ResultSet rs = null;
@@ -193,21 +198,15 @@ public class TestTajoJdbc {
 
       ResultSetMetaData rsmd = rs.getMetaData();
       int numCols = rsmd.getColumnCount();
-
       assertEquals(5, numCols);
-      int numTables = 0;
 
-      List<String> tableNames = new ArrayList<String>(
-          tpch.getTestingCluster().getMaster().getCatalog().getAllTableNames());
-
-      Collections.sort(tableNames);
+      Set<String> retrivedViaJavaAPI = new HashSet<String>(client.getTableList(DEFAULT_DATABASE_NAME));
 
+      Set<String> retrievedViaJDBC = new HashSet<String>();
       while(rs.next()) {
-        assertEquals(tableNames.get(numTables), rs.getString("TABLE_NAME"));
-        numTables++;
+        retrievedViaJDBC.add(rs.getString("TABLE_NAME"));
       }
-
-      assertEquals(tableNames.size(), numTables);
+      assertEquals(retrievedViaJDBC, retrivedViaJavaAPI);
     } finally {
       if(rs != null) {
         rs.close();
@@ -217,6 +216,9 @@ public class TestTajoJdbc {
 
   @Test
   public void testDatabaseMetaDataGetColumns() throws Exception {
+    String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
+        TajoConstants.DEFAULT_DATABASE_NAME);
+    Connection conn = DriverManager.getConnection(connUri);
     DatabaseMetaData dbmd = conn.getMetaData();
 
     ResultSet rs = null;
@@ -231,7 +233,7 @@ public class TestTajoJdbc {
       assertEquals(22, numCols);
       int numColumns = 0;
 
-      TableDesc tableDesc = tpch.getTestingCluster().getMaster().getCatalog().getTableDesc(tableName);
+      TableDesc tableDesc = client.getTableDesc(CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, tableName));
       assertNotNull(tableDesc);
 
       List<Column> columns = tableDesc.getSchema().getColumns();
@@ -253,6 +255,9 @@ public class TestTajoJdbc {
 
   @Test
   public void testMultipleConnections() throws Exception {
+    String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
+        TajoConstants.DEFAULT_DATABASE_NAME);
+
     Connection[] conns = new Connection[2];
     conns[0] = DriverManager.getConnection(connUri);
     conns[1] = DriverManager.getConnection(connUri);
@@ -304,6 +309,8 @@ public class TestTajoJdbc {
 
   @Test
   public void testMultipleConnectionsSequentialClose() throws Exception {
+    String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(), DEFAULT_DATABASE_NAME);
+
     Connection[] conns = new Connection[2];
     conns[0] = DriverManager.getConnection(connUri);
     conns[1] = DriverManager.getConnection(connUri);
@@ -357,4 +364,119 @@ public class TestTajoJdbc {
       }
     }
   }
+
+  @Test
+  public void testSetAndGetCatalog() throws Exception {
+    String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
+        TajoConstants.DEFAULT_DATABASE_NAME);
+    Connection conn = DriverManager.getConnection(connUri);
+
+    assertDatabaseNotExists("jdbc_test1");
+    PreparedStatement pstmt = conn.prepareStatement("CREATE DATABASE jdbc_test1");
+    pstmt.executeUpdate();
+    assertDatabaseExists("jdbc_test1");
+    pstmt.close();
+
+    pstmt = conn.prepareStatement("CREATE DATABASE jdbc_test2");
+    pstmt.executeUpdate();
+    assertDatabaseExists("jdbc_test2");
+    pstmt.close();
+
+    conn.setCatalog("jdbc_test1");
+    assertEquals("jdbc_test1", conn.getCatalog());
+    conn.setCatalog("jdbc_test2");
+    assertEquals("jdbc_test2", conn.getCatalog());
+    conn.setCatalog("jdbc_test1");
+    assertEquals("jdbc_test1", conn.getCatalog());
+
+    conn.setCatalog(TajoConstants.DEFAULT_DATABASE_NAME);
+    pstmt = conn.prepareStatement("DROP DATABASE jdbc_test1");
+    pstmt.executeUpdate();
+    pstmt.close();
+    pstmt = conn.prepareStatement("DROP DATABASE jdbc_test2");
+    pstmt.executeUpdate();
+    pstmt.close();
+
+    conn.close();
+  }
+
+  @Test
+  public void testGetCatalogsAndTables() throws Exception {
+    String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
+        TajoConstants.DEFAULT_DATABASE_NAME);
+    Connection defaultConnect = DriverManager.getConnection(connUri);
+
+    Set<String> existingDatabases = new HashSet<String>();
+    DatabaseMetaData dbmd = defaultConnect.getMetaData();
+    ResultSet res = dbmd.getCatalogs();
+    while(res.next()) {
+      existingDatabases.add(res.getString(1));
+    }
+    res.close();
+
+    // create database "jdbc_test1" and its tables
+    assertDatabaseNotExists("jdbc_test1");
+    PreparedStatement pstmt = defaultConnect.prepareStatement("CREATE DATABASE jdbc_test1");
+    pstmt.executeUpdate();
+    assertDatabaseExists("jdbc_test1");
+    pstmt.close();
+    pstmt = defaultConnect.prepareStatement("CREATE TABLE jdbc_test1.table1 (age int)");
+    pstmt.executeUpdate();
+    pstmt.close();
+    pstmt = defaultConnect.prepareStatement("CREATE TABLE jdbc_test1.table2 (age int)");
+    pstmt.executeUpdate();
+    pstmt.close();
+
+    // create database "jdbc_test2" and its tables
+    pstmt = defaultConnect.prepareStatement("CREATE DATABASE jdbc_test2");
+    pstmt.executeUpdate();
+    assertDatabaseExists("jdbc_test2");
+    pstmt.close();
+
+    pstmt = defaultConnect.prepareStatement("CREATE TABLE jdbc_test2.table3 (age int)");
+    pstmt.executeUpdate();
+    pstmt.close();
+    pstmt = defaultConnect.prepareStatement("CREATE TABLE jdbc_test2.table4 (age int)");
+    pstmt.executeUpdate();
+    pstmt.close();
+
+    // verify getCatalogs()
+    Set<String> newDatabases = new HashSet<String>();
+    dbmd = defaultConnect.getMetaData();
+    res = dbmd.getCatalogs();
+    while(res.next()) {
+      newDatabases.add(res.getString(1));
+    }
+    res.close();
+    newDatabases.removeAll(existingDatabases);
+    assertEquals(2, newDatabases.size());
+    assertTrue(newDatabases.contains("jdbc_test1"));
+    assertTrue(newDatabases.contains("jdbc_test2"));
+
+    // verify getTables()
+    res = defaultConnect.getMetaData().getTables("jdbc_test1", null, null, null);
+    assertResultSet(res, "getTables1.result");
+    res.close();
+    res = defaultConnect.getMetaData().getTables("jdbc_test2", null, null, null);
+    assertResultSet(res, "getTables2.result");
+    res.close();
+
+    defaultConnect.close();
+
+    // jdbc1_test database connection test
+    String jdbcTest1ConnUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
+        "jdbc_test1");
+    Connection jdbcTest1Conn = DriverManager.getConnection(jdbcTest1ConnUri);
+    assertEquals("jdbc_test1", jdbcTest1Conn.getCatalog());
+    jdbcTest1Conn.close();
+
+    String jdbcTest2ConnUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
+        "jdbc_test2");
+    Connection jdbcTest2Conn = DriverManager.getConnection(jdbcTest2ConnUri);
+    assertEquals("jdbc_test2", jdbcTest2Conn.getCatalog());
+    jdbcTest2Conn.close();
+
+    executeString("DROP DATABASE jdbc_test1");
+    executeString("DROP DATABASE jdbc_test2");
+  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestExecutionBlockCursor.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestExecutionBlockCursor.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestExecutionBlockCursor.java
index d862e87..869d199 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestExecutionBlockCursor.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestExecutionBlockCursor.java
@@ -19,10 +19,7 @@ import org.apache.tajo.LocalTajoTestingUtility;
 import org.apache.tajo.TajoTestingCluster;
 import org.apache.tajo.algebra.Expr;
 import org.apache.tajo.benchmark.TPCH;
-import org.apache.tajo.catalog.CatalogService;
-import org.apache.tajo.catalog.CatalogUtil;
-import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.catalog.TableMeta;
+import org.apache.tajo.catalog.*;
 import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.conf.TajoConf;
@@ -41,6 +38,8 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import static org.apache.tajo.TajoConstants.DEFAULT_DATABASE_NAME;
+import static org.apache.tajo.TajoConstants.DEFAULT_TABLESPACE_NAME;
 import static org.junit.Assert.assertEquals;
 
 public class TestExecutionBlockCursor {
@@ -60,16 +59,19 @@ public class TestExecutionBlockCursor {
 
     conf = util.getConfiguration();
     catalog = util.getMiniCatalogCluster().getCatalog();
+    catalog.createTablespace(DEFAULT_TABLESPACE_NAME, "hdfs://localhost:!234/warehouse");
+    catalog.createDatabase(DEFAULT_DATABASE_NAME, DEFAULT_TABLESPACE_NAME);
     TPCH tpch = new TPCH();
     tpch.loadSchemas();
     tpch.loadOutSchema();
     for (String table : tpch.getTableNames()) {
       TableMeta m = CatalogUtil.newTableMeta(CatalogProtos.StoreType.CSV);
-      TableDesc d = CatalogUtil.newTableDesc(table, tpch.getSchema(table), m, CommonTestingUtil.getTestDir());
+      TableDesc d = CatalogUtil.newTableDesc(
+          CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, table), tpch.getSchema(table), m, CommonTestingUtil.getTestDir());
       TableStats stats = new TableStats();
       stats.setNumBytes(TPCH.tableVolumes.get(table));
       d.setStats(stats);
-      catalog.addTable(d);
+      catalog.createTable(d);
     }
 
     analyzer = new SQLAnalyzer();
@@ -98,7 +100,7 @@ public class TestExecutionBlockCursor {
             "join supplier on s_nationkey = n_nationkey " +
             "join partsupp on s_suppkey = ps_suppkey " +
             "join part on p_partkey = ps_partkey and p_type like '%BRASS' and p_size = 15");
-    LogicalPlan logicalPlan = logicalPlanner.createPlan(context);
+    LogicalPlan logicalPlan = logicalPlanner.createPlan(LocalTajoTestingUtility.createDummySession(), context);
     optimizer.optimize(logicalPlan);
     QueryContext queryContext = new QueryContext();
     MasterPlan plan = new MasterPlan(LocalTajoTestingUtility.newQueryId(), queryContext, logicalPlan);

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestGlobalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestGlobalPlanner.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestGlobalPlanner.java
index 4c7c9c5..4d3b096 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestGlobalPlanner.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/TestGlobalPlanner.java
@@ -42,6 +42,9 @@ import org.junit.Test;
 import java.io.File;
 import java.io.IOException;
 
+import static org.apache.tajo.TajoConstants.DEFAULT_DATABASE_NAME;
+import static org.apache.tajo.TajoConstants.DEFAULT_TABLESPACE_NAME;
+
 public class TestGlobalPlanner {
 
   private static TajoTestingCluster util;
@@ -60,6 +63,8 @@ public class TestGlobalPlanner {
     for (FunctionDesc funcDesc : TajoMaster.initBuiltinFunctions()) {
       catalog.createFunction(funcDesc);
     }
+    catalog.createTablespace(DEFAULT_TABLESPACE_NAME, "hdfs://localhost:1234/warehouse");
+    catalog.createDatabase(DEFAULT_DATABASE_NAME, DEFAULT_TABLESPACE_NAME);
 
     // TPC-H Schema for Complex Queries
     String [] tables = {
@@ -75,9 +80,11 @@ public class TestGlobalPlanner {
       TableMeta m = CatalogUtil.newTableMeta(CatalogProtos.StoreType.CSV);
       TableStats stats = new TableStats();
       stats.setNumBytes(volumes[i]);
-      TableDesc d = CatalogUtil.newTableDesc(tables[i], tpch.getSchema(tables[i]), m, CommonTestingUtil.getTestDir());
+      TableDesc d = CatalogUtil.newTableDesc(
+          CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME, tables[i]), tpch.getSchema(tables[i]), m,
+          CommonTestingUtil.getTestDir());
       d.setStats(stats);
-      catalog.addTable(d);
+      catalog.createTable(d);
     }
 
     sqlAnalyzer = new SQLAnalyzer();
@@ -93,7 +100,7 @@ public class TestGlobalPlanner {
 
   private MasterPlan buildPlan(String sql) throws PlanningException, IOException {
     Expr expr = sqlAnalyzer.parse(sql);
-    LogicalPlan plan = planner.createPlan(expr);
+    LogicalPlan plan = planner.createPlan(LocalTajoTestingUtility.createDummySession(), expr);
     optimizer.optimize(plan);
     QueryContext context = new QueryContext();
     MasterPlan masterPlan = new MasterPlan(LocalTajoTestingUtility.newQueryId(), context, plan);

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/querymaster/TestQueryUnitStatusUpdate.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/querymaster/TestQueryUnitStatusUpdate.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/querymaster/TestQueryUnitStatusUpdate.java
index 5d3f7bf..ddf8ecb 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/querymaster/TestQueryUnitStatusUpdate.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/querymaster/TestQueryUnitStatusUpdate.java
@@ -20,6 +20,7 @@ package org.apache.tajo.master.querymaster;
 
 import org.apache.tajo.IntegrationTest;
 import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.TajoConstants;
 import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.worker.TajoWorker;
 import org.junit.Test;
@@ -28,12 +29,16 @@ import org.junit.experimental.categories.Category;
 import java.sql.ResultSet;
 import java.util.*;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.apache.tajo.TajoConstants.DEFAULT_DATABASE_NAME;
+import static org.junit.Assert.*;
 
 @Category(IntegrationTest.class)
 public class TestQueryUnitStatusUpdate extends QueryTestCaseBase {
+
+  public TestQueryUnitStatusUpdate() {
+    super(TajoConstants.DEFAULT_DATABASE_NAME);
+  }
+
   @Test
   public final void case1() throws Exception {
     // select l_linenumber, count(1) as unique_key from lineitem group by l_linenumber;
@@ -96,9 +101,10 @@ public class TestQueryUnitStatusUpdate extends QueryTestCaseBase {
         "create table " + tableName + " (col1 int4, col2 int4) partition by column(key float8) ");
     res.close();
 
-    assertTrue(catalog.existsTable(tableName));
-    assertEquals(2, catalog.getTableDesc(tableName).getSchema().size());
-    assertEquals(3, catalog.getTableDesc(tableName).getLogicalSchema().size());
+    assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName));
+    assertEquals(2, catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName).getSchema().size());
+    assertEquals(3,
+        catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName).getLogicalSchema().size());
 
     res = testBase.execute(
         "insert overwrite into " + tableName + " select l_orderkey, l_partkey, l_quantity from lineitem");

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestRangeRetrieverHandler.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestRangeRetrieverHandler.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestRangeRetrieverHandler.java
index 65b7d1e..0b3a22c 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestRangeRetrieverHandler.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestRangeRetrieverHandler.java
@@ -24,6 +24,7 @@ import org.apache.commons.codec.binary.Base64;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.LocalTajoTestingUtility;
+import org.apache.tajo.TajoConstants;
 import org.apache.tajo.TajoTestingCluster;
 import org.apache.tajo.algebra.Expr;
 import org.apache.tajo.catalog.*;
@@ -55,6 +56,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import static org.apache.tajo.TajoConstants.DEFAULT_TABLESPACE_NAME;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -75,10 +77,12 @@ public class TestRangeRetrieverHandler {
   public void setUp() throws Exception {
     util = new TajoTestingCluster();
     conf = util.getConfiguration();
-    testDir = CommonTestingUtil.getTestDir("target/test-data/TestRangeRetrieverHandler");
+    testDir = CommonTestingUtil.getTestDir();
     fs = testDir.getFileSystem(conf);
     util.startCatalogCluster();
     catalog = util.getMiniCatalogCluster().getCatalog();
+    catalog.createTablespace(DEFAULT_TABLESPACE_NAME, testDir.toUri().toString());
+    catalog.createDatabase(TajoConstants.DEFAULT_DATABASE_NAME, DEFAULT_TABLESPACE_NAME);
     sm = StorageManagerFactory.getStorageManager(conf, testDir);
 
     analyzer = new SQLAnalyzer();
@@ -129,16 +133,18 @@ public class TestRangeRetrieverHandler {
     appender.flush();
     appender.close();
 
-    TableDesc employee = new TableDesc("employee", schema, employeeMeta, tableDir);
-    catalog.addTable(employee);
+    TableDesc employee = new TableDesc(
+        CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, "employee"), schema, employeeMeta,
+        tableDir);
+    catalog.createTable(employee);
 
-    FileFragment[] frags = StorageManager.splitNG(conf, "employee", employeeMeta, tableDir, Integer.MAX_VALUE);
+    FileFragment[] frags = StorageManager.splitNG(conf, "default.employee", employeeMeta, tableDir, Integer.MAX_VALUE);
 
     TaskAttemptContext ctx = new TaskAttemptContext(conf, LocalTajoTestingUtility.newQueryUnitAttemptId(),
         new FileFragment[] {frags[0]}, testDir);
     ctx.setEnforcer(new Enforcer());
     Expr expr = analyzer.parse(SORT_QUERY[0]);
-    LogicalPlan plan = planner.createPlan(expr);
+    LogicalPlan plan = planner.createPlan(LocalTajoTestingUtility.createDummySession(), expr);
     LogicalNode rootNode = optimizer.optimize(plan);
 
     PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf,sm);
@@ -250,17 +256,18 @@ public class TestRangeRetrieverHandler {
     appender.flush();
     appender.close();
 
-    TableDesc employee = new TableDesc("employee", schema, meta, tablePath);
-    catalog.addTable(employee);
+    TableDesc employee = new TableDesc(
+        CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, "employee"), schema, meta, tablePath);
+    catalog.createTable(employee);
 
-    FileFragment[] frags = sm.splitNG(conf, "employee", meta, tablePath, Integer.MAX_VALUE);
+    FileFragment[] frags = sm.splitNG(conf, "default.employee", meta, tablePath, Integer.MAX_VALUE);
 
     TaskAttemptContext
         ctx = new TaskAttemptContext(conf, LocalTajoTestingUtility.newQueryUnitAttemptId(),
         new FileFragment[] {frags[0]}, testDir);
     ctx.setEnforcer(new Enforcer());
     Expr expr = analyzer.parse(SORT_QUERY[1]);
-    LogicalPlan plan = planner.createPlan(expr);
+    LogicalPlan plan = planner.createPlan(LocalTajoTestingUtility.createDummySession(), expr);
     LogicalNode rootNode = optimizer.optimize(plan);
 
     PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf,sm);

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1.tbl
deleted file mode 100644
index 8095c0b..0000000
--- a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1.tbl
+++ /dev/null
@@ -1,3 +0,0 @@
-1|abc|2
-2|def|5
-3|ghi|8
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1/table1.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1/table1.tbl
new file mode 100644
index 0000000..8095c0b
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table1/table1.tbl
@@ -0,0 +1,3 @@
+1|abc|2
+2|def|5
+3|ghi|8
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table1.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table1.tbl
deleted file mode 100644
index 6405b31..0000000
--- a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table1.tbl
+++ /dev/null
@@ -1,5 +0,0 @@
-1|ooo|1.1|a
-2|ppp|2.3|b
-3|qqq|3.4|c
-4|rrr|4.5|d
-5|xxx|5.6|e
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table1/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table1/table1.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table1/table1.tbl
new file mode 100644
index 0000000..6405b31
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table1/table1.tbl
@@ -0,0 +1,5 @@
+1|ooo|1.1|a
+2|ppp|2.3|b
+3|qqq|3.4|c
+4|rrr|4.5|d
+5|xxx|5.6|e
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table2.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table2.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table2.tbl
deleted file mode 100644
index 68340bf..0000000
--- a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table2.tbl
+++ /dev/null
@@ -1,4 +0,0 @@
-1|NULL|NULL|a
-2|NULL|NULL|b
-NULL|NULL|10.0|c
-NULL|NULL|20.0|d
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table2/table2.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table2/table2.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table2/table2.tbl
new file mode 100644
index 0000000..68340bf
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestJoinQuery/table2/table2.tbl
@@ -0,0 +1,4 @@
+1|NULL|NULL|a
+2|NULL|NULL|b
+NULL|NULL|10.0|c
+NULL|NULL|20.0|d
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table1.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table1.tbl
deleted file mode 100644
index 63db89d..0000000
--- a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table1.tbl
+++ /dev/null
@@ -1,5 +0,0 @@
-1|ooo|1.1|a|127.0.0.1
-2|ppp|2.3|b|127.0.1.1
-3|qqq|3.4|c|127.0.0.8
-4|rrr|4.5|d|127.0.0.1
-5|xxx|5.6|e|127.0.1.1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table1/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table1/table1.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table1/table1.tbl
new file mode 100644
index 0000000..63db89d
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table1/table1.tbl
@@ -0,0 +1,5 @@
+1|ooo|1.1|a|127.0.0.1
+2|ppp|2.3|b|127.0.1.1
+3|qqq|3.4|c|127.0.0.8
+4|rrr|4.5|d|127.0.0.1
+5|xxx|5.6|e|127.0.1.1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table2.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table2.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table2.tbl
deleted file mode 100644
index f33b22c..0000000
--- a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table2.tbl
+++ /dev/null
@@ -1,4 +0,0 @@
-1|NULL|NULL|a|127.0.0.8
-2|NULL|NULL|b|127.0.0.8
-NULL|NULL|10.0|c|NULL
-NULL|NULL|20.0|d|127.0.0.1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table2/table2.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table2/table2.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table2/table2.tbl
new file mode 100644
index 0000000..f33b22c
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestNetTypes/table2/table2.tbl
@@ -0,0 +1,4 @@
+1|NULL|NULL|a|127.0.0.8
+2|NULL|NULL|b|127.0.0.8
+NULL|NULL|10.0|c|NULL
+NULL|NULL|20.0|d|127.0.0.1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table1.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table1.tbl
deleted file mode 100644
index a1ebde3..0000000
--- a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table1.tbl
+++ /dev/null
@@ -1,5 +0,0 @@
-1997-11-09 20:34:56|1996-04-12|15:34:56
-1997-11-09 20:34:56|1996-03-13|19:34:56
-1993-11-09 20:34:56|1997-01-28|08:34:56
-1995-11-09 20:34:56|1994-02-02|17:34:56
-1995-11-09 20:34:56|1993-11-09|20:34:56
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table1/table1.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table1/table1.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table1/table1.tbl
new file mode 100644
index 0000000..a1ebde3
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table1/table1.tbl
@@ -0,0 +1,5 @@
+1997-11-09 20:34:56|1996-04-12|15:34:56
+1997-11-09 20:34:56|1996-03-13|19:34:56
+1993-11-09 20:34:56|1997-01-28|08:34:56
+1995-11-09 20:34:56|1994-02-02|17:34:56
+1995-11-09 20:34:56|1993-11-09|20:34:56
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table2.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table2.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table2.tbl
deleted file mode 100644
index bc237af..0000000
--- a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table2.tbl
+++ /dev/null
@@ -1,24 +0,0 @@
-1,2132
-1,15635
-1,24027
-1,63700
-1,67310
-1,155190
-2,106170
-3,4297
-3,19036
-3,29380
-3,62143
-3,128449
-3,183095
-4,88035
-5,37531
-5,108570
-5,123927
-6,139636
-7,79251
-7,94780
-7,145243
-7,151894
-7,157238
-7,163073

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table2/table2.tbl
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table2/table2.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table2/table2.tbl
new file mode 100644
index 0000000..bc237af
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestSortQuery/table2/table2.tbl
@@ -0,0 +1,24 @@
+1,2132
+1,15635
+1,24027
+1,63700
+1,67310
+1,155190
+2,106170
+3,4297
+3,19036
+3,29380
+3,62143
+3,128449
+3,183095
+4,88035
+5,37531
+5,108570
+5,123927
+6,139636
+7,79251
+7,94780
+7,145243
+7,151894
+7,157238
+7,163073

http://git-wip-us.apache.org/repos/asf/tajo/blob/3ba26241/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/create_table_various_types.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/create_table_various_types.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/create_table_various_types.sql
index 92a4990..891a139 100644
--- a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/create_table_various_types.sql
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/create_table_various_types.sql
@@ -1,3 +1,5 @@
+-- Some types were commented out due to Hive meta test.
+
 create table various_types (
   col0 bit,
   col1 BIT(10),