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/12/30 10:18:00 UTC

[4/6] TAJO-456: Separate tajo-jdbc and tajo-client from tajo-core-backend. (hyunsik)

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/QueryStatus.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/QueryStatus.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/QueryStatus.java
deleted file mode 100644
index 203f9aa..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/QueryStatus.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * 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.client;
-
-import org.apache.tajo.QueryId;
-import org.apache.tajo.TajoProtos.QueryState;
-import org.apache.tajo.ipc.ClientProtos.GetQueryStatusResponse;
-
-public class QueryStatus {
-  private QueryId queryId;
-  private QueryState state;
-  private float progress;
-  private long submitTime;
-  private long finishTime;
-  private boolean hasResult;
-  private String errorText;
-  private String queryMasterHost;
-  private int queryMasterPort;
-
-  public QueryStatus(GetQueryStatusResponse proto) {
-    queryId = new QueryId(proto.getQueryId());
-    state = proto.getState();
-    progress = proto.getProgress();
-    submitTime = proto.getSubmitTime();
-    finishTime = proto.getFinishTime();
-    hasResult = proto.getHasResult();
-    if (proto.hasErrorMessage()) {
-      errorText = proto.getErrorMessage();
-    }
-
-    queryMasterHost = proto.getQueryMasterHost();
-    queryMasterPort = proto.getQueryMasterPort();
-  }
-
-  public String getQueryMasterHost() {
-    return queryMasterHost;
-  }
-
-  public int getQueryMasterPort() {
-    return queryMasterPort;
-  }
-
-  public QueryId getQueryId() {
-    return this.queryId;
-  }
-
-  public QueryState getState() {
-    return this.state;
-  }
-
-  public float getProgress() {
-    return progress;
-  }
-
-  public long getSubmitTime() {
-    return this.submitTime;
-  }
-
-  public long getFinishTime() {
-    return this.finishTime;
-  }
-
-  public boolean hasResult() {
-    return this.hasResult;
-  }
-
-  public String getErrorMessage() {
-    return errorText;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/ResultSetUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/ResultSetUtil.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/ResultSetUtil.java
deleted file mode 100644
index 7644e97..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/ResultSetUtil.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.client;
-
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-
-public class ResultSetUtil {
-  public static String prettyFormat(ResultSet res) throws SQLException {
-    StringBuilder sb = new StringBuilder();
-    ResultSetMetaData rsmd = res.getMetaData();
-    int numOfColumns = rsmd.getColumnCount();
-
-    for (int i = 1; i <= numOfColumns; i++) {
-      if (i > 1) sb.append(",  ");
-      String columnName = rsmd.getColumnName(i);
-      sb.append(columnName);
-    }
-    sb.append("\n-------------------------------\n");
-
-    while (res.next()) {
-      for (int i = 1; i <= numOfColumns; i++) {
-        if (i > 1) sb.append(",  ");
-        String columnValue = res.getObject(i).toString();
-        sb.append(columnValue);
-      }
-      sb.append("\n");
-    }
-
-    return sb.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/SQLStates.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/SQLStates.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/SQLStates.java
deleted file mode 100644
index 888170b..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/SQLStates.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.client;
-
-public enum SQLStates {
-  ER_NO_SUCH_TABLE("42S02");
-
-  private String state;
-
-  SQLStates(String state) {
-    this.state = state;
-  }
-
-  public String getState() {
-    return state;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/TajoClient.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/TajoClient.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/TajoClient.java
deleted file mode 100644
index 555ba16..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/TajoClient.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/**
- * 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.client;
-
-import com.google.protobuf.ServiceException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.fs.Path;
-import org.apache.tajo.QueryId;
-import org.apache.tajo.QueryIdFactory;
-import org.apache.tajo.TajoProtos.QueryState;
-import org.apache.tajo.annotation.ThreadSafe;
-import org.apache.tajo.catalog.CatalogUtil;
-import org.apache.tajo.catalog.Schema;
-import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.catalog.TableMeta;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.conf.TajoConf.ConfVars;
-import org.apache.tajo.ipc.ClientProtos.*;
-import org.apache.tajo.ipc.QueryMasterClientProtocol;
-import org.apache.tajo.ipc.QueryMasterClientProtocol.QueryMasterClientProtocolService;
-import org.apache.tajo.ipc.TajoMasterClientProtocol;
-import org.apache.tajo.ipc.TajoMasterClientProtocol.TajoMasterClientProtocolService;
-import org.apache.tajo.jdbc.TajoResultSet;
-import org.apache.tajo.rpc.*;
-import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.StringProto;
-import org.apache.tajo.util.NetUtils;
-import org.apache.tajo.rpc.ServerCallable;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-@ThreadSafe
-public class TajoClient {
-  private final Log LOG = LogFactory.getLog(TajoClient.class);
-
-  private final TajoConf conf;
-
-  private Map<QueryId, InetSocketAddress> queryMasterMap = new ConcurrentHashMap<QueryId, InetSocketAddress>();
-
-  private InetSocketAddress tajoMasterAddr;
-
-  private RpcConnectionPool connPool;
-
-  public TajoClient(TajoConf conf) throws IOException {
-    this(conf, NetUtils.createSocketAddr(conf.getVar(ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS)));
-  }
-
-  public TajoClient(TajoConf conf, InetSocketAddress addr) throws IOException {
-    this.conf = conf;
-    this.conf.set("tajo.disk.scheduler.report.interval", "0");
-    this.tajoMasterAddr = addr;
-
-    connPool = RpcConnectionPool.getPool(conf);
-  }
-
-  public TajoClient(InetSocketAddress addr) throws IOException {
-    this(new TajoConf(), addr);
-  }
-
-  public TajoClient(String hostname, int port) throws IOException {
-    this(new TajoConf(), NetUtils.createSocketAddr(hostname, port));
-  }
-
-  public void close() {
-    if(connPool != null) {
-      connPool.close();
-    }
-    queryMasterMap.clear();
-  }
-
-  public TajoConf getConf() {
-    return conf;
-  }
-
-  /**
-   * Call to QueryMaster closing query resources
-   * @param queryId
-   */
-  public void closeQuery(final QueryId queryId) {
-    if(queryMasterMap.containsKey(queryId)) {
-      NettyClientBase qmClient = null;
-      try {
-        qmClient = connPool.getConnection(queryMasterMap.get(queryId), QueryMasterClientProtocol.class, false);
-        QueryMasterClientProtocolService.BlockingInterface queryMasterService = qmClient.getStub();
-        queryMasterService.killQuery(null, queryId.getProto());
-      } catch (Exception e) {
-        LOG.warn("Fail to close a QueryMaster connection (qid=" + queryId + ", msg=" + e.getMessage() + ")", e);
-      } finally {
-        connPool.closeConnection(qmClient);
-        queryMasterMap.remove(queryId);
-      }
-    }
-  }
-
-  /**
-   * It submits a query statement and get a response immediately.
-   * The response only contains a query id, and submission status.
-   * In order to get the result, you should use {@link #getQueryResult(org.apache.tajo.QueryId)}
-   * or {@link #getQueryResultAndWait(org.apache.tajo.QueryId)}.
-   */
-  public GetQueryStatusResponse executeQuery(final String sql) throws ServiceException {
-    return new ServerCallable<GetQueryStatusResponse>(conf, tajoMasterAddr,
-        TajoMasterClientProtocol.class, false, true) {
-      public GetQueryStatusResponse call(NettyClientBase client) throws ServiceException {
-        final QueryRequest.Builder builder = QueryRequest.newBuilder();
-        builder.setQuery(sql);
-
-        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-        return tajoMasterService.submitQuery(null, builder.build());
-      }
-    }.withRetries();
-  }
-
-  /**
-   * It submits a query statement and get a response.
-   * The main difference from {@link #executeQuery(String)}
-   * is a blocking method. So, this method is wait for
-   * the finish of the submitted query.
-   *
-   * @return If failed, return null.
-   */
-  public ResultSet executeQueryAndGetResult(final String sql)
-      throws ServiceException, IOException {
-    GetQueryStatusResponse response = new ServerCallable<GetQueryStatusResponse>(conf, tajoMasterAddr,
-        TajoMasterClientProtocol.class, false, true) {
-      public GetQueryStatusResponse call(NettyClientBase client) throws ServiceException {
-        final QueryRequest.Builder builder = QueryRequest.newBuilder();
-        builder.setQuery(sql);
-
-        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-        return tajoMasterService.submitQuery(null, builder.build());
-      }
-    }.withRetries();
-
-    QueryId queryId = new QueryId(response.getQueryId());
-    if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
-      return this.createNullResultSet(queryId);
-    } else {
-      return this.getQueryResultAndWait(queryId);
-    }
-  }
-
-  public QueryStatus getQueryStatus(QueryId queryId) throws ServiceException {
-    GetQueryStatusRequest.Builder builder
-        = GetQueryStatusRequest.newBuilder();
-    builder.setQueryId(queryId.getProto());
-
-    GetQueryStatusResponse res = null;
-    if(queryMasterMap.containsKey(queryId)) {
-      NettyClientBase qmClient = null;
-      try {
-        qmClient = connPool.getConnection(queryMasterMap.get(queryId),
-            QueryMasterClientProtocol.class, false);
-        QueryMasterClientProtocolService.BlockingInterface queryMasterService = qmClient.getStub();
-        res = queryMasterService.getQueryStatus(null, builder.build());
-      } catch (Exception e) {
-        throw new ServiceException(e.getMessage(), e);
-      } finally {
-        connPool.closeConnection(qmClient);
-      }
-    } else {
-      NettyClientBase tmClient = null;
-      try {
-        tmClient = connPool.getConnection(tajoMasterAddr,
-            TajoMasterClientProtocol.class, false);
-        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = tmClient.getStub();
-        res = tajoMasterService.getQueryStatus(null, builder.build());
-
-        String queryMasterHost = res.getQueryMasterHost();
-        if(queryMasterHost != null && !queryMasterHost.isEmpty()) {
-          NettyClientBase qmClient = null;
-          try {
-            InetSocketAddress qmAddr = NetUtils.createSocketAddr(queryMasterHost, res.getQueryMasterPort());
-            qmClient = connPool.getConnection(
-                qmAddr, QueryMasterClientProtocol.class, false);
-            QueryMasterClientProtocolService.BlockingInterface queryMasterService = qmClient.getStub();
-            res = queryMasterService.getQueryStatus(null, builder.build());
-
-            queryMasterMap.put(queryId, qmAddr);
-          } catch (Exception e) {
-            throw new ServiceException(e.getMessage(), e);
-          } finally {
-            connPool.closeConnection(qmClient);
-          }
-        }
-      } catch (Exception e) {
-        throw new ServiceException(e.getMessage(), e);
-      } finally {
-        connPool.closeConnection(tmClient);
-      }
-    }
-    return new QueryStatus(res);
-  }
-
-  private static boolean isQueryRunnning(QueryState state) {
-    return state == QueryState.QUERY_NEW ||
-        state == QueryState.QUERY_RUNNING ||
-        state == QueryState.QUERY_MASTER_LAUNCHED ||
-        state == QueryState.QUERY_MASTER_INIT ||
-        state == QueryState.QUERY_NOT_ASSIGNED;
-  }
-
-  public ResultSet getQueryResult(QueryId queryId)
-      throws ServiceException, IOException {
-    if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
-      return createNullResultSet(queryId);
-    }
-    GetQueryResultResponse response = getResultResponse(queryId);
-    TableDesc tableDesc = CatalogUtil.newTableDesc(response.getTableDesc());
-    conf.setVar(ConfVars.USERNAME, response.getTajoUserName());
-    return new TajoResultSet(this, queryId, conf, tableDesc);
-  }
-
-  public ResultSet getQueryResultAndWait(QueryId queryId)
-      throws ServiceException, IOException {
-    if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
-      return createNullResultSet(queryId);
-    }
-    QueryStatus status = getQueryStatus(queryId);
-
-    while(status != null && isQueryRunnning(status.getState())) {
-      try {
-        Thread.sleep(500);
-      } catch (InterruptedException e) {
-        e.printStackTrace();
-      }
-
-      status = getQueryStatus(queryId);
-    }
-
-    if (status.getState() == QueryState.QUERY_SUCCEEDED) {
-      if (status.hasResult()) {
-        return getQueryResult(queryId);
-      } else {
-        return createNullResultSet(queryId);
-      }
-
-    } else {
-      LOG.warn("Query (" + status.getQueryId() + ") failed: " + status.getState());
-
-      //TODO throw SQLException(?)
-      return createNullResultSet(queryId);
-    }
-  }
-
-  public ResultSet createNullResultSet(QueryId queryId) throws IOException {
-    return new TajoResultSet(this, queryId);
-  }
-
-  public GetQueryResultResponse getResultResponse(QueryId queryId) throws ServiceException {
-    if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
-      return null;
-    }
-
-    NettyClientBase client = null;
-    try {
-      InetSocketAddress queryMasterAddr = queryMasterMap.get(queryId);
-      if(queryMasterAddr == null) {
-        LOG.warn("No Connection to QueryMaster for " + queryId);
-        return null;
-      }
-      client = connPool.getConnection(queryMasterAddr, QueryMasterClientProtocol.class, false);
-      QueryMasterClientProtocolService.BlockingInterface queryMasterService = client.getStub();
-      GetQueryResultRequest.Builder builder = GetQueryResultRequest.newBuilder();
-      builder.setQueryId(queryId.getProto());
-      GetQueryResultResponse response = queryMasterService.getQueryResult(null,
-          builder.build());
-
-      return response;
-    } catch (Exception e) {
-      throw new ServiceException(e.getMessage(), e);
-    } finally {
-      connPool.closeConnection(client);
-    }
-  }
-
-  public boolean updateQuery(final String sql) throws ServiceException {
-    return new ServerCallable<Boolean>(conf, tajoMasterAddr,
-        TajoMasterClientProtocol.class, false, true) {
-      public Boolean call(NettyClientBase client) throws ServiceException {
-        QueryRequest.Builder builder = QueryRequest.newBuilder();
-        builder.setQuery(sql);
-
-        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-        ResultCode resultCode =
-            tajoMasterService.updateQuery(null, builder.build()).getResultCode();
-        return resultCode == ResultCode.OK;
-      }
-    }.withRetries();
-  }
-
-  /**
-   * Test for the existence of table in catalog data.
-   * <p/>
-   * This will return true if table exists, false if not.
-   * @param name
-   * @return
-   * @throws ServiceException
-   */
-  public boolean existTable(final String name) throws ServiceException {
-    return new ServerCallable<Boolean>(conf, tajoMasterAddr,
-        TajoMasterClientProtocol.class, false, true) {
-      public Boolean call(NettyClientBase client) throws ServiceException {
-        StringProto.Builder builder = StringProto.newBuilder();
-        builder.setValue(name);
-
-        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-        return tajoMasterService.existTable(null, builder.build()).getValue();
-      }
-    }.withRetries();
-  }
-
-  public TableDesc createExternalTable(final String name, final Schema schema, final Path path, final TableMeta meta)
-      throws SQLException, ServiceException {
-    return new ServerCallable<TableDesc>(conf, tajoMasterAddr,
-        TajoMasterClientProtocol.class, false, true) {
-      public TableDesc call(NettyClientBase client) throws ServiceException, SQLException {
-        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-
-        CreateTableRequest.Builder builder = CreateTableRequest.newBuilder();
-        builder.setName(name);
-        builder.setSchema(schema.getProto());
-        builder.setMeta(meta.getProto());
-        builder.setPath(path.toUri().toString());
-        TableResponse res = tajoMasterService.createExternalTable(null, builder.build());
-        if (res.getResultCode() == ResultCode.OK) {
-          return CatalogUtil.newTableDesc(res.getTableDesc());
-        } else {
-          throw new SQLException(res.getErrorMessage(), SQLStates.ER_NO_SUCH_TABLE.getState());
-        }
-      }
-    }.withRetries();
-  }
-
-  public boolean dropTable(final String tableName) throws ServiceException {
-    return dropTable(tableName, false);
-  }
-
-  /**
-   * Deletes table schema from catalog data and deletes data file in hdfs
-   * @param tableName
-   * @return
-   * @throws ServiceException
-   */
-  public boolean dropTable(final String tableName, final boolean purge) throws ServiceException {
-    return new ServerCallable<Boolean>(conf, tajoMasterAddr,
-        TajoMasterClientProtocol.class, false, true) {
-      public Boolean call(NettyClientBase client) throws ServiceException {
-        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-
-        DropTableRequest.Builder builder = DropTableRequest.newBuilder();
-        builder.setName(tableName);
-        builder.setPurge(purge);
-        return tajoMasterService.dropTable(null, builder.build()).getValue();
-      }
-    }.withRetries();
-
-  }
-
-  /**
-   * Get a list of table names. All table and column names are
-   * represented as lower-case letters.
-   */
-  public List<String> getTableList() throws ServiceException {
-    return new ServerCallable<List<String>>(conf, tajoMasterAddr,
-        TajoMasterClientProtocol.class, false, true) {
-      public List<String> call(NettyClientBase client) throws ServiceException {
-        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-
-        GetTableListRequest.Builder builder = GetTableListRequest.newBuilder();
-        GetTableListResponse res = tajoMasterService.getTableList(null, builder.build());
-        return res.getTablesList();
-      }
-    }.withRetries();
-  }
-
-  public TableDesc getTableDesc(final String tableName) throws SQLException, ServiceException {
-    return new ServerCallable<TableDesc>(conf, tajoMasterAddr,
-        TajoMasterClientProtocol.class, false, true) {
-      public TableDesc call(NettyClientBase client) throws ServiceException, SQLException {
-        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-
-        GetTableDescRequest.Builder build = GetTableDescRequest.newBuilder();
-        build.setTableName(tableName);
-        TableResponse res = tajoMasterService.getTableDesc(null, build.build());
-        if (res.getResultCode() == ResultCode.OK) {
-          return CatalogUtil.newTableDesc(res.getTableDesc());
-        } else {
-          throw new SQLException(res.getErrorMessage(), SQLStates.ER_NO_SUCH_TABLE.getState());
-        }
-      }
-    }.withRetries();
-  }
-
-  public boolean killQuery(final QueryId queryId)
-      throws ServiceException, IOException {
-
-    QueryStatus status = getQueryStatus(queryId);
-
-    NettyClientBase tmClient = null;
-    try {
-      /* send a kill to the TM */
-      tmClient = connPool.getConnection(tajoMasterAddr, TajoMasterClientProtocol.class, false);
-      TajoMasterClientProtocolService.BlockingInterface tajoMasterService = tmClient.getStub();
-      tajoMasterService.killQuery(null, queryId.getProto());
-
-      long currentTimeMillis = System.currentTimeMillis();
-      long timeKillIssued = currentTimeMillis;
-      while ((currentTimeMillis < timeKillIssued + 10000L) && (status.getState()
-          != QueryState.QUERY_KILLED)) {
-        try {
-          Thread.sleep(1000L);
-        } catch(InterruptedException ie) {
-          /** interrupted, just break */
-          break;
-        }
-        currentTimeMillis = System.currentTimeMillis();
-        status = getQueryStatus(queryId);
-      }
-    } catch(Exception e) {
-      LOG.debug("Error when checking for application status", e);
-      return false;
-    } finally {
-      connPool.closeConnection(tmClient);
-    }
-
-    return true;
-  }
-
-  public static void main(String[] args) throws Exception {
-    TajoClient client = new TajoClient(new TajoConf());
-
-    client.close();
-
-    synchronized(client) {
-      client.wait();
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/TajoDump.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/TajoDump.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/TajoDump.java
deleted file mode 100644
index 486ff9f..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/client/TajoDump.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.client;
-
-import com.google.common.collect.Lists;
-import com.google.protobuf.ServiceException;
-import org.apache.commons.cli.*;
-import org.apache.tajo.catalog.DDLBuilder;
-import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.conf.TajoConf;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.sql.SQLException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.List;
-
-public class TajoDump {
-  private static final org.apache.commons.cli.Options options;
-
-  static {
-    options = new Options();
-    options.addOption("h", "host", true, "Tajo server host");
-    options.addOption("p", "port", true, "Tajo server port");
-    options.addOption("a", "all", false, "dump all table DDLs");
-  }
-
-  private static void printUsage() {
-    HelpFormatter formatter = new HelpFormatter();
-    formatter.printHelp( "tajo_dump [options] [table_name]", options );
-  }
-
-  public static void main(String [] args) throws ParseException, IOException, ServiceException, SQLException {
-    TajoConf conf = new TajoConf();
-
-    CommandLineParser parser = new PosixParser();
-    CommandLine cmd = parser.parse(options, args);
-
-    String hostName = null;
-    Integer port = null;
-    if (cmd.hasOption("h")) {
-      hostName = cmd.getOptionValue("h");
-    }
-    if (cmd.hasOption("p")) {
-      port = Integer.parseInt(cmd.getOptionValue("p"));
-    }
-
-    // if there is no "-h" option,
-    if(hostName == null) {
-      if (conf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS) != null) {
-        // it checks if the client service address is given in configuration and distributed mode.
-        // if so, it sets entryAddr.
-        hostName = conf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS).split(":")[0];
-      }
-    }
-    if (port == null) {
-      if (conf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS) != null) {
-        // it checks if the client service address is given in configuration and distributed mode.
-        // if so, it sets entryAddr.
-        port = Integer.parseInt(conf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS).split(":")[1]);
-      }
-    }
-
-    TajoClient client = null;
-    if ((hostName == null) ^ (port == null)) {
-      System.err.println("ERROR: cannot find valid Tajo server address");
-      System.exit(-1);
-    } else if (hostName != null && port != null) {
-      conf.setVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS, hostName+":"+port);
-      client = new TajoClient(conf);
-    } else if (hostName == null && port == null) {
-      client = new TajoClient(conf);
-    }
-
-    List<TableDesc> tableDescList = Lists.newArrayList();
-
-    if (cmd.hasOption("a")) {
-      for (String tableName : client.getTableList()) {
-        tableDescList.add(client.getTableDesc(tableName));
-      }
-    } else if (cmd.getArgs().length > 0) {
-      for (String tableName : cmd.getArgs()) {
-        tableDescList.add(client.getTableDesc(tableName));
-      }
-    } else {
-      printUsage();
-    }
-
-
-    Writer writer = new PrintWriter(System.out);
-    writer.write("--\n");
-    writer.write("-- Tajo database dump\n");
-    writer.write("-- Dump date: " + toDateString() + "\n");
-    writer.write("--\n");
-    writer.write("\n");
-    for (TableDesc tableDesc : tableDescList) {
-      writer.write(DDLBuilder.buildDDL(tableDesc));
-      writer.write("\n\n");
-    }
-    writer.flush();
-    writer.close();
-    System.exit(0);
-  }
-
-  private static String toDateString() {
-    DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
-    java.util.Date today = Calendar.getInstance().getTime();
-    return df.format(today);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java
deleted file mode 100644
index 789f761..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/MetaDataTuple.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
- * 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.jdbc;
-
-import org.apache.tajo.datum.*;
-import org.apache.tajo.exception.UnsupportedException;
-import org.apache.tajo.storage.Tuple;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MetaDataTuple implements Tuple {
-  List<Datum> values = new ArrayList<Datum>();
-
-  public MetaDataTuple(int size) {
-    values = new ArrayList<Datum>(size);
-    for(int i = 0; i < size; i++) {
-      values.add(NullDatum.get());
-    }
-  }
-
-  @Override
-  public int size() {
-    return values.size();
-  }
-
-  @Override
-  public boolean contains(int fieldid) {
-    return false;
-  }
-
-  @Override
-  public boolean isNull(int fieldid) {
-    return values.get(fieldid) == null || values.get(fieldid) instanceof NullDatum;
-  }
-
-  @Override
-  public void clear() {
-    values.clear();
-  }
-
-  @Override
-  public void put(int fieldId, Datum value) {
-    values.set(fieldId, value);
-  }
-
-  @Override
-  public void put(int fieldId, Datum[] values) {
-    throw new UnsupportedException("put");
-  }
-
-  @Override
-  public void put(int fieldId, Tuple tuple) {
-    throw new UnsupportedException("put");
-  }
-
-  @Override
-  public void put(Datum[] values) {
-    throw new UnsupportedException("put");
-  }
-
-  @Override
-  public Datum get(int fieldId) {
-    return getText(fieldId);
-  }
-
-  @Override
-  public void setOffset(long offset) {
-    throw new UnsupportedException("setOffset");
-  }
-
-  @Override
-  public long getOffset() {
-    throw new UnsupportedException("getOffset");
-  }
-
-  @Override
-  public BooleanDatum getBoolean(int fieldId) {
-    throw new UnsupportedException("getBoolean");
-  }
-
-  @Override
-  public BitDatum getByte(int fieldId) {
-    throw new UnsupportedException("getByte");
-  }
-
-  @Override
-  public CharDatum getChar(int fieldId) {
-    throw new UnsupportedException("getBoolean");
-  }
-
-  @Override
-  public BlobDatum getBytes(int fieldId) {
-    throw new UnsupportedException("BlobDatum");
-  }
-
-  @Override
-  public Int2Datum getShort(int fieldId) {
-    if(isNull(fieldId)) {
-      return null;
-    }
-    return new Int2Datum((short)Integer.parseInt(values.get(fieldId).toString()));
-  }
-
-  @Override
-  public Int4Datum getInt(int fieldId) {
-    if(isNull(fieldId)) {
-      return null;
-    }
-    return new Int4Datum(Integer.parseInt(values.get(fieldId).toString()));
-  }
-
-  @Override
-  public Int8Datum getLong(int fieldId) {
-    if(isNull(fieldId)) {
-      return null;
-    }
-    return new Int8Datum(Long.parseLong(values.get(fieldId).toString()));
-  }
-
-  @Override
-  public Float4Datum getFloat(int fieldId) {
-    if(isNull(fieldId)) {
-      return null;
-    }
-    return new Float4Datum(Float.parseFloat(values.get(fieldId).toString()));
-  }
-
-  @Override
-  public Float8Datum getDouble(int fieldId) {
-    if(isNull(fieldId)) {
-      return null;
-    }
-    return new Float8Datum(Float.parseFloat(values.get(fieldId).toString()));
-  }
-
-  @Override
-  public Inet4Datum getIPv4(int fieldId) {
-    throw new UnsupportedException("getIPv4");
-  }
-
-  @Override
-  public byte[] getIPv4Bytes(int fieldId) {
-    throw new UnsupportedException("getIPv4Bytes");
-  }
-
-  @Override
-  public InetAddress getIPv6(int fieldId) {
-    throw new UnsupportedException("getIPv6");
-  }
-
-  @Override
-  public byte[] getIPv6Bytes(int fieldId) {
-    throw new UnsupportedException("getIPv6Bytes");
-  }
-
-  @Override
-  public TextDatum getString(int fieldId) {
-    if(isNull(fieldId)) {
-      return null;
-    }
-    return new TextDatum(values.get(fieldId).toString());
-  }
-
-  @Override
-  public TextDatum getText(int fieldId) {
-    if(isNull(fieldId)) {
-      return null;
-    }
-    return new TextDatum(values.get(fieldId).toString());
-  }
-
-  @Override
-  public Tuple clone() throws CloneNotSupportedException {
-    throw new UnsupportedException("clone");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoConnection.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoConnection.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoConnection.java
deleted file mode 100644
index 47c88d1..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoConnection.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/**
- * 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.jdbc;
-
-import org.apache.tajo.client.TajoClient;
-import org.apache.tajo.conf.TajoConf;
-
-import java.sql.*;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.Executor;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-public class TajoConnection implements Connection {
-  private TajoClient tajoClient;
-
-  private String databaseName;
-
-  private AtomicBoolean closed = new AtomicBoolean(true);
-
-  private String uri;
-
-  public TajoConnection(String uri, Properties properties) throws SQLException {
-    if (!uri.startsWith(TajoDriver.TAJO_JDBC_URL_PREFIX)) {
-      throw new SQLException("Invalid URL: " + uri, "TAJO-001");
-    }
-
-    this.uri = uri;
-
-    // remove prefix
-    uri = uri.substring(TajoDriver.TAJO_JDBC_URL_PREFIX.length());
-
-
-    if (uri.isEmpty()) {
-      throw new SQLException("Invalid URL: " + uri, "TAJO-001");
-    }
-
-    // parse uri
-    // form: hostname:port/databasename
-    String[] parts = uri.split("/");
-    if(parts.length == 0 || parts[0].trim().isEmpty()) {
-      throw new SQLException("Invalid URL(No tajo master's host:port): " + uri, "TAJO-001");
-    }
-    String[] hostAndPort = parts[0].trim().split(":");
-    String host = hostAndPort[0];
-    int port = 0;
-    try {
-      port = Integer.parseInt(hostAndPort[1]);
-    } catch (Exception e) {
-      throw new SQLException("Invalid URL(Wrong tajo master's host:port): " + uri, "TAJO-001");
-    }
-
-    if(parts.length > 1) {
-      String[] tokens = parts[1].split("\\?");
-      databaseName = tokens[0].trim();
-      if(tokens.length > 1) {
-        String[] extraParamTokens = tokens[1].split("&");
-        for(String eachExtraParam: extraParamTokens) {
-          String[] paramTokens = eachExtraParam.split("=");
-          String extraParamKey = paramTokens[0];
-          String extraParamValue = paramTokens[1];
-        }
-      }
-    }
-
-    TajoConf tajoConf = new TajoConf();
-
-    tajoConf.setVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS, host + ":" + port);
-
-    if(properties != null) {
-      for(Map.Entry<Object, Object> entry: properties.entrySet()) {
-        tajoConf.set(entry.getKey().toString(), entry.getValue().toString());
-      }
-    }
-
-    try {
-      tajoClient = new TajoClient(tajoConf);
-    } catch (Exception e) {
-      throw new SQLException("Can't create tajo client:" + e.getMessage(), "TAJO-002");
-    }
-    closed.set(false);
-  }
-
-  public String getUri() {
-    return uri;
-  }
-
-  public TajoClient getTajoClient() {
-    return tajoClient;
-  }
-
-  @Override
-  public void clearWarnings() throws SQLException {
-  }
-
-  @Override
-  public void close() throws SQLException {
-    if(!closed.get()) {
-      if(tajoClient != null) {
-        tajoClient.close();
-      }
-
-      closed.set(true);
-    }
-  }
-
-  @Override
-  public void commit() throws SQLException {
-    throw new SQLFeatureNotSupportedException("commit");
-  }
-
-  @Override
-  public Array createArrayOf(String arg0, Object[] arg1) throws SQLException {
-    throw new SQLFeatureNotSupportedException("createArrayOf");
-  }
-
-  @Override
-  public Blob createBlob() throws SQLException {
-    throw new SQLFeatureNotSupportedException("createBlob");
-  }
-
-  @Override
-  public Clob createClob() throws SQLException {
-    throw new SQLFeatureNotSupportedException("createClob");
-  }
-
-  @Override
-  public NClob createNClob() throws SQLException {
-    throw new SQLFeatureNotSupportedException("createNClob");
-  }
-
-  @Override
-  public SQLXML createSQLXML() throws SQLException {
-    throw new SQLFeatureNotSupportedException("createSQLXML");
-  }
-
-  @Override
-  public Statement createStatement() throws SQLException {
-    if (isClosed()) {
-      throw new SQLException("Can't create Statement, connection is closed");
-    }
-    return new TajoStatement(tajoClient);
-  }
-
-  @Override
-  public Statement createStatement(int resultSetType, int resultSetConcurrency)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("createStatement");
-  }
-
-  @Override
-  public Statement createStatement(int resultSetType, int resultSetConcurrency,
-                                   int resultSetHoldability) throws SQLException {
-    throw new SQLFeatureNotSupportedException("createStatement");
-  }
-
-  @Override
-  public Struct createStruct(String typeName, Object[] attributes)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("createStruct");
-  }
-
-  @Override
-  public boolean getAutoCommit() throws SQLException {
-    return true;
-  }
-
-  @Override
-  public String getCatalog() throws SQLException {
-    return "";
-  }
-
-  @Override
-  public Properties getClientInfo() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getClientInfo");
-  }
-
-  @Override
-  public String getClientInfo(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getClientInfo");
-  }
-
-  @Override
-  public int getHoldability() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getHoldability");
-  }
-
-  @Override
-  public DatabaseMetaData getMetaData() throws SQLException {
-    return new TajoDatabaseMetaData(this);
-  }
-
-  @Override
-  public int getTransactionIsolation() throws SQLException {
-    return Connection.TRANSACTION_NONE;
-  }
-
-  @Override
-  public Map<String, Class<?>> getTypeMap() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getTypeMap");
-  }
-
-  @Override
-  public SQLWarning getWarnings() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getWarnings");
-  }
-
-  @Override
-  public boolean isClosed() throws SQLException {
-    return closed.get();
-  }
-
-  @Override
-  public boolean isReadOnly() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean isValid(int timeout) throws SQLException {
-    throw new SQLFeatureNotSupportedException("isValid");
-  }
-
-  @Override
-  public String nativeSQL(String sql) throws SQLException {
-    throw new SQLFeatureNotSupportedException("nativeSQL");
-  }
-
-  @Override
-  public CallableStatement prepareCall(String sql) throws SQLException {
-    throw new SQLFeatureNotSupportedException("prepareCall");
-  }
-
-  @Override
-  public CallableStatement prepareCall(String sql, int resultSetType,
-                                       int resultSetConcurrency) throws SQLException {
-    throw new SQLFeatureNotSupportedException("prepareCall");
-  }
-
-  @Override
-  public CallableStatement prepareCall(String sql, int resultSetType,
-                                       int resultSetConcurrency, int resultSetHoldability) throws SQLException {
-    throw new SQLFeatureNotSupportedException("prepareCall");
-  }
-
-  @Override
-  public PreparedStatement prepareStatement(String sql) throws SQLException {
-    return new TajoPreparedStatement(tajoClient, sql);
-  }
-
-  @Override
-  public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
-      throws SQLException {
-    return new TajoPreparedStatement(tajoClient, sql);
-  }
-
-  @Override
-  public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("prepareStatement");
-  }
-
-  @Override
-  public PreparedStatement prepareStatement(String sql, String[] columnNames)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("prepareStatement");
-  }
-
-  @Override
-  public PreparedStatement prepareStatement(String sql, int resultSetType,
-                                            int resultSetConcurrency) throws SQLException {
-    return new TajoPreparedStatement(tajoClient, sql);
-  }
-
-  @Override
-  public PreparedStatement prepareStatement(String sql, int resultSetType,
-                                            int resultSetConcurrency, int resultSetHoldability) throws SQLException {
-    throw new SQLFeatureNotSupportedException("prepareStatement");
-  }
-
-  @Override
-  public void releaseSavepoint(Savepoint savepoint) throws SQLException {
-    throw new SQLFeatureNotSupportedException("releaseSavepoint");
-  }
-
-  @Override
-  public void rollback() throws SQLException {
-    throw new SQLFeatureNotSupportedException("rollback");
-  }
-
-  @Override
-  public void rollback(Savepoint savepoint) throws SQLException {
-    throw new SQLFeatureNotSupportedException("rollback");
-  }
-
-  @Override
-  public void setAutoCommit(boolean autoCommit) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setAutoCommit");
-  }
-
-  @Override
-  public void setCatalog(String catalog) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setCatalog");
-  }
-
-  @Override
-  public void setClientInfo(Properties properties)
-      throws SQLClientInfoException {
-    throw new UnsupportedOperationException("setClientInfo");
-  }
-
-  @Override
-  public void setClientInfo(String name, String value)
-      throws SQLClientInfoException {
-    throw new UnsupportedOperationException("setClientInfo");
-  }
-
-  @Override
-  public void setHoldability(int holdability) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setHoldability");
-  }
-
-  @Override
-  public void setReadOnly(boolean readOnly) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setReadOnly");
-  }
-
-  @Override
-  public Savepoint setSavepoint() throws SQLException {
-    throw new SQLFeatureNotSupportedException("setSavepoint");
-  }
-
-  @Override
-  public Savepoint setSavepoint(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setSavepoint");
-  }
-
-  @Override
-  public void setTransactionIsolation(int level) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setTransactionIsolation");
-  }
-
-  @Override
-  public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setTypeMap");
-  }
-
-  @Override
-  public <T> T unwrap(Class<T> tClass) throws SQLException {
-    if (isWrapperFor(tClass)) {
-      return (T) this;
-    }
-    throw new SQLException("No wrapper for " + tClass);
-  }
-
-  @Override
-  public boolean isWrapperFor(Class<?> tClass) throws SQLException {
-    return tClass.isInstance(this);
-  }
-
-  public void abort(Executor executor) throws SQLException {
-    // JDK 1.7
-    throw new SQLFeatureNotSupportedException("abort not supported");
-  }
-
-  public int getNetworkTimeout() throws SQLException {
-    // JDK 1.7
-    throw new SQLFeatureNotSupportedException("getNetworkTimeout not supported");
-  }
-
-  public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
-    // JDK 1.7
-    throw new SQLFeatureNotSupportedException("setNetworkTimeout not supported");
-  }
-
-  public String getSchema() throws SQLException {
-    // JDK 1.7
-    throw new SQLFeatureNotSupportedException("getSchema not supported");
-  }
-
-  public void setSchema(String schema) throws SQLException {
-    // JDK 1.7
-    throw new SQLFeatureNotSupportedException("setSchema not supported");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoDatabaseMetaData.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoDatabaseMetaData.java
deleted file mode 100644
index 6c64ac2..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoDatabaseMetaData.java
+++ /dev/null
@@ -1,1196 +0,0 @@
-/**
- * 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.jdbc;
-
-import org.apache.tajo.TajoConstants;
-import org.apache.tajo.catalog.Column;
-import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.client.TajoClient;
-import org.apache.tajo.common.TajoDataTypes.Type;
-import org.apache.tajo.datum.NullDatum;
-import org.apache.tajo.datum.TextDatum;
-
-import java.sql.*;
-import java.util.*;
-
-/**
- * TajoDatabaseMetaData.
- */
-public class TajoDatabaseMetaData implements DatabaseMetaData {
-  private static final char SEARCH_STRING_ESCAPE = '\\';
-
-  private final TajoConnection conn;
-
-  public TajoDatabaseMetaData(TajoConnection conn) {
-    this.conn = conn;
-  }
-
-  @Override
-  public boolean allProceduresAreCallable()
-      throws SQLException {
-    return true;
-  }
-
-  @Override
-  public boolean allTablesAreSelectable()
-      throws SQLException {
-    return true;
-  }
-
-  @Override
-  public String getURL()
-      throws SQLException {
-    return conn.getUri();
-  }
-
-  @Override
-  public String getUserName()
-      throws SQLException {
-    return "tajo";
-  }
-
-  @Override
-  public boolean isReadOnly()
-      throws SQLException {
-    return true;
-  }
-
-  @Override
-  public String getDatabaseProductName()
-      throws SQLException {
-    return "Tajo";
-  }
-
-  @Override
-  public String getDatabaseProductVersion()
-      throws SQLException {
-    //TODO get from tajo master
-    return TajoConstants.TAJO_VERSION;
-  }
-
-  @Override
-  public String getDriverName()
-      throws SQLException {
-    return "tajo";
-  }
-
-  @Override
-  public String getDriverVersion()
-      throws SQLException {
-    return TajoDriver.MAJOR_VERSION + "." + TajoDriver.MINOR_VERSION;
-  }
-
-  @Override
-  public int getDriverMajorVersion() {
-    return TajoDriver.MAJOR_VERSION;
-  }
-
-  @Override
-  public int getDriverMinorVersion() {
-    return TajoDriver.MINOR_VERSION;
-  }
-
-  @Override
-  public String getIdentifierQuoteString()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getIdentifierQuoteString not supported");
-  }
-
-  @Override
-  public String getSQLKeywords()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getSQLKeywords not supported");
-  }
-
-  @Override
-  public String getNumericFunctions()
-      throws SQLException {
-    return "";
-  }
-
-  @Override
-  public String getStringFunctions()
-      throws SQLException {
-    return "";
-  }
-
-  @Override
-  public String getSystemFunctions()
-      throws SQLException {
-    return "";
-  }
-
-  @Override
-  public String getTimeDateFunctions()
-      throws SQLException {
-    return "";
-  }
-
-  @Override
-  public String getSearchStringEscape()
-      throws SQLException {
-    return "\\";
-  }
-
-  @Override
-  public String getExtraNameCharacters()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getExtraNameCharacters not supported");
-  }
-
-  @Override
-  public String getSchemaTerm()
-      throws SQLException {
-    return "";
-  }
-
-  @Override
-  public String getProcedureTerm()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getProcedureTerm not supported");
-  }
-
-  @Override
-  public String getCatalogTerm()
-      throws SQLException {
-    return "database";
-  }
-
-  @Override
-  public String getCatalogSeparator()
-      throws SQLException {
-    return ".";
-  }
-
-  @Override
-  public int getMaxBinaryLiteralLength()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxBinaryLiteralLength not supported");
-  }
-
-  @Override
-  public int getMaxCharLiteralLength()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxCharLiteralLength not supported");
-  }
-
-  @Override
-  public int getMaxColumnNameLength()
-      throws SQLException {
-    return 128;
-  }
-
-  @Override
-  public int getMaxColumnsInGroupBy()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxColumnsInGroupBy not supported");
-  }
-
-  @Override
-  public int getMaxColumnsInIndex()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxColumnsInIndex not supported");
-  }
-
-  @Override
-  public int getMaxColumnsInOrderBy()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxColumnsInOrderBy not supported");
-  }
-
-  @Override
-  public int getMaxColumnsInSelect()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxColumnsInSelect not supported");
-  }
-
-  @Override
-  public int getMaxColumnsInTable()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxColumnsInTable not supported");
-  }
-
-  @Override
-  public int getMaxConnections()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxConnections not supported");
-  }
-
-  @Override
-  public int getMaxCursorNameLength()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxCursorNameLength not supported");
-  }
-
-  @Override
-  public int getMaxIndexLength()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxIndexLength not supported");
-  }
-
-  @Override
-  public int getMaxSchemaNameLength()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxSchemaNameLength not supported");
-  }
-
-  @Override
-  public int getMaxProcedureNameLength()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxProcedureNameLength not supported");
-  }
-
-  @Override
-  public int getMaxCatalogNameLength()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxCatalogNameLength not supported");
-  }
-
-  @Override
-  public int getMaxRowSize()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxRowSize not supported");
-  }
-
-  @Override
-  public boolean doesMaxRowSizeIncludeBlobs()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("doesMaxRowSizeIncludeBlobs not supported");
-  }
-
-  @Override
-  public int getMaxStatementLength()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxStatementLength not supported");
-  }
-
-  @Override
-  public int getMaxStatements()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxStatements not supported");
-  }
-
-  @Override
-  public int getMaxTableNameLength()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxTableNameLength not supported");
-  }
-
-  @Override
-  public int getMaxTablesInSelect()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxTablesInSelect not supported");
-  }
-
-  @Override
-  public int getMaxUserNameLength()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxUserNameLength not supported");
-  }
-
-  @Override
-  public int getDefaultTransactionIsolation()
-      throws SQLException {
-    return Connection.TRANSACTION_NONE;
-  }
-
-  @Override
-  public boolean dataDefinitionCausesTransactionCommit()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("dataDefinitionCausesTransactionCommit not supported");
-  }
-
-  @Override
-  public boolean dataDefinitionIgnoredInTransactions()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("dataDefinitionIgnoredInTransactions not supported");
-  }
-
-  @Override
-  public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("stored procedures not supported");
-  }
-
-  @Override
-  public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("stored procedures not supported");
-  }
-
-  /**
-   * Convert a pattern containing JDBC catalog search wildcards into
-   * Java regex patterns.
-   *
-   * @param pattern input which may contain '%' or '_' wildcard characters, or
-   * these characters escaped using {@link #getSearchStringEscape()}.
-   * @return replace %/_ with regex search characters, also handle escaped
-   * characters.
-   */
-  private String convertPattern(final String pattern) {
-    if (pattern == null) {
-      return ".*";
-    } else {
-      StringBuilder result = new StringBuilder(pattern.length());
-
-      boolean escaped = false;
-      for (int i = 0, len = pattern.length(); i < len; i++) {
-        char c = pattern.charAt(i);
-        if (escaped) {
-          if (c != SEARCH_STRING_ESCAPE) {
-            escaped = false;
-          }
-          result.append(c);
-        } else {
-          if (c == SEARCH_STRING_ESCAPE) {
-            escaped = true;
-            continue;
-          } else if (c == '%') {
-            result.append(".*");
-          } else if (c == '_') {
-            result.append('.');
-          } else {
-            result.append(Character.toLowerCase(c));
-          }
-        }
-      }
-
-      return result.toString();
-    }
-  }
-
-  @Override
-  public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
-      throws SQLException {
-    try {
-      final List<MetaDataTuple> resultTables = new ArrayList<MetaDataTuple>();
-      final String resultCatalog;
-      if (catalog == null) {
-        resultCatalog = "default";
-      } else {
-        resultCatalog = catalog;
-      }
-
-      String regtableNamePattern = convertPattern(tableNamePattern);
-      try {
-        TajoClient tajoClient = conn.getTajoClient();
-        List<String> tableNames = tajoClient.getTableList();
-        for (String eachTableName: tableNames) {
-          if (eachTableName.matches(regtableNamePattern)) {
-            MetaDataTuple tuple = new MetaDataTuple(5);
-
-            int index = 0;
-            tuple.put(index++, new TextDatum(resultCatalog));  //TABLE_CAT
-            tuple.put(index++, NullDatum.get());   //TABLE_SCHEM
-            tuple.put(index++, new TextDatum(eachTableName));
-            tuple.put(index++, new TextDatum("TABLE"));   //TABLE_TYPE
-            tuple.put(index++, NullDatum.get());   //REMARKS
-
-            resultTables.add(tuple);
-          }
-        }
-        Collections.sort(resultTables, new Comparator<MetaDataTuple> () {
-          @Override
-          public int compare(MetaDataTuple table1, MetaDataTuple table2) {
-            return table1.getString(2).compareTo(table2.getString(2));
-          }
-        });
-      } catch (Exception e) {
-        e.printStackTrace();
-        throw new SQLException(e);
-      }
-      TajoMetaDataResultSet result = new TajoMetaDataResultSet(
-          Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "TABLE_TYPE", "REMARKS"),
-          Arrays.asList(Type.VARCHAR, Type.VARCHAR, Type.VARCHAR, Type.VARCHAR, Type.VARCHAR),
-          resultTables);
-
-      return result;
-    } catch (Exception e) {
-      e.printStackTrace();
-      throw new SQLException(e.getMessage(), e);
-    }
-  }
-
-  @Override
-  public ResultSet getSchemas()
-      throws SQLException {
-    return getSchemas(null, null);
-  }
-
-  @Override
-  public ResultSet getCatalogs()
-      throws SQLException {
-    List<MetaDataTuple> columns = new ArrayList<MetaDataTuple>();
-    MetaDataTuple tuple = new MetaDataTuple(1);
-    tuple.put(0, new TextDatum("default"));
-    columns.add(tuple);
-
-    ResultSet result = new TajoMetaDataResultSet(
-        Arrays.asList("TABLE_CAT")
-        , Arrays.asList(Type.VARCHAR)
-        , columns);
-
-    return result;
-  }
-
-  @Override
-  public ResultSet getTableTypes()
-      throws SQLException {
-    List<MetaDataTuple> columns = new ArrayList<MetaDataTuple>();
-    MetaDataTuple tuple = new MetaDataTuple(1);
-    tuple.put(0, new TextDatum("TABLE"));
-    columns.add(tuple);
-
-    ResultSet result = new TajoMetaDataResultSet(
-        Arrays.asList("TABLE_TYPE")
-        , Arrays.asList(Type.VARCHAR)
-        , columns);
-
-    return result;
-  }
-
-  @Override
-  public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types)
-      throws SQLException {
-    List<MetaDataTuple> columns = new ArrayList<MetaDataTuple>();
-
-    return new TajoMetaDataResultSet(
-        Arrays.asList("TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "CLASS_NAME", "DATA_TYPE"
-            , "REMARKS", "BASE_TYPE")
-        , Arrays.asList(Type.VARCHAR, Type.VARCHAR, Type.VARCHAR, Type.VARCHAR, Type.INT4, Type.VARCHAR, Type.INT4)
-        , columns);
-  }
-
-  @Override
-  public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
-      throws SQLException {
-    List<MetaDataTuple> columns = new ArrayList<MetaDataTuple>();
-    try {
-      if (catalog == null) {
-        catalog = "default";
-      }
-
-      String regtableNamePattern = convertPattern(tableNamePattern);
-      String regcolumnNamePattern = convertPattern(columnNamePattern);
-
-      List<String> tables = conn.getTajoClient().getTableList();
-      for (String table: tables) {
-        if (table.matches(regtableNamePattern)) {
-          TableDesc tableDesc = conn.getTajoClient().getTableDesc(table);
-          int pos = 0;
-          for (Column column: tableDesc.getSchema().getColumns()) {
-            if (column.getColumnName().matches(regcolumnNamePattern)) {
-              MetaDataTuple tuple = new MetaDataTuple(22);
-
-              int index = 0;
-              tuple.put(index++, new TextDatum(catalog));  //TABLE_CAT
-              tuple.put(index++, NullDatum.get());  //TABLE_SCHEM
-              tuple.put(index++, new TextDatum(table));  //TABLE_NAME
-              tuple.put(index++, new TextDatum(column.getColumnName()));  //COLUMN_NAME
-              tuple.put(index++, new TextDatum("" + TajoDriver.tajoTypeToSqlType(column.getDataType())));  //TODO DATA_TYPE
-              tuple.put(index++, new TextDatum(TajoDriver.toSqlType(column.getDataType())));  //TYPE_NAME
-              tuple.put(index++, new TextDatum("0"));  //COLUMN_SIZE
-              tuple.put(index++, new TextDatum("0"));  //BUFFER_LENGTH
-              tuple.put(index++, new TextDatum("0"));  //DECIMAL_DIGITS
-              tuple.put(index++, new TextDatum("0"));  //NUM_PREC_RADIX
-              tuple.put(index++, new TextDatum("" + DatabaseMetaData.columnNullable));  //NULLABLE
-              tuple.put(index++, NullDatum.get());  //REMARKS
-              tuple.put(index++, NullDatum.get());  //COLUMN_DEF
-              tuple.put(index++, NullDatum.get());  //SQL_DATA_TYPE
-              tuple.put(index++, NullDatum.get());  //SQL_DATETIME_SUB
-              tuple.put(index++, new TextDatum("0"));  //CHAR_OCTET_LENGTH
-              tuple.put(index++, new TextDatum("" + pos));  //ORDINAL_POSITION
-              tuple.put(index++, new TextDatum("YES"));  //IS_NULLABLE
-              tuple.put(index++, NullDatum.get());  //SCOPE_CATLOG
-              tuple.put(index++, NullDatum.get());  //SCOPE_SCHEMA
-              tuple.put(index++, NullDatum.get());  //SCOPE_TABLE
-              tuple.put(index++, new TextDatum("0"));  //SOURCE_DATA_TYPE
-              columns.add(tuple);
-            }
-            pos++;
-          }
-        }
-      }
-
-      return new TajoMetaDataResultSet(
-          Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE"
-              , "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS", "NUM_PREC_RADIX"
-              , "NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB"
-              , "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATLOG", "SCOPE_SCHEMA"
-              , "SCOPE_TABLE", "SOURCE_DATA_TYPE")
-          , Arrays.asList(Type.VARCHAR, Type.VARCHAR, Type.VARCHAR, Type.VARCHAR, Type.INT4
-              , Type.VARCHAR, Type.INT4, Type.INT4, Type.INT4, Type.INT4
-              , Type.INT4, Type.VARCHAR, Type.VARCHAR, Type.INT4, Type.INT4
-              , Type.INT4, Type.INT4, Type.VARCHAR, Type.VARCHAR, Type.VARCHAR
-              , Type.VARCHAR, Type.INT4)
-          , columns);
-    } catch (Exception e) {
-      e.printStackTrace();
-      throw new SQLException(e);
-    }
-  }
-
-  @Override
-  public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("privileges not supported");
-  }
-
-  @Override
-  public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("privileges not supported");
-  }
-
-  @Override
-  public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("row identifiers not supported");
-  }
-
-  @Override
-  public ResultSet getVersionColumns(String catalog, String schema, String table)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("version columns not supported");
-  }
-
-  @Override
-  public ResultSet getPrimaryKeys(String catalog, String schema, String table)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("primary keys not supported");
-  }
-
-  @Override
-  public ResultSet getImportedKeys(String catalog, String schema, String table)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("imported keys not supported");
-  }
-
-  @Override
-  public ResultSet getExportedKeys(String catalog, String schema, String table)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("exported keys not supported");
-  }
-
-  @Override
-  public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("cross reference not supported");
-  }
-
-  @Override
-  public ResultSet getTypeInfo()
-      throws SQLException {
-    throw new UnsupportedOperationException("getTypeInfo not supported");
-  }
-
-  @Override
-  public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("indexes not supported");
-  }
-
-  @Override
-  public boolean deletesAreDetected(int type)
-      throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean insertsAreDetected(int type)
-      throws SQLException {
-    return false;
-  }
-
-  @Override
-  public Connection getConnection()
-      throws SQLException {
-    return conn;
-  }
-
-  @Override
-  public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("type hierarchies not supported");
-  }
-
-  @Override
-  public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("type hierarchies not supported");
-  }
-
-  @Override
-  public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("user-defined types not supported");
-  }
-
-  @Override
-  public int getResultSetHoldability()
-      throws SQLException {
-    return ResultSet.HOLD_CURSORS_OVER_COMMIT;
-  }
-
-  @Override
-  public int getDatabaseMajorVersion()
-      throws SQLException {
-    return TajoDriver.MAJOR_VERSION;
-  }
-
-  @Override
-  public int getDatabaseMinorVersion()
-      throws SQLException {
-    return TajoDriver.MINOR_VERSION;
-  }
-
-  @Override
-  public int getJDBCMajorVersion()
-      throws SQLException {
-    return TajoDriver.JDBC_VERSION_MAJOR;
-  }
-
-  @Override
-  public int getJDBCMinorVersion()
-      throws SQLException {
-    return TajoDriver.JDBC_VERSION_MINOR;
-  }
-
-  @Override
-  public int getSQLStateType()
-      throws SQLException {
-    return DatabaseMetaData.sqlStateSQL;
-  }
-
-  @Override
-  public RowIdLifetime getRowIdLifetime()
-      throws SQLException {
-    return RowIdLifetime.ROWID_UNSUPPORTED;
-  }
-
-  @Override
-  public ResultSet getSchemas(String catalog, String schemaPattern)
-      throws SQLException {
-    return new TajoMetaDataResultSet(
-        Arrays.asList("TABLE_SCHEM", "TABLE_CATALOG"),
-        Arrays.asList(Type.VARCHAR, Type.VARCHAR),
-        null);
-  }
-
-  @Override
-  public boolean autoCommitFailureClosesAllResultSets()
-      throws SQLException {
-    return false;
-  }
-
-  @Override
-  public ResultSet getClientInfoProperties()
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getClientInfoProperties not supported");
-  }
-
-  @Override
-  public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getFunctions not supported");
-  }
-
-  @Override
-  public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getFunctionColumns not supported");
-  }
-
-  @Override
-  public boolean isCatalogAtStart() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean locatorsUpdateCopy() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean nullPlusNonNullIsNull() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean nullsAreSortedAtEnd() throws SQLException {
-    return true;
-  }
-
-  @Override
-  public boolean nullsAreSortedAtStart() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean nullsAreSortedHigh() throws SQLException {
-    return true;
-  }
-
-  @Override
-  public boolean nullsAreSortedLow() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean othersDeletesAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean othersInsertsAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean othersUpdatesAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean ownDeletesAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean ownInsertsAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean ownUpdatesAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean storesLowerCaseIdentifiers() throws SQLException {
-    return true;
-  }
-
-  @Override
-  public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean storesMixedCaseIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean storesUpperCaseIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsANSI92EntryLevelSQL() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsANSI92FullSQL() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsANSI92IntermediateSQL() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsAlterTableWithAddColumn() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsAlterTableWithDropColumn() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsBatchUpdates() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsCatalogsInDataManipulation() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsCatalogsInProcedureCalls() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsCatalogsInTableDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsColumnAliasing() throws SQLException {
-    return true;
-  }
-
-  @Override
-  public boolean supportsConvert() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsConvert(int fromType, int toType) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsCoreSQLGrammar() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsCorrelatedSubqueries() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsDataDefinitionAndDataManipulationTransactions()
-      throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsDifferentTableCorrelationNames() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsExpressionsInOrderBy() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsExtendedSQLGrammar() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsFullOuterJoins() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsGetGeneratedKeys() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsGroupBy() throws SQLException {
-    return true;
-  }
-
-  @Override
-  public boolean supportsGroupByBeyondSelect() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsGroupByUnrelated() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsIntegrityEnhancementFacility() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsLikeEscapeClause() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsLimitedOuterJoins() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsMinimumSQLGrammar() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsMixedCaseIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsMultipleOpenResults() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsMultipleResultSets() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsMultipleTransactions() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsNamedParameters() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsNonNullableColumns() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsOrderByUnrelated() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsOuterJoins() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsPositionedDelete() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsPositionedUpdate() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsResultSetConcurrency(int type, int concurrency)
-      throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsResultSetHoldability(int holdability)
-      throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsResultSetType(int type) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSavepoints() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSchemasInDataManipulation() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSchemasInIndexDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSchemasInProcedureCalls() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSchemasInTableDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSelectForUpdate() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsStatementPooling() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsStoredProcedures() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSubqueriesInComparisons() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSubqueriesInExists() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSubqueriesInIns() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsSubqueriesInQuantifieds() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsTableCorrelationNames() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsTransactionIsolationLevel(int level)
-      throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsTransactions() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsUnion() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean supportsUnionAll() throws SQLException {
-    return true;
-  }
-
-  @Override
-  public boolean updatesAreDetected(int type) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean usesLocalFilePerTable() throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean usesLocalFiles() throws SQLException {
-    return false;
-  }
-
-  @SuppressWarnings("unchecked")
-  @Override
-  public <T> T unwrap(Class<T> iface)
-      throws SQLException {
-    if (isWrapperFor(iface)) {
-      return (T) this;
-    }
-    throw new SQLFeatureNotSupportedException("No wrapper for " + iface);
-  }
-
-  @Override
-  public boolean isWrapperFor(Class<?> iface)
-      throws SQLException {
-    return iface.isInstance(this);
-  }
-
-  public boolean generatedKeyAlwaysReturned() throws SQLException {
-    // JDK 1.7
-    throw new SQLFeatureNotSupportedException("generatedKeyAlwaysReturned not supported");
-  }
-
-  public ResultSet getPseudoColumns(String catalog, String schemaPattern,
-                                    String tableNamePattern, String columnNamePattern) throws SQLException {
-    // JDK 1.7
-    throw new SQLFeatureNotSupportedException("getPseudoColumns not supported");
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoDriver.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoDriver.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoDriver.java
deleted file mode 100644
index ca0502f..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoDriver.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * 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.jdbc;
-
-import org.apache.tajo.common.TajoDataTypes;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.exception.UnsupportedException;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.sql.*;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-public class TajoDriver implements Driver, Closeable {
-  public static final int MAJOR_VERSION = 1;
-  public static final int MINOR_VERSION = 0;
-
-  public static final int JDBC_VERSION_MAJOR = 4;
-  public static final int JDBC_VERSION_MINOR = 0;
-
-  public static final String TAJO_JDBC_URL_PREFIX = "jdbc:tajo://";
-
-  protected static TajoConf jdbcTajoConf;
-
-  static {
-    try {
-      java.sql.DriverManager.registerDriver(new TajoDriver());
-    } catch (SQLException e) {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-    }
-  }
-
-  public TajoDriver() {
-    jdbcTajoConf = new TajoConf();
-  }
-
-  @Override
-  public void close() throws IOException {
-  }
-
-  @Override
-  public Connection connect(String url, Properties properties) throws SQLException {
-    return new TajoConnection(url, properties);
-  }
-
-  @Override
-  public boolean acceptsURL(String url) throws SQLException {
-    return url.startsWith(TAJO_JDBC_URL_PREFIX);
-  }
-
-  @Override
-  public DriverPropertyInfo[] getPropertyInfo(String s, Properties properties) throws SQLException {
-    return new DriverPropertyInfo[0];
-  }
-
-  @Override
-  public int getMajorVersion() {
-    return MAJOR_VERSION;
-  }
-
-  @Override
-  public int getMinorVersion() {
-    return MINOR_VERSION;
-  }
-
-  @Override
-  public boolean jdbcCompliant() {
-    return false;
-  }
-
-  public static String toSqlType(TajoDataTypes.DataType type) {
-    switch (type.getType()) {
-      case BOOLEAN:
-        return "boolean";
-      case INT1:
-        return "tinyint";
-      case INT2:
-        return "smallint";
-      case INT4:
-        return "integer";
-      case INT8:
-        return "bigint";
-      case FLOAT4:
-        return "float";
-      case FLOAT8:
-        return "float8";
-      case DECIMAL:
-        return "numeric";
-      case VARBINARY:
-        return "bytea";
-      case CHAR:
-        return "character";
-      case DATE:
-        return "date";
-      case VARCHAR:
-        return "varchar";
-      case TEXT:
-        return "varchar";
-      default:
-        throw new UnsupportedException("Unrecognized column type:" + type);
-    }
-  }
-
-  public static int tajoTypeToSqlType(TajoDataTypes.DataType type) throws SQLException {
-    switch (type.getType()) {
-      case BOOLEAN:
-        return Types.BOOLEAN;
-      case INT1:
-        return Types.TINYINT;
-      case INT2:
-        return Types.SMALLINT;
-      case INT4:
-        return Types.INTEGER;
-      case INT8:
-        return Types.BIGINT;
-      case FLOAT4:
-        return Types.FLOAT;
-      case FLOAT8:
-        return Types.DOUBLE;
-      case DECIMAL:
-        return Types.DECIMAL;
-      case DATE:
-        return Types.TIMESTAMP;
-      case VARCHAR:
-        return Types.VARCHAR;
-      case TEXT:
-        return Types.VARCHAR;
-      default:
-        throw new SQLException("Unrecognized column type: " + type);
-    }
-  }
-
-  static int columnDisplaySize(int columnType) throws SQLException {
-    // according to hiveTypeToSqlType possible options are:
-    switch(columnType) {
-      case Types.BOOLEAN:
-        return columnPrecision(columnType);
-      case Types.VARCHAR:
-        return Integer.MAX_VALUE; // hive has no max limit for strings
-      case Types.TINYINT:
-      case Types.SMALLINT:
-      case Types.INTEGER:
-      case Types.BIGINT:
-        return columnPrecision(columnType) + 1; // allow +/-
-      case Types.TIMESTAMP:
-        return columnPrecision(columnType);
-      // see http://download.oracle.com/javase/6/docs/api/constant-values.html#java.lang.Float.MAX_EXPONENT
-      case Types.FLOAT:
-        return 24; // e.g. -(17#).e-###
-      // see http://download.oracle.com/javase/6/docs/api/constant-values.html#java.lang.Double.MAX_EXPONENT
-      case Types.DOUBLE:
-        return 25; // e.g. -(17#).e-####
-      case Types.DECIMAL:
-        return Integer.MAX_VALUE;
-      default:
-        throw new SQLException("Invalid column type: " + columnType);
-    }
-  }
-
-  static int columnPrecision(int columnType) throws SQLException {
-    // according to hiveTypeToSqlType possible options are:
-    switch(columnType) {
-      case Types.BOOLEAN:
-        return 1;
-      case Types.VARCHAR:
-        return Integer.MAX_VALUE; // hive has no max limit for strings
-      case Types.TINYINT:
-        return 3;
-      case Types.SMALLINT:
-        return 5;
-      case Types.INTEGER:
-        return 10;
-      case Types.BIGINT:
-        return 19;
-      case Types.FLOAT:
-        return 7;
-      case Types.DOUBLE:
-        return 15;
-      case Types.TIMESTAMP:
-        return 29;
-      case Types.DECIMAL:
-        return Integer.MAX_VALUE;
-      default:
-        throw new SQLException("Invalid column type: " + columnType);
-    }
-  }
-
-  static int columnScale(int columnType) throws SQLException {
-    // according to hiveTypeToSqlType possible options are:
-    switch(columnType) {
-      case Types.BOOLEAN:
-      case Types.VARCHAR:
-      case Types.TINYINT:
-      case Types.SMALLINT:
-      case Types.INTEGER:
-      case Types.BIGINT:
-        return 0;
-      case Types.FLOAT:
-        return 7;
-      case Types.DOUBLE:
-        return 15;
-      case Types.TIMESTAMP:
-        return 9;
-      case Types.DECIMAL:
-        return Integer.MAX_VALUE;
-      default:
-        throw new SQLException("Invalid column type: " + columnType);
-    }
-  }
-
-  public Logger getParentLogger() throws SQLFeatureNotSupportedException {
-    // JDK 1.7
-    throw new SQLFeatureNotSupportedException("getParentLogger not supported");
-  }
-}