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

git commit: TAJO-70: Refactor GlobalEngine to handle DDL statements. (hyunsik)

Updated Branches:
  refs/heads/master 592313aab -> b9a66ac9c


TAJO-70: Refactor GlobalEngine to handle DDL statements. (hyunsik)


Project: http://git-wip-us.apache.org/repos/asf/incubator-tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tajo/commit/b9a66ac9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tajo/tree/b9a66ac9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tajo/diff/b9a66ac9

Branch: refs/heads/master
Commit: b9a66ac9cae0b52707f30af746c28ff0a42f7b53
Parents: 592313a
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Jul 20 00:21:01 2013 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Jul 20 00:21:01 2013 +0900

----------------------------------------------------------------------
 CHANGES.txt                                     |   2 +
 .../catalog/exception/NoSuchTableException.java |   2 +-
 .../tajo/engine/parser/CreateTableStmt.java     |   3 -
 .../tajo/engine/parser/DropTableStmt.java       |  34 ++++
 .../tajo/engine/parser/QueryAnalyzer.java       |   9 +
 .../org/apache/tajo/master/ClientService.java   |  49 +----
 .../org/apache/tajo/master/GlobalEngine.java    | 182 +++++++++++--------
 .../java/org/apache/tajo/master/TajoMaster.java |   2 +-
 .../org/apache/tajo/client/TestTajoClient.java  |  26 ++-
 9 files changed, 185 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b9a66ac9/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 330280a..914cb3c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -10,6 +10,8 @@ Release 0.2.0 - unreleased
 
   IMPROVEMENTS
 
+    TAJO-70: Refactor GlobalEngine to handle DDL statements. (hyunsik)
+
     TAJO-86: Improved error messages in query analyzer. (jinho)
 
     TAJO-85: Add an method of create(DataType, byte[]) to DatumFactory. (jihoon)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b9a66ac9/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchTableException.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchTableException.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchTableException.java
index bd399b9..80b3b9f 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchTableException.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/exception/NoSuchTableException.java
@@ -25,6 +25,6 @@ public class NoSuchTableException extends CatalogException {
 	public NoSuchTableException() {}
 
 	public NoSuchTableException(String relName) {
-		super("No Such Relation in Catalog: "+relName);
+		super("ERROR: relation \"" + relName + "\" does not exist");
 	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b9a66ac9/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/CreateTableStmt.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/CreateTableStmt.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/CreateTableStmt.java
index 90b4a69..56aa14d 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/CreateTableStmt.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/CreateTableStmt.java
@@ -16,9 +16,6 @@
  * limitations under the License.
  */
 
-/**
- * 
- */
 package org.apache.tajo.engine.parser;
 
 import org.apache.hadoop.fs.Path;

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b9a66ac9/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/DropTableStmt.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/DropTableStmt.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/DropTableStmt.java
new file mode 100644
index 0000000..046c37c
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/DropTableStmt.java
@@ -0,0 +1,34 @@
+/**
+ * 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.parser;
+
+import org.apache.tajo.engine.planner.PlanningContext;
+
+public class DropTableStmt extends ParseTree {
+  private final String tableName;
+
+  public DropTableStmt(PlanningContext context, final String tableName) {
+    super(context, StatementType.DROP_TABLE);
+    this.tableName = tableName;
+  }
+
+  public String getTableName() {
+    return tableName;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b9a66ac9/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/QueryAnalyzer.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/QueryAnalyzer.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/QueryAnalyzer.java
index 6238300..ee698d3 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/QueryAnalyzer.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/QueryAnalyzer.java
@@ -110,6 +110,9 @@ public final class QueryAnalyzer {
         parseTree = parseCopyStatement(context, ast);
         break;
 
+      case DROP_TABLE:
+        parseTree = parseDropTableStatement(context, ast);
+
       default:
         break;
     }
@@ -138,6 +141,12 @@ public final class QueryAnalyzer {
     return stmt;
   }
 
+  private DropTableStmt parseDropTableStatement(final PlanningContext context, final CommonTree ast) {
+    int idx = 0;
+    String tableName = ast.getChild(idx).getText();
+    return new DropTableStmt(context, tableName);
+  }
+
   /**
    * t=table ASSIGN select_stmt -> ^(CREATE_TABLE $t select_stmt)
    * | CREATE TABLE t=table AS select_stmt -> ^(CREATE_TABLE $t select_stmt)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b9a66ac9/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/ClientService.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/ClientService.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/ClientService.java
index 6da82cb..7116b13 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/ClientService.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/ClientService.java
@@ -46,7 +46,6 @@ import org.apache.tajo.rpc.ProtoBlockingRpcServer;
 import org.apache.tajo.rpc.RemoteException;
 import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.BoolProto;
 import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.StringProto;
-import org.apache.tajo.storage.StorageUtil;
 import org.apache.tajo.util.TajoIdUtils;
 
 import java.io.IOException;
@@ -289,59 +288,25 @@ public class ClientService extends AbstractService {
     }
 
     @Override
-    public TableResponse createTable(RpcController controller,
-                                     CreateTableRequest request)
+    public TableResponse createTable(RpcController controller, CreateTableRequest request)
         throws ServiceException {
-      if (catalog.existsTable(request.getName())) {
-        throw new AlreadyExistsTableException(request.getName());
-      }
-
       Path path = new Path(request.getPath());
-      LOG.info(path.toUri());
-
-      long totalSize = 0;
-      try {
-        totalSize = calculateSize(new Path(path, "data"));
-      } catch (IOException e) {
-        LOG.error("Cannot calculate the size of the relation", e);
-      }
-
       TableMeta meta = new TableMetaImpl(request.getMeta());
-      TableStat stat = new TableStat();
-      stat.setNumBytes(totalSize);
-      meta.setStat(stat);
-
-      TableDesc desc = new TableDescImpl(request.getName(),meta, path);
+      TableDesc desc;
       try {
-        StorageUtil.writeTableMeta(conf, path, desc.getMeta());
-      } catch (IOException e) {
-        LOG.error("Cannot write the table meta file", e);
+        desc = context.getGlobalEngine().createTable(request.getName(), meta, path);
+      } catch (Exception e) {
+        return TableResponse.newBuilder().setErrorMessage(e.getMessage()).build();
       }
-      catalog.addTable(desc);
-      LOG.info("Table " + desc.getId() + " is created (" + meta.getStat().getNumBytes() + ")");
 
-      return TableResponse.newBuilder().
-          setTableDesc((TableDescProto) desc.getProto())
-          .build();
+      return TableResponse.newBuilder().setTableDesc((TableDescProto) desc.getProto()).build();
     }
 
     @Override
     public BoolProto dropTable(RpcController controller,
                                StringProto tableNameProto)
         throws ServiceException {
-      String tableName = tableNameProto.getValue();
-      if (!catalog.existsTable(tableName)) {
-        throw new NoSuchTableException(tableName);
-      }
-
-      Path path = catalog.getTableDesc(tableName).getPath();
-      catalog.deleteTable(tableName);
-      try {
-        context.getStorageManager().delete(path);
-      } catch (IOException e) {
-        throw new RemoteException(e);
-      }
-      LOG.info("Table is dropped" + tableName);
+      context.getGlobalEngine().dropTable(tableNameProto.getValue());
       return BOOL_TRUE;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b9a66ac9/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
index 5e9a547..6e78452 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/GlobalEngine.java
@@ -20,29 +20,30 @@ package org.apache.tajo.master;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse;
 import org.apache.hadoop.yarn.api.records.*;
 import org.apache.hadoop.yarn.client.YarnClient;
 import org.apache.hadoop.yarn.client.YarnClientImpl;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
-import org.apache.hadoop.yarn.factories.RecordFactory;
-import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.service.AbstractService;
 import org.apache.hadoop.yarn.util.Records;
 import org.apache.tajo.QueryConf;
 import org.apache.tajo.QueryId;
+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.exception.AlreadyExistsTableException;
+import org.apache.tajo.catalog.exception.NoSuchTableException;
 import org.apache.tajo.catalog.statistics.TableStat;
 import org.apache.tajo.engine.exception.EmptyClusterException;
 import org.apache.tajo.engine.exception.IllegalQueryStatusException;
 import org.apache.tajo.engine.exception.NoSuchQueryIdException;
 import org.apache.tajo.engine.exception.UnknownWorkerException;
+import org.apache.tajo.engine.parser.DropTableStmt;
 import org.apache.tajo.engine.parser.QueryAnalyzer;
 import org.apache.tajo.engine.parser.StatementType;
 import org.apache.tajo.engine.planner.LogicalOptimizer;
@@ -51,7 +52,6 @@ import org.apache.tajo.engine.planner.PlanningContext;
 import org.apache.tajo.engine.planner.global.GlobalOptimizer;
 import org.apache.tajo.engine.planner.global.MasterPlan;
 import org.apache.tajo.engine.planner.logical.CreateTableNode;
-import org.apache.tajo.engine.planner.logical.ExprType;
 import org.apache.tajo.engine.planner.logical.LogicalNode;
 import org.apache.tajo.engine.planner.logical.LogicalRootNode;
 import org.apache.tajo.engine.query.exception.TQLSyntaxError;
@@ -61,7 +61,6 @@ import org.apache.tajo.storage.StorageUtil;
 import org.apache.tajo.util.TajoIdUtils;
 
 import java.io.IOException;
-import java.net.InetSocketAddress;
 import java.util.EnumSet;
 import java.util.Set;
 
@@ -73,22 +72,21 @@ public class GlobalEngine extends AbstractService {
   private final MasterContext context;
   private final StorageManager sm;
 
+  private CatalogService catalog;
   private QueryAnalyzer analyzer;
   private LogicalPlanner planner;
   private GlobalPlanner globalPlanner;
   private GlobalOptimizer globalOptimizer;
 
   // Yarn
-  private final RecordFactory recordFactory =
-      RecordFactoryProvider.getRecordFactory(null);
   protected YarnClient yarnClient;
-  protected InetSocketAddress rmAddress;
 
-  public GlobalEngine(final MasterContext context, final StorageManager sm)
+  public GlobalEngine(final MasterContext context)
       throws IOException {
     super(GlobalEngine.class.getName());
     this.context = context;
-    this.sm = sm;
+    this.catalog = context.getCatalog();
+    this.sm = context.getStorageManager();
   }
 
   public void start() {
@@ -112,55 +110,23 @@ public class GlobalEngine extends AbstractService {
     yarnClient.stop();
   }
 
-  private String createTable(LogicalRootNode root) throws IOException {
-    // create table queries are executed by the master
-    CreateTableNode createTable = (CreateTableNode) root.getSubNode();
-    TableMeta meta;
-    if (createTable.hasOptions()) {
-      meta = CatalogUtil.newTableMeta(createTable.getSchema(),
-          createTable.getStorageType(), createTable.getOptions());
-    } else {
-      meta = CatalogUtil.newTableMeta(createTable.getSchema(),
-          createTable.getStorageType());
-    }
-
-    FileSystem fs = createTable.getPath().getFileSystem(context.getConf());
-    if(fs.exists(createTable.getPath()) && fs.isFile(createTable.getPath())) {
-    	throw new IOException("ERROR: LOCATION must be a directory.");
-    }
-
-    long totalSize = 0;
-    try {
-      totalSize = sm.calculateSize(createTable.getPath());
-    } catch (IOException e) {
-      LOG.error("Cannot calculate the size of the relation", e);
-    }
-    TableStat stat = new TableStat();
-    stat.setNumBytes(totalSize);
-    meta.setStat(stat);
-
-    StorageUtil.writeTableMeta(context.getConf(), createTable.getPath(), meta);
-    TableDesc desc = CatalogUtil.newTableDesc(createTable.getTableName(), meta,
-        createTable.getPath());
-    context.getCatalog().addTable(desc);
-    return desc.getId();
-  }
-  
   public QueryId executeQuery(String tql)
       throws InterruptedException, IOException,
       NoSuchQueryIdException, IllegalQueryStatusException,
       UnknownWorkerException, EmptyClusterException {
     long querySubmittionTime = context.getClock().getTime();
-    LOG.info("TQL: " + tql);
+    LOG.info("SQL: " + tql);
     // parse the query
     PlanningContext planningContext = analyzer.parse(tql);
-    LogicalRootNode plan = (LogicalRootNode) createLogicalPlan(planningContext);
 
-    if (plan.getSubNode().getType() == ExprType.CREATE_TABLE) {
-      createTable(plan);
+    StatementType cmdType = planningContext.getParseTree().getStatementType();
 
+    if (cmdType == StatementType.CREATE_TABLE || cmdType == StatementType.DROP_TABLE) {
+      updateQuery(planningContext);
       return TajoIdUtils.NullQueryId;
     } else {
+      LogicalRootNode plan = (LogicalRootNode) createLogicalPlan(planningContext);
+
       ApplicationAttemptId appAttemptId = submitQuery();
       QueryId queryId = TajoIdUtils.createQueryId(appAttemptId);
       MasterPlan masterPlan = createGlobalPlan(queryId, plan);
@@ -171,15 +137,6 @@ public class GlobalEngine extends AbstractService {
       if (planningContext.hasExplicitOutputTable()) {
         queryConf.setOutputTable(planningContext.getExplicitOutputTable());
       }
-      /*
-        Path warehousePath = new Path(queryConf.getVar(ConfVars.WAREHOUSE_PATH));
-        Path outputDir = new Path(warehousePath, planningContext.getExplicitOutputTable());
-        queryConf.setOutputDir(outputDir);
-      } else {
-        Path queryTmpPath = new Path(queryConf.getVar(ConfVars.QUERY_TMP_DIR));
-        Path outputDir = new Path(queryTmpPath, queryId.toString());
-        queryConf.setOutputDir(outputDir);
-      } */
 
       QueryMaster query = new QueryMaster(context, appAttemptId,
           context.getClock(), querySubmittionTime, masterPlan);
@@ -234,6 +191,31 @@ public class GlobalEngine extends AbstractService {
     return attemptId;
   }
 
+  public boolean updateQuery(String sql) throws IOException {
+    LOG.info("SQL: " + sql);
+    PlanningContext planningContext = analyzer.parse(sql);
+    return updateQuery(planningContext);
+  }
+
+  public boolean updateQuery(PlanningContext planningContext) throws IOException {
+    StatementType type = planningContext.getParseTree().getStatementType();
+
+    switch (type) {
+      case CREATE_TABLE:
+        LogicalRootNode plan = (LogicalRootNode) createLogicalPlan(planningContext);
+        createTable(plan);
+        return true;
+
+      case DROP_TABLE:
+        DropTableStmt stmt = (DropTableStmt) planningContext.getParseTree();
+        dropTable(stmt.getTableName());
+        return true;
+
+      default:
+        throw new TQLSyntaxError(planningContext.getRawQuery(), "updateQuery cannot handle such query");
+    }
+  }
+
   private LogicalNode createLogicalPlan(PlanningContext planningContext)
       throws IOException {
 
@@ -258,18 +240,79 @@ public class GlobalEngine extends AbstractService {
     query.start();
   }
 
-  public boolean updateQuery(String tql) throws IOException {
-    LOG.info("TQL: " + tql);
+  private TableDesc createTable(LogicalRootNode root) throws IOException {
+    CreateTableNode createTable = (CreateTableNode) root.getSubNode();
+    TableMeta meta;
+
+    if (createTable.hasOptions()) {
+      meta = CatalogUtil.newTableMeta(createTable.getSchema(),
+          createTable.getStorageType(), createTable.getOptions());
 
-    PlanningContext planningContext = analyzer.parse(tql);
-    if (planningContext.getParseTree().getStatementType()
-        == StatementType.CREATE_TABLE) {
-      LogicalRootNode plan = (LogicalRootNode) createLogicalPlan(planningContext);
-      createTable(plan);
-      return true;
     } else {
-      throw new TQLSyntaxError(tql, "updateQuery cannot handle such query");
+      meta = CatalogUtil.newTableMeta(createTable.getSchema(),
+          createTable.getStorageType());
+
+    }
+
+    return createTable(createTable.getTableName(), meta, createTable.getPath());
+  }
+
+  public TableDesc createTable(String tableName, TableMeta meta, Path path) throws IOException {
+    if (catalog.existsTable(tableName)) {
+      throw new AlreadyExistsTableException(tableName);
+    }
+
+    FileSystem fs = path.getFileSystem(context.getConf());
+
+    if(fs.exists(path) && fs.isFile(path)) {
+      throw new IOException("ERROR: LOCATION must be a directory.");
+    }
+
+    long totalSize = 0;
+
+    try {
+      totalSize = sm.calculateSize(path);
+    } catch (IOException e) {
+      LOG.error("Cannot calculate the size of the relation", e);
+    }
+
+    TableStat stat = new TableStat();
+    stat.setNumBytes(totalSize);
+    meta.setStat(stat);
+
+    TableDesc desc = CatalogUtil.newTableDesc(tableName, meta, path);
+    StorageUtil.writeTableMeta(context.getConf(), path, meta);
+    catalog.addTable(desc);
+
+    LOG.info("Table " + desc.getId() + " is created (" + desc.getMeta().getStat().getNumBytes() + ")");
+
+    return desc;
+  }
+
+  /**
+   * Drop a given named table
+   *
+   * @param tableName to be dropped
+   */
+  public void dropTable(String tableName) {
+    CatalogService catalog = context.getCatalog();
+
+    if (!catalog.existsTable(tableName)) {
+      throw new NoSuchTableException(tableName);
+    }
+
+    Path path = catalog.getTableDesc(tableName).getPath();
+    catalog.deleteTable(tableName);
+
+    try {
+
+      FileSystem fs = path.getFileSystem(context.getConf());
+      fs.delete(path, true);
+    } catch (IOException e) {
+      throw new InternalError(e.getMessage());
     }
+
+    LOG.info("Table \"" + tableName + "\" is dropped.");
   }
 
   private void connectYarnClient() {
@@ -278,11 +321,6 @@ public class GlobalEngine extends AbstractService {
     this.yarnClient.start();
   }
 
-  private static InetSocketAddress getRmAddress(Configuration conf) {
-    return conf.getSocketAddr(YarnConfiguration.RM_ADDRESS,
-        YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT);
-  }
-
   public GetNewApplicationResponse getNewApplication()
       throws YarnRemoteException {
     return yarnClient.getNewApplication();

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b9a66ac9/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
index b35285e..5f379ab 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
@@ -144,7 +144,7 @@ public class TajoMaster extends CompositeService {
       addIfService(catalogServer);
       catalog = new LocalCatalog(catalogServer);
 
-      globalEngine = new GlobalEngine(context, storeManager);
+      globalEngine = new GlobalEngine(context);
       addIfService(globalEngine);
 
       dispatcher.register(QueryEventType.class, new QueryEventDispatcher());

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b9a66ac9/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
index 1bdce52..5360e79 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/client/TestTajoClient.java
@@ -111,6 +111,27 @@ public class TestTajoClient {
   }
 
   @Test
+  public final void testCreateAndDropTableByExecuteQuery() throws IOException, ServiceException {
+    TajoConf conf = util.getConfiguration();
+    final String tableName = "testCreateAndDropTableByExecuteQuery";
+
+    BackendTestingUtil.writeTmpTable(conf, "file:///tmp", tableName, false);
+    Path tablePath = writeTmpTable(tableName);
+    assertFalse(tajo.existTable(tableName));
+
+    String tql = "create external table " + tableName + " (deptname text, score int4) " + "using csv location '"
+        + tablePath + "'";
+
+    tajo.executeQueryAndGetResult(tql);
+    assertTrue(tajo.existTable(tableName));
+
+    tajo.updateQuery("drop table " + tableName);
+    assertFalse(tajo.existTable(tableName));
+    FileSystem localFS = FileSystem.getLocal(conf);
+    assertFalse(localFS.exists(tablePath));
+  }
+
+  @Test
   public final void testDDLByExecuteQuery() throws IOException, ServiceException {
     TajoConf conf = util.getConfiguration();
     final String tableName = "testDDLByExecuteQuery";
@@ -124,11 +145,6 @@ public class TestTajoClient {
     assertTrue(tajo.existTable(tableName));
   }
 
-  // disabled
-  public final void testGetClusterInfo() throws IOException, InterruptedException {
-    assertEquals(1,tajo.getClusterInfo().size());
-  }
-
   @Test
   public final void testGetTableList() throws IOException, ServiceException {
     final String tableName1 = "table1";