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:17:59 UTC

[3/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/jdbc/TajoMetaDataResultSet.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoMetaDataResultSet.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoMetaDataResultSet.java
deleted file mode 100644
index 1e75424..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoMetaDataResultSet.java
+++ /dev/null
@@ -1,77 +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.catalog.Schema;
-import org.apache.tajo.common.TajoDataTypes.Type;
-import org.apache.tajo.datum.Datum;
-import org.apache.tajo.storage.Tuple;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.List;
-
-public class TajoMetaDataResultSet extends TajoResultSetBase {
-  private List<MetaDataTuple> values;
-
-  public TajoMetaDataResultSet(List<String> columns, List<Type> types, List<MetaDataTuple> values) {
-    init();
-    schema = new Schema();
-
-    int index = 0;
-    if(columns != null) {
-      for(String columnName: columns) {
-        schema.addColumn(columnName, types.get(index++));
-      }
-    }
-    this.values = values;
-    totalRow = values == null ? 0 : values.size();
-  }
-
-  @Override
-  protected Tuple nextTuple() throws IOException {
-    if(curRow >= totalRow) {
-      return null;
-    }
-    return values.get(curRow);
-  }
-
-  @Override
-  public void close() throws SQLException {
-  }
-
-  @Override
-  public String getString(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    if(datum == null) {
-      return null;
-    }
-
-    return datum.asChars();
-  }
-
-  @Override
-  public String getString(String name) throws SQLException {
-    Datum datum = cur.get(findColumn(name));
-    if(datum == null) {
-      return null;
-    }
-    return datum.asChars();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoPreparedStatement.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoPreparedStatement.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoPreparedStatement.java
deleted file mode 100644
index a6e3bbf..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoPreparedStatement.java
+++ /dev/null
@@ -1,660 +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 java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.*;
-import java.util.Calendar;
-import java.util.HashMap;
-
-/**
- * TajoPreparedStatement.
- *
- */
-public class TajoPreparedStatement implements PreparedStatement {
-  private final String sql;
-  private TajoClient tajoClient;
-  /**
-   * save the SQL parameters {paramLoc:paramValue}
-   */
-  private final HashMap<Integer, String> parameters=new HashMap<Integer, String>();
-
-  /**
-   * We need to keep a reference to the result set to support the following:
-   * <code>
-   * statement.execute(String sql);
-   * statement.getResultSet();
-   * </code>.
-   */
-  private ResultSet resultSet = null;
-
-  /**
-   * Add SQLWarnings to the warningChain if needed.
-   */
-  private  SQLWarning warningChain = null;
-
-  /**
-   * Keep state so we can fail certain calls made after close().
-   */
-  private boolean isClosed = false;
-
-  /**
-   * keep the current ResultRet update count
-   */
-  private final int updateCount = 0;
-
-  /**
-   *
-   */
-  public TajoPreparedStatement(TajoClient tajoClient,
-                               String sql) {
-    this.tajoClient = tajoClient;
-    this.sql = sql;
-  }
-
-  @Override
-  public void addBatch() throws SQLException {
-    throw new SQLFeatureNotSupportedException("addBatch");
-  }
-
-  @Override
-  public void clearParameters() throws SQLException {
-    this.parameters.clear();
-  }
-
-  @Override
-  public boolean execute() throws SQLException {
-    ResultSet rs = executeImmediate(sql);
-    return rs != null;
-  }
-
-  @Override
-  public ResultSet executeQuery() throws SQLException {
-    return executeImmediate(sql);
-  }
-
-  @Override
-  public int executeUpdate() throws SQLException {
-    executeImmediate(sql);
-    return updateCount;
-  }
-
-  protected ResultSet executeImmediate(String sql) throws SQLException {
-    if (isClosed) {
-      throw new SQLFeatureNotSupportedException("Can't execute after statement has been closed");
-    }
-
-    try {
-      if (sql.contains("?")) {
-        sql = updateSql(sql, parameters);
-      }
-      resultSet = tajoClient.executeQueryAndGetResult(sql);
-    } catch (Exception e) {
-      throw new SQLFeatureNotSupportedException(e.getMessage(), e);
-    }
-    return resultSet;
-  }
-
-  /**
-   * update the SQL string with parameters set by setXXX methods of {@link java.sql.PreparedStatement}
-   *
-   * @param sql
-   * @param parameters
-   * @return updated SQL string
-   */
-  private String updateSql(final String sql, HashMap<Integer, String> parameters) {
-
-    StringBuffer newSql = new StringBuffer(sql);
-
-    int paramLoc = 1;
-    while (getCharIndexFromSqlByParamLocation(sql, '?', paramLoc) > 0) {
-      // check the user has set the needs parameters
-      if (parameters.containsKey(paramLoc)) {
-        int tt = getCharIndexFromSqlByParamLocation(newSql.toString(), '?', 1);
-        newSql.deleteCharAt(tt);
-        newSql.insert(tt, parameters.get(paramLoc));
-      }
-      paramLoc++;
-    }
-
-    return newSql.toString();
-
-  }
-
-  /**
-   * Get the index of given char from the SQL string by parameter location
-   * </br> The -1 will be return, if nothing found
-   *
-   * @param sql
-   * @param cchar
-   * @param paramLoc
-   * @return
-   */
-  private int getCharIndexFromSqlByParamLocation(final String sql, final char cchar, final int paramLoc) {
-    int signalCount = 0;
-    int charIndex = -1;
-    int num = 0;
-    for (int i = 0; i < sql.length(); i++) {
-      char c = sql.charAt(i);
-      if (c == '\'' || c == '\\')// record the count of char "'" and char "\"
-      {
-        signalCount++;
-      } else if (c == cchar && signalCount % 2 == 0) {// check if the ? is really the parameter
-        num++;
-        if (num == paramLoc) {
-          charIndex = i;
-          break;
-        }
-      }
-    }
-    return charIndex;
-  }
-
-  @Override
-  public ResultSetMetaData getMetaData() throws SQLException {
-    if(resultSet != null) {
-      return resultSet.getMetaData();
-    } else {
-      return null;
-    }
-  }
-
-  @Override
-  public ParameterMetaData getParameterMetaData() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getParameterMetaData not supported");
-  }
-
-  @Override
-  public void setArray(int i, Array x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setArray not supported");
-  }
-
-  @Override
-  public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setAsciiStream not supported");
-  }
-
-  @Override
-  public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setAsciiStream not supported");
-  }
-
-  @Override
-  public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setAsciiStream not supported");
-  }
-
-  @Override
-  public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setBigDecimal not supported");
-  }
-
-  @Override
-  public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setBinaryStream not supported");
-  }
-
-  @Override
-  public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setBinaryStream not supported");
-  }
-
-  @Override
-  public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setBinaryStream not supported");
-  }
-
-  @Override
-  public void setBlob(int i, Blob x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setBlob not supported");
-  }
-
-  @Override
-  public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setBlob not supported");
-  }
-
-  @Override
-  public void setBlob(int parameterIndex, InputStream inputStream, long length)
-          throws SQLException {
-    throw new SQLFeatureNotSupportedException("setBlob not supported");
-  }
-
-  @Override
-  public void setBoolean(int parameterIndex, boolean x) throws SQLException {
-    this.parameters.put(parameterIndex, "" + x);
-  }
-
-  @Override
-  public void setByte(int parameterIndex, byte x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setByte not supported");
-  }
-
-  @Override
-  public void setBytes(int parameterIndex, byte[] x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setBytes not supported");
-  }
-
-  @Override
-  public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setCharacterStream not supported");
-  }
-
-  @Override
-  public void setCharacterStream(int parameterIndex, Reader reader, int length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("setCharacterStream not supported");
-  }
-
-  @Override
-  public void setCharacterStream(int parameterIndex, Reader reader, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("setCharacterStream not supported");
-  }
-
-  @Override
-  public void setClob(int i, Clob x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setClob not supported");
-  }
-
-  @Override
-  public void setClob(int parameterIndex, Reader reader) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setClob not supported");
-  }
-
-  @Override
-  public void setClob(int parameterIndex, Reader reader, long length) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setClob not supported");
-  }
-
-  @Override
-  public void setDate(int parameterIndex, Date x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setDate not supported");
-  }
-
-  @Override
-  public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setDate not supported");
-  }
-
-  @Override
-  public void setDouble(int parameterIndex, double x) throws SQLException {
-    this.parameters.put(parameterIndex,"" + x);
-  }
-
-  @Override
-  public void setFloat(int parameterIndex, float x) throws SQLException {
-    this.parameters.put(parameterIndex,"" + x);
-  }
-
-  @Override
-  public void setInt(int parameterIndex, int x) throws SQLException {
-    this.parameters.put(parameterIndex,"" + x);
-  }
-
-  @Override
-  public void setLong(int parameterIndex, long x) throws SQLException {
-    this.parameters.put(parameterIndex,"" + x);
-  }
-
-  @Override
-  public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setNCharacterStream not supported");
-  }
-
-  @Override
-  public void setNCharacterStream(int parameterIndex, Reader value, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("setNCharacterStream not supported");
-  }
-
-  @Override
-  public void setNClob(int parameterIndex, NClob value) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setNClob not supported");
-  }
-
-  @Override
-  public void setNClob(int parameterIndex, Reader reader) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setNClob not supported");
-  }
-
-  @Override
-  public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setNClob not supported");
-  }
-
-  @Override
-  public void setNString(int parameterIndex, String value) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setNString not supported");
-  }
-
-  @Override
-  public void setNull(int parameterIndex, int sqlType) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setNull not supported");
-  }
-
-  @Override
-  public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setNull not supported");
-  }
-
-  @Override
-  public void setObject(int parameterIndex, Object x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setObject not supported");
-  }
-
-  @Override
-  public void setObject(int parameterIndex, Object x, int targetSqlType)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("setObject not supported");
-  }
-
-  @Override
-  public void setObject(int parameterIndex, Object x, int targetSqlType, int scale)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("setObject not supported");
-  }
-
-  @Override
-  public void setRef(int i, Ref x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setRef not supported");
-  }
-
-  @Override
-  public void setRowId(int parameterIndex, RowId x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setRowId not supported");
-  }
-
-  @Override
-  public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setSQLXML not supported");
-  }
-
-  @Override
-  public void setShort(int parameterIndex, short x) throws SQLException {
-    this.parameters.put(parameterIndex,"" + x);
-  }
-
-  @Override
-  public void setString(int parameterIndex, String x) throws SQLException {
-     x=x.replace("'", "\\'");
-     this.parameters.put(parameterIndex,"'" + x +"'");
-  }
-
-  @Override
-  public void setTime(int parameterIndex, Time x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setTime not supported");
-  }
-
-  @Override
-  public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setTime not supported");
-  }
-
-  @Override
-  public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setTimestamp not supported");
-  }
-
-  @Override
-  public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("setTimestamp not supported");
-  }
-
-  @Override
-  public void setURL(int parameterIndex, URL x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setURL not supported");
-  }
-
-  @Override
-  public void setUnicodeStream(int parameterIndex, InputStream x, int length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("setUnicodeStream not supported");
-  }
-
-  @Override
-  public void addBatch(String sql) throws SQLException {
-    throw new SQLFeatureNotSupportedException("addBatch not supported");
-  }
-
-  @Override
-  public void cancel() throws SQLException {
-    throw new SQLFeatureNotSupportedException("cancel not supported");
-  }
-
-  @Override
-  public void clearBatch() throws SQLException {
-    throw new SQLFeatureNotSupportedException("clearBatch not supported");
-  }
-
-  @Override
-  public void clearWarnings() throws SQLException {
-     warningChain=null;
-  }
-
-  public void closeOnCompletion() throws SQLException {
-    // JDK 1.7
-    throw new SQLFeatureNotSupportedException("closeOnCompletion");
-  }
-
-  @Override
-  public void close() throws SQLException {
-    if (resultSet!=null) {
-      resultSet.close();
-      resultSet = null;
-    }
-    isClosed = true;
-  }
-
-  @Override
-  public boolean execute(String sql) throws SQLException {
-    throw new SQLFeatureNotSupportedException("execute(sql) not supported");
-  }
-
-  @Override
-  public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
-    throw new SQLFeatureNotSupportedException("execute(sql) not supported");
-  }
-
-  @Override
-  public boolean execute(String sql, int[] columnIndexes) throws SQLException {
-    throw new SQLFeatureNotSupportedException("execute(sql) not supported");
-  }
-
-  @Override
-  public boolean execute(String sql, String[] columnNames) throws SQLException {
-    throw new SQLFeatureNotSupportedException("execute(sql) not supported");
-  }
-
-  @Override
-  public int[] executeBatch() throws SQLException {
-    throw new SQLFeatureNotSupportedException("executeBatch not supported");
-  }
-
-  @Override
-  public ResultSet executeQuery(String sql) throws SQLException {
-    throw new SQLFeatureNotSupportedException("executeQuery(sql) not supported");
-  }
-
-  @Override
-  public int executeUpdate(String sql) throws SQLException {
-    throw new SQLFeatureNotSupportedException("executeUpdate not supported");
-  }
-
-  @Override
-  public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
-    throw new SQLFeatureNotSupportedException("executeUpdate not supported");
-  }
-
-  @Override
-  public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
-    throw new SQLFeatureNotSupportedException("executeUpdate not supported");
-  }
-
-  @Override
-  public int executeUpdate(String sql, String[] columnNames) throws SQLException {
-    throw new SQLFeatureNotSupportedException("executeUpdate not supported");
-  }
-
-  @Override
-  public Connection getConnection() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getConnection not supported");
-  }
-
-  @Override
-  public int getFetchDirection() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getFetchDirection not supported");
-  }
-
-  @Override
-  public int getFetchSize() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getFetchSize not supported");
-  }
-
-  @Override
-  public ResultSet getGeneratedKeys() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getGeneratedKeys not supported");
-  }
-
-  @Override
-  public int getMaxFieldSize() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxFieldSize not supported");
-  }
-
-  @Override
-  public int getMaxRows() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxRows not supported");
-  }
-
-  @Override
-  public boolean getMoreResults() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMoreResults not supported");
-  }
-
-  @Override
-  public boolean getMoreResults(int current) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMoreResults not supported");
-  }
-
-  @Override
-  public int getQueryTimeout() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getQueryTimeout not supported");
-  }
-
-  @Override
-  public ResultSet getResultSet() throws SQLException {
-    return this.resultSet;
-  }
-
-  @Override
-  public int getResultSetConcurrency() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getResultSetConcurrency not supported");
-  }
-
-  @Override
-  public int getResultSetHoldability() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getResultSetHoldability not supported");
-  }
-
-  @Override
-  public int getResultSetType() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getResultSetType not supported");
-  }
-
-  @Override
-  public int getUpdateCount() throws SQLException {
-    return updateCount;
-  }
-
-  @Override
-  public SQLWarning getWarnings() throws SQLException {
-    return warningChain;
-  }
-
-  @Override
-  public boolean isClosed() throws SQLException {
-    return isClosed;
-  }
-
-   public boolean isCloseOnCompletion() throws SQLException {
-     //JDK 1.7
-     throw new SQLFeatureNotSupportedException("isCloseOnCompletion not supported");
-   }
-
-  @Override
-  public boolean isPoolable() throws SQLException {
-    throw new SQLFeatureNotSupportedException("isPoolable not supported");
-  }
-
-  @Override
-  public void setCursorName(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setCursorName not supported");
-  }
-
-  @Override
-  public void setEscapeProcessing(boolean enable) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setEscapeProcessing not supported");
-  }
-
-  @Override
-  public void setFetchDirection(int direction) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setFetchDirection not supported");
-  }
-
-  @Override
-  public void setFetchSize(int rows) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setFetchSize not supported");
-  }
-
-  @Override
-  public void setMaxFieldSize(int max) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setMaxFieldSize not supported");
-  }
-
-  @Override
-  public void setMaxRows(int max) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setMaxRows not supported");
-  }
-
-  @Override
-  public void setPoolable(boolean poolable) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setPoolable not supported");
-  }
-
-  @Override
-  public void setQueryTimeout(int seconds) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setQueryTimeout not supported");
-  }
-
-  @Override
-  public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    throw new SQLFeatureNotSupportedException("isWrapperFor not supported");
-  }
-
-  @Override
-  public <T> T unwrap(Class<T> iface) throws SQLException {
-    throw new SQLFeatureNotSupportedException("unwrap 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/TajoResultSet.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSet.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSet.java
deleted file mode 100644
index 1005765..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSet.java
+++ /dev/null
@@ -1,152 +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 com.google.common.collect.Lists;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.PathFilter;
-import org.apache.tajo.QueryId;
-import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.catalog.TableMeta;
-import org.apache.tajo.client.TajoClient;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.storage.FileScanner;
-import org.apache.tajo.storage.MergeScanner;
-import org.apache.tajo.storage.Scanner;
-import org.apache.tajo.storage.Tuple;
-import org.apache.tajo.storage.fragment.FileFragment;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-
-public class TajoResultSet extends TajoResultSetBase {
-  private FileSystem fs;
-  private Scanner scanner;
-  private TajoClient tajoClient;
-  QueryId queryId;
-
-  public TajoResultSet(TajoClient tajoClient, QueryId queryId) {
-    this.tajoClient = tajoClient;
-    this.queryId = queryId;
-    init();
-  }
-
-  public TajoResultSet(TajoClient tajoClient, QueryId queryId,
-                       Configuration conf, TableDesc desc) throws IOException {
-    this.schema = desc.getSchema();
-    this.tajoClient = tajoClient;
-    this.queryId = queryId;
-    if(desc != null) {
-      fs = FileScanner.getFileSystem((TajoConf)conf, desc.getPath());
-      this.totalRow = desc.getStats() != null ? desc.getStats().getNumRows() : 0;
-
-      Collection<FileFragment> frags = getFragments(desc.getMeta(), desc.getPath());
-      scanner = new MergeScanner(conf, schema, desc.getMeta(), frags);
-    }
-    init();
-  }
-
-  @Override
-  protected void init() {
-    cur = null;
-    curRow = 0;
-  }
-
-  class FileNameComparator implements Comparator<FileStatus> {
-
-    @Override
-    public int compare(FileStatus f1, FileStatus f2) {
-      return f2.getPath().getName().compareTo(f1.getPath().getName());
-    }
-  }
-
-  private Collection<FileFragment> getFragments(TableMeta meta, Path tablePath)
-      throws IOException {
-    List<FileFragment> fraglist = Lists.newArrayList();
-    FileStatus[] files = fs.listStatus(tablePath, new PathFilter() {
-      @Override
-      public boolean accept(Path path) {
-        return path.getName().charAt(0) != '.';
-      }
-    });
-    Arrays.sort(files, new FileNameComparator());
-
-    String tbname = tablePath.getName();
-    for (int i = 0; i < files.length; i++) {
-      if (files[i].getLen() == 0) {
-        continue;
-      }
-      fraglist.add(new FileFragment(tbname + "_" + i, files[i].getPath(), 0l, files[i].getLen()));
-    }
-    return fraglist;
-  }
-
-  @Override
-  public void close() throws SQLException {
-    try {
-      if(tajoClient != null) {
-        this.tajoClient.closeQuery(queryId);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-    try {
-      if(scanner != null) {
-        this.scanner.close();
-      }
-      //TODO clean temp result file
-      cur = null;
-      curRow = -1;
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
-  }
-
-  @Override
-  public void beforeFirst() throws SQLException {
-    try {
-      if(scanner != null) {
-        scanner.reset();
-      }
-      init();
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
-  }
-
-
-  @Override
-  protected Tuple nextTuple() throws IOException {
-    if(scanner == null) {
-      return null;
-    }
-    return scanner.next();
-  }
-
-  public boolean hasResult() {
-    return scanner != null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSetBase.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSetBase.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSetBase.java
deleted file mode 100644
index f4d685f..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSetBase.java
+++ /dev/null
@@ -1,1129 +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.catalog.Schema;
-import org.apache.tajo.common.TajoDataTypes;
-import org.apache.tajo.datum.Datum;
-import org.apache.tajo.datum.NullDatum;
-import org.apache.tajo.storage.Tuple;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.*;
-import java.util.Calendar;
-import java.util.Map;
-
-public abstract class TajoResultSetBase implements ResultSet {
-  protected int curRow;
-  protected long totalRow;
-  protected boolean wasNull;
-  protected Schema schema;
-  protected Tuple cur;
-
-  protected void init() {
-    cur = null;
-    curRow = 0;
-    totalRow = 0;
-    wasNull = false;
-  }
-
-  private void handleNull(Datum d) {
-    wasNull = (d instanceof NullDatum);
-  }
-
-  @Override
-  public void beforeFirst() throws SQLException {
-    init();
-  }
-
-  @Override
-  public boolean getBoolean(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    handleNull(datum);
-    return datum.asBool();
-  }
-
-  @Override
-  public boolean getBoolean(String colName) throws SQLException {
-    Datum datum = cur.get(findColumn(colName));
-    handleNull(datum);
-    return datum.asBool();
-  }
-
-  @Override
-  public byte getByte(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    handleNull(datum);
-    return datum.asByte();
-  }
-
-  @Override
-  public byte getByte(String name) throws SQLException {
-    Datum datum = cur.get(findColumn(name));
-    handleNull(datum);
-    return datum.asByte();
-  }
-
-  @Override
-  public byte[] getBytes(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    handleNull(datum);
-    return datum.asByteArray();
-  }
-
-  @Override
-  public byte[] getBytes(String name) throws SQLException {
-    Datum datum = cur.get(findColumn(name));
-    handleNull(datum);
-    return datum.asByteArray();
-  }
-
-  @Override
-  public double getDouble(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    handleNull(datum);
-    return datum.asFloat8();
-  }
-
-  @Override
-  public double getDouble(String name) throws SQLException {
-    Datum datum = cur.get(findColumn(name));
-    handleNull(datum);
-    return datum.asFloat8();
-  }
-
-  @Override
-  public float getFloat(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    handleNull(datum);
-    return datum.asFloat4();
-  }
-
-  @Override
-  public float getFloat(String name) throws SQLException {
-    Datum datum = cur.get(findColumn(name));
-    handleNull(datum);
-    return datum.asFloat4();
-  }
-
-  @Override
-  public int getInt(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    handleNull(datum);
-    return datum.asInt4();
-  }
-
-  @Override
-  public int getInt(String name) throws SQLException {
-    Datum datum = cur.get(findColumn(name));
-    handleNull(datum);
-    return datum.asInt4();
-  }
-
-  @Override
-  public long getLong(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    handleNull(datum);
-    return datum.asInt8();
-  }
-
-  @Override
-  public long getLong(String name) throws SQLException {
-    Datum datum = cur.get(findColumn(name));
-    handleNull(datum);
-    return datum.asInt8();
-  }
-
-  @Override
-  public Object getObject(int fieldId) throws SQLException {
-    Datum d = cur.get(fieldId - 1);
-    handleNull(d);
-
-    TajoDataTypes.Type dataType = schema.getColumn(fieldId - 1).getDataType().getType();
-
-    switch(dataType) {
-      case BOOLEAN:  return d.asBool();
-      case INT1:
-      case INT2: return d.asInt2();
-      case INT4: return d.asInt4();
-      case INT8: return d.asInt8();
-      case TEXT:
-      case CHAR:
-      case DATE:
-      case VARCHAR:  return d.asChars();
-      case FLOAT4:  return d.asFloat4();
-      case FLOAT8:  return d.asFloat8();
-      case DECIMAL:
-      case NUMERIC:  return d.asFloat8();
-      default: return d.asChars();
-    }
-  }
-
-  @Override
-  public Object getObject(String name) throws SQLException {
-    return getObject(findColumn(name));
-  }
-
-  @Override
-  public short getShort(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    handleNull(datum);
-    return datum.asInt2();
-  }
-
-  @Override
-  public short getShort(String name) throws SQLException {
-    Datum datum = cur.get(findColumn(name));
-    handleNull(datum);
-    return datum.asInt2();
-  }
-
-  @Override
-  public String getString(int fieldId) throws SQLException {
-    Datum datum = cur.get(fieldId - 1);
-    handleNull(datum);
-    return datum.asChars();
-  }
-
-  @Override
-  public String getString(String name) throws SQLException {
-    Datum datum = cur.get(findColumn(name));
-    handleNull(datum);
-    return datum.asChars();
-  }
-
-  @Override
-  public boolean isWrapperFor(Class<?> clazz) throws SQLException {
-    throw new SQLFeatureNotSupportedException("isWrapperFor not supported");
-  }
-
-  @Override
-  public <T> T unwrap(Class<T> clazz) throws SQLException {
-    throw new SQLFeatureNotSupportedException("unwrap not supported");
-  }
-
-  @Override
-  public boolean absolute(int row) throws SQLException {
-    throw new SQLFeatureNotSupportedException("absolute not supported");
-  }
-
-  @Override
-  public void afterLast() throws SQLException {
-    while (this.next())
-      ;
-  }
-
-  @Override
-  public void cancelRowUpdates() throws SQLException {
-    throw new SQLFeatureNotSupportedException("cancelRowUpdates not supported");
-  }
-
-  @Override
-  public void clearWarnings() throws SQLException {
-    throw new SQLFeatureNotSupportedException("clearWarnings not supported");
-  }
-
-  @Override
-  public void deleteRow() throws SQLException {
-    throw new SQLFeatureNotSupportedException("deleteRow not supported");
-  }
-
-  @Override
-  public int findColumn(String colName) throws SQLException {
-    return schema.getColumnIdByName(colName);
-  }
-
-  @Override
-  public boolean first() throws SQLException {
-    this.beforeFirst();
-    return this.next();
-  }
-
-  @Override
-  public Array getArray(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getArray not supported");
-  }
-
-  @Override
-  public Array getArray(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getArray not supported");
-  }
-
-  @Override
-  public InputStream getAsciiStream(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getAsciiStream not supported");
-  }
-
-  @Override
-  public InputStream getAsciiStream(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getAsciiStream not supported");
-  }
-
-  @Override
-  public BigDecimal getBigDecimal(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getBigDecimal not supported");
-  }
-
-  @Override
-  public BigDecimal getBigDecimal(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getBigDecimal not supported");
-  }
-
-  @Override
-  public BigDecimal getBigDecimal(int index, int x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getBigDecimal not supported");
-  }
-
-  @Override
-  public BigDecimal getBigDecimal(String name, int x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getBigDecimal not supported");
-  }
-
-  @Override
-  public InputStream getBinaryStream(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getBinaryStream not supported");
-  }
-
-  @Override
-  public InputStream getBinaryStream(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getBinaryStream not supported");
-  }
-
-  @Override
-  public Blob getBlob(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getBlob not supported");
-  }
-
-  @Override
-  public Blob getBlob(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getBlob not supported");
-  }
-
-  @Override
-  public Reader getCharacterStream(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getCharacterStream not supported");
-  }
-
-  @Override
-  public Reader getCharacterStream(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getCharacterStream not supported");
-  }
-
-  @Override
-  public Clob getClob(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getClob not supported");
-  }
-
-  @Override
-  public Clob getClob(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getClob not supported");
-  }
-
-  @Override
-  public int getConcurrency() throws SQLException {
-    return ResultSet.CONCUR_READ_ONLY;
-  }
-
-  @Override
-  public String getCursorName() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getCursorName not supported");
-  }
-
-  @Override
-  public Date getDate(int index) throws SQLException {
-    Object obj = getObject(index);
-    if (obj == null) {
-      return null;
-    }
-
-    try {
-      return Date.valueOf((String) obj);
-    } catch (Exception e) {
-      throw new SQLException("Cannot convert column " + index
-          + " to date: " + e.toString());
-    }
-  }
-
-  @Override
-  public Date getDate(String name) throws SQLException {
-    return getDate(findColumn(name));
-  }
-
-  @Override
-  public Date getDate(int index, Calendar x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getDate not supported");
-  }
-
-  @Override
-  public Date getDate(String name, Calendar x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getDate not supported");
-  }
-
-  @Override
-  public int getFetchDirection() throws SQLException {
-    return ResultSet.FETCH_FORWARD;
-  }
-
-  @Override
-  public int getFetchSize() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getFetchSize not supported");
-  }
-
-  @Override
-  public int getHoldability() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getHoldability not supported");
-  }
-
-  @Override
-  public ResultSetMetaData getMetaData() throws SQLException {
-    return new TajoResultSetMetaData(schema);
-  }
-
-  @Override
-  public Reader getNCharacterStream(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getNCharacterStream not supported");
-  }
-
-  @Override
-  public Reader getNCharacterStream(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getNCharacterStream not supported");
-  }
-
-  @Override
-  public NClob getNClob(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getNClob not supported");
-  }
-
-  @Override
-  public NClob getNClob(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getNClob not supported");
-  }
-
-  @Override
-  public String getNString(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getNString not supported");
-  }
-
-  @Override
-  public String getNString(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getNString not supported");
-  }
-
-  @Override
-  public Object getObject(int index, Map<String, Class<?>> x)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getObject not supported");
-  }
-
-  @Override
-  public Object getObject(String name, Map<String, Class<?>> x)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("getObject not supported");
-  }
-
-  public <T> T getObject(String name, Class<T> x)
-      throws SQLException {
-    //JDK 1.7
-    throw new SQLFeatureNotSupportedException("getObject not supported");
-  }
-
-  public <T> T getObject(int index, Class<T> x)
-      throws SQLException {
-    //JDK 1.7
-    throw new SQLFeatureNotSupportedException("getObject not supported");
-  }
-
-  @Override
-  public Ref getRef(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getRef not supported");
-  }
-
-  @Override
-  public Ref getRef(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getRef not supported");
-  }
-
-  @Override
-  public int getRow() throws SQLException {
-    return curRow;
-  }
-
-  @Override
-  public RowId getRowId(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getRowId not supported");
-  }
-
-  @Override
-  public RowId getRowId(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getRowId not supported");
-  }
-
-  @Override
-  public SQLXML getSQLXML(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getSQLXML not supported");
-  }
-
-  @Override
-  public SQLXML getSQLXML(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getSQLXML not supported");
-  }
-
-  @Override
-  public Statement getStatement() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getStatement not supported");
-  }
-
-  @Override
-  public Time getTime(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getTime not supported");
-  }
-
-  @Override
-  public Time getTime(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getTime not supported");
-  }
-
-  @Override
-  public Time getTime(int index, Calendar x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getTime not supported");
-  }
-
-  @Override
-  public Time getTime(String name, Calendar x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getTime not supported");
-  }
-
-  @Override
-  public Timestamp getTimestamp(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getTimestamp not supported");
-  }
-
-  @Override
-  public Timestamp getTimestamp(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getTimestamp not supported");
-  }
-
-  @Override
-  public Timestamp getTimestamp(int index, Calendar x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getTimestamp not supported");
-  }
-
-  @Override
-  public Timestamp getTimestamp(String name, Calendar x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getTimestamp not supported");
-  }
-
-  @Override
-  public int getType() throws SQLException {
-    return ResultSet.TYPE_FORWARD_ONLY;
-  }
-
-  @Override
-  public URL getURL(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getURL not supported");
-  }
-
-  @Override
-  public URL getURL(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getURL not supported");
-  }
-
-  @Override
-  public InputStream getUnicodeStream(int index) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getUnicodeStream not supported");
-  }
-
-  @Override
-  public InputStream getUnicodeStream(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getUnicodeStream not supported");
-  }
-
-  @Override
-  public SQLWarning getWarnings() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getWarnings not supported");
-  }
-
-  @Override
-  public void insertRow() throws SQLException {
-    throw new SQLFeatureNotSupportedException("insertRow not supported");
-  }
-
-  @Override
-  public boolean isAfterLast() throws SQLException {
-    return this.curRow > this.totalRow;
-  }
-
-  @Override
-  public boolean isBeforeFirst() throws SQLException {
-    return this.curRow == 0;
-  }
-
-  @Override
-  public boolean isClosed() throws SQLException {
-    return this.curRow == -1;
-  }
-
-  @Override
-  public boolean isFirst() throws SQLException {
-    return this.curRow == 1;
-  }
-
-  @Override
-  public boolean isLast() throws SQLException {
-    return this.curRow == this.totalRow;
-  }
-
-  @Override
-  public boolean last() throws SQLException {
-    Tuple last = null;
-    while (this.next()) {
-      last = cur;
-    }
-    cur = last;
-    return true;
-  }
-
-  @Override
-  public void moveToCurrentRow() throws SQLException {
-    throw new SQLFeatureNotSupportedException("moveToCurrentRow not supported");
-  }
-
-  @Override
-  public void moveToInsertRow() throws SQLException {
-    throw new SQLFeatureNotSupportedException("moveToInsertRow not supported");
-  }
-
-  @Override
-  public boolean next() throws SQLException {
-    try {
-      if (totalRow <= 0) {
-        return false;
-      }
-
-      cur = nextTuple();
-      curRow++;
-      if (cur != null) {
-        return true;
-      }
-    } catch (IOException e) {
-      throw new SQLException(e.getMessage());
-    }
-    return false;
-  }
-
-  protected abstract Tuple nextTuple() throws IOException;
-
-  @Override
-  public boolean previous() throws SQLException {
-    throw new SQLFeatureNotSupportedException("previous not supported");
-  }
-
-  @Override
-  public void refreshRow() throws SQLException {
-    throw new SQLFeatureNotSupportedException("refreshRow not supported");
-  }
-
-  @Override
-  public boolean relative(int rows) throws SQLException {
-    throw new SQLFeatureNotSupportedException("relative not supported");
-  }
-
-  @Override
-  public boolean rowDeleted() throws SQLException {
-    throw new SQLFeatureNotSupportedException("rowDeleted not supported");
-  }
-
-  @Override
-  public boolean rowInserted() throws SQLException {
-    throw new SQLFeatureNotSupportedException("rowInserted not supported");
-  }
-
-  @Override
-  public boolean rowUpdated() throws SQLException {
-    throw new SQLFeatureNotSupportedException("rowUpdated not supported");
-  }
-
-  @Override
-  public void setFetchDirection(int direction) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setFetchDirection not supported");
-  }
-
-  @Override
-  public void setFetchSize(int size) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setFetchSize not supported");
-  }
-
-  @Override
-  public void updateArray(int index, Array x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateArray not supported");
-  }
-
-  @Override
-  public void updateArray(String name, Array x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateArray not supported");
-  }
-
-  @Override
-  public void updateAsciiStream(int index, InputStream x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateAsciiStream not supported");
-  }
-
-  @Override
-  public void updateAsciiStream(String name, InputStream x)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateAsciiStream not supported");
-  }
-
-  @Override
-  public void updateAsciiStream(int index, InputStream x, int length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateAsciiStream not supported");
-  }
-
-  @Override
-  public void updateAsciiStream(String name, InputStream x, int length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateAsciiStream not supported");
-  }
-
-  @Override
-  public void updateAsciiStream(int index, InputStream x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateAsciiStream not supported");
-  }
-
-  @Override
-  public void updateAsciiStream(String name, InputStream x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateAsciiStream not supported");
-  }
-
-  @Override
-  public void updateBigDecimal(int index, BigDecimal x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBigDecimal not supported");
-  }
-
-  @Override
-  public void updateBigDecimal(String name, BigDecimal x)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBigDecimal not supported");
-  }
-
-  @Override
-  public void updateBinaryStream(int index, InputStream x)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBinaryStream not supported");
-  }
-
-  @Override
-  public void updateBinaryStream(String name, InputStream x)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBinaryStream not supported");
-  }
-
-  @Override
-  public void updateBinaryStream(int index, InputStream x, int length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBinaryStream not supported");
-  }
-
-  @Override
-  public void updateBinaryStream(String name, InputStream x, int length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBinaryStream not supported");
-  }
-
-  @Override
-  public void updateBinaryStream(int index, InputStream x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBinaryStream not supported");
-  }
-
-  @Override
-  public void updateBinaryStream(String name, InputStream x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBinaryStream not supported");
-  }
-
-  @Override
-  public void updateBlob(int index, Blob x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBlob not supported");
-  }
-
-  @Override
-  public void updateBlob(String name, Blob x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBlob not supported");
-  }
-
-  @Override
-  public void updateBlob(int index, InputStream x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBlob not supported");
-  }
-
-  @Override
-  public void updateBlob(String name, InputStream x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBlob not supported");
-  }
-
-  @Override
-  public void updateBlob(int index, InputStream x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBlob not supported");
-  }
-
-  @Override
-  public void updateBlob(String name, InputStream x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBlob not supported");
-  }
-
-  @Override
-  public void updateBoolean(int index, boolean x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBoolean not supported");
-  }
-
-  @Override
-  public void updateBoolean(String name, boolean x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateBoolean not supported");
-  }
-
-  @Override
-  public void updateByte(int index, byte x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateByte not supported");
-  }
-
-  @Override
-  public void updateByte(String name, byte x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateByte not supported");
-  }
-
-  @Override
-  public void updateBytes(int index, byte[] x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateByte not supported");
-  }
-
-  @Override
-  public void updateBytes(String name, byte[] x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateByte not supported");
-  }
-
-  @Override
-  public void updateCharacterStream(int index, Reader x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateCharacterStream not supported");
-  }
-
-  @Override
-  public void updateCharacterStream(String name, Reader x)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateCharacterStream not supported");
-  }
-
-  @Override
-  public void updateCharacterStream(int index, Reader x, int length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateCharacterStream not supported");
-  }
-
-  @Override
-  public void updateCharacterStream(String name, Reader x, int length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateCharacterStream not supported");
-  }
-
-  @Override
-  public void updateCharacterStream(int index, Reader x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateCharacterStream not supported");
-  }
-
-  @Override
-  public void updateCharacterStream(String name, Reader x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateCharacterStream not supported");
-  }
-
-  @Override
-  public void updateClob(int index, Clob x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateClob not supported");
-  }
-
-  @Override
-  public void updateClob(String name, Clob x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateClob not supported");
-  }
-
-  @Override
-  public void updateClob(int index, Reader x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateClob not supported");
-  }
-
-  @Override
-  public void updateClob(String name, Reader x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateClob not supported");
-  }
-
-  @Override
-  public void updateClob(int index, Reader x, long length) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateClob not supported");
-  }
-
-  @Override
-  public void updateClob(String name, Reader x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateClob not supported");
-  }
-
-  @Override
-  public void updateDate(int index, Date x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateDate not supported");
-  }
-
-  @Override
-  public void updateDate(String name, Date x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateDate not supported");
-  }
-
-  @Override
-  public void updateDouble(int index, double x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateDouble not supported");
-  }
-
-  @Override
-  public void updateDouble(String name, double x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateDouble not supported");
-  }
-
-  @Override
-  public void updateFloat(int index, float x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateFloat not supported");
-  }
-
-  @Override
-  public void updateFloat(String name, float x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateFloat not supported");
-  }
-
-  @Override
-  public void updateInt(int index, int x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateInt not supported");
-  }
-
-  @Override
-  public void updateInt(String name, int x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateInt not supported");
-  }
-
-  @Override
-  public void updateLong(int index, long x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateLong not supported");
-  }
-
-  @Override
-  public void updateLong(String name, long x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateLong not supported");
-  }
-
-  @Override
-  public void updateNCharacterStream(int index, Reader x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNCharacterStream not supported");
-  }
-
-  @Override
-  public void updateNCharacterStream(String name, Reader x)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNCharacterStream not supported");
-  }
-
-  @Override
-  public void updateNCharacterStream(int index, Reader x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNCharacterStream not supported");
-  }
-
-  @Override
-  public void updateNCharacterStream(String name, Reader x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNCharacterStream not supported");
-  }
-
-  @Override
-  public void updateNClob(int index, NClob x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNClob not supported");
-  }
-
-  @Override
-  public void updateNClob(String name, NClob x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNClob not supported");
-  }
-
-  @Override
-  public void updateNClob(int index, Reader x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNClob not supported");
-  }
-
-  @Override
-  public void updateNClob(String name, Reader x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNClob not supported");
-  }
-
-  @Override
-  public void updateNClob(int index, Reader x, long length) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNClob not supported");
-  }
-
-  @Override
-  public void updateNClob(String name, Reader x, long length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNClob not supported");
-  }
-
-  @Override
-  public void updateNString(int arg0, String x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNString not supported");
-  }
-
-  @Override
-  public void updateNString(String name, String x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNString not supported");
-  }
-
-  @Override
-  public void updateNull(int arg0) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNull not supported");
-  }
-
-  @Override
-  public void updateNull(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateNull not supported");
-  }
-
-  @Override
-  public void updateObject(int index, Object x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateObject not supported");
-  }
-
-  @Override
-  public void updateObject(String name, Object x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateObject not supported");
-  }
-
-  @Override
-  public void updateObject(int index, Object x, int length) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateObject not supported");
-  }
-
-  @Override
-  public void updateObject(String name, Object x, int length)
-      throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateObject not supported");
-  }
-
-  @Override
-  public void updateRef(int index, Ref x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateRef not supported");
-  }
-
-  @Override
-  public void updateRef(String name, Ref x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateRef not supported");
-  }
-
-  @Override
-  public void updateRow() throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateRow not supported");
-  }
-
-  @Override
-  public void updateRowId(int index, RowId arg1) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateRowId not supported");
-  }
-
-  @Override
-  public void updateRowId(String name, RowId x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateRowId not supported");
-  }
-
-  @Override
-  public void updateSQLXML(int index, SQLXML arg1) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateSQLXML not supported");
-  }
-
-  @Override
-  public void updateSQLXML(String name, SQLXML x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateSQLXML not supported");
-
-  }
-
-  @Override
-  public void updateShort(int index, short x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateShort not supported");
-
-  }
-
-  @Override
-  public void updateShort(String name, short x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateShort not supported");
-
-  }
-
-  @Override
-  public void updateString(int index, String x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateString not supported");
-
-  }
-
-  @Override
-  public void updateString(String name, String arg1) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateString not supported");
-
-  }
-
-  @Override
-  public void updateTime(int index, Time x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateTime not supported");
-
-  }
-
-  @Override
-  public void updateTime(String name, Time x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateTime not supported");
-
-  }
-
-  @Override
-  public void updateTimestamp(int index, Timestamp x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateTimestamp not supported");
-
-  }
-
-  @Override
-  public void updateTimestamp(String name, Timestamp x) throws SQLException {
-    throw new SQLFeatureNotSupportedException("updateTimestamp not supported");
-
-  }
-
-  @Override
-  public boolean wasNull() throws SQLException {
-    return wasNull;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSetMetaData.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSetMetaData.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSetMetaData.java
deleted file mode 100644
index 5a04ad0..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoResultSetMetaData.java
+++ /dev/null
@@ -1,160 +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.catalog.Schema;
-import org.apache.tajo.common.TajoDataTypes.DataType;
-
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-
-public class TajoResultSetMetaData implements ResultSetMetaData {
-  Schema schema;
-
-  
-  public TajoResultSetMetaData(Schema schema) {
-    this.schema = schema;
-  }
-
-  @Override
-  public boolean isWrapperFor(Class<?> clazz) throws SQLException {
-    throw new SQLFeatureNotSupportedException("isWrapperFor not supported");
-  }
-
-  @Override
-  public <T> T unwrap(Class<T> clazz) throws SQLException {
-    throw new SQLFeatureNotSupportedException("unwrap not supported");
-  }
-
-  @Override
-  public String getCatalogName(int column) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getCatalogName not supported");
-  }
-
-  @Override
-  public String getColumnClassName(int column) throws SQLException {
-    return schema.getColumn(column - 1).getClass().getName();
-  }
-
-  @Override
-  public int getColumnCount() throws SQLException {
-    if(schema == null) {
-      return 0;
-    }
-    return schema.getColumnNum();
-  }
-
-  @Override
-  public int getColumnDisplaySize(int column) throws SQLException {
-    return TajoDriver.columnDisplaySize(getColumnType(column));
-  }
-
-  @Override
-  public String getColumnLabel(int column) throws SQLException {
-    return schema.getColumn(column - 1).getQualifiedName();
-  }
-
-  @Override
-  public String getColumnName(int column) throws SQLException {
-    return schema.getColumn(column - 1).getColumnName();
-  }
-
-  @Override
-  public int getColumnType(int column) throws SQLException {
-    DataType type = schema.getColumn(column - 1).getDataType();
-
-    return TajoDriver.tajoTypeToSqlType(type);
-  }
-
-  @Override
-  public String getColumnTypeName(int column) throws SQLException {
-    DataType type = schema.getColumn(column - 1).getDataType();
-
-    return TajoDriver.toSqlType(type);
-  }
-
-  @Override
-  public int getPrecision(int column) throws SQLException {
-    return TajoDriver.columnDisplaySize(getColumnType(column));
-  }
-
-  @Override
-  public int getScale(int column) throws SQLException {
-    return TajoDriver.columnScale(getColumnType(column));
-  }
-
-  @Override
-  public String getSchemaName(int column) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getSchemaName not supported");
-  }
-
-  @Override
-  public String getTableName(int column) throws SQLException {
-    return schema.getColumn(column - 1).getQualifier();
-  }
-
-  @Override
-  public boolean isAutoIncrement(int column) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean isCaseSensitive(int column) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public boolean isCurrency(int column) throws SQLException {
-    throw new SQLFeatureNotSupportedException("isCurrency not supported");
-  }
-
-  @Override
-  public boolean isDefinitelyWritable(int column) throws SQLException {
-    return false;
-  }
-
-  @Override
-  public int isNullable(int column) throws SQLException {
-    return ResultSetMetaData.columnNullable;
-  }
-
-  @Override
-  public boolean isReadOnly(int column) throws SQLException {
-    return true;
-  }
-
-  @Override
-  public boolean isSearchable(int column) throws SQLException {
-    return true;
-  }
-
-  @Override
-  public boolean isSigned(int column) throws SQLException {
-    throw new SQLFeatureNotSupportedException("isSigned not supported");
-  }
-
-  @Override
-  public boolean isWritable(int column) throws SQLException {
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoStatement.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoStatement.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoStatement.java
deleted file mode 100644
index 6002fcd..0000000
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/jdbc/TajoStatement.java
+++ /dev/null
@@ -1,289 +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 java.sql.*;
-
-public class TajoStatement implements Statement {
-  private TajoClient tajoClient;
-  private int fetchSize = 200;
-
-  /**
-   * We need to keep a reference to the result set to support the following:
-   * <code>
-   * statement.execute(String sql);
-   * statement.getResultSet();
-   * </code>.
-   */
-  private ResultSet resultSet = null;
-
-  /**
-   * Add SQLWarnings to the warningChain if needed.
-   */
-  private SQLWarning warningChain = null;
-
-  /**
-   * Keep state so we can fail certain calls made after close().
-   */
-  private boolean isClosed = false;
-
-  public TajoStatement(TajoClient tajoClient) {
-    this.tajoClient = tajoClient;
-  }
-
-  @Override
-  public void addBatch(String sql) throws SQLException {
-    throw new SQLFeatureNotSupportedException("addBatch not supported");
-  }
-
-  @Override
-  public void cancel() throws SQLException {
-    throw new SQLFeatureNotSupportedException("cancel not supported");
-  }
-
-  @Override
-  public void clearBatch() throws SQLException {
-    throw new SQLFeatureNotSupportedException("clearBatch not supported");
-  }
-
-  @Override
-  public void clearWarnings() throws SQLException {
-    warningChain = null;
-  }
-
-  @Override
-  public void close() throws SQLException {
-    resultSet = null;
-    isClosed = true;
-  }
-
-  public void closeOnCompletion() throws SQLException {
-     // JDK 1.7
-     throw new SQLFeatureNotSupportedException("closeOnCompletion not supported");
-  }
-
-  @Override
-  public boolean execute(String sql) throws SQLException {
-    resultSet = executeQuery(sql);
-
-    return resultSet != null;
-  }
-
-  @Override
-  public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
-    throw new SQLFeatureNotSupportedException("execute not supported");
-  }
-
-  @Override
-  public boolean execute(String sql, int[] columnIndexes) throws SQLException {
-    throw new SQLFeatureNotSupportedException("execute not supported");
-  }
-
-  @Override
-  public boolean execute(String sql, String[] columnNames) throws SQLException {
-    throw new SQLFeatureNotSupportedException("execute not supported");
-  }
-
-  @Override
-  public int[] executeBatch() throws SQLException {
-    throw new SQLFeatureNotSupportedException("executeBatch not supported");
-  }
-
-  @Override
-  public ResultSet executeQuery(String sql) throws SQLException {
-    if (isClosed) {
-      throw new SQLFeatureNotSupportedException("Can't execute after statement has been closed");
-    }
-
-    try {
-      return tajoClient.executeQueryAndGetResult(sql);
-    } catch (Exception e) {
-      throw new SQLFeatureNotSupportedException(e.getMessage(), e);
-    }
-  }
-
-  @Override
-  public int executeUpdate(String sql) throws SQLException {
-    try {
-      tajoClient.executeQuery(sql);
-
-      return 1;
-    } catch (Exception ex) {
-      throw new SQLFeatureNotSupportedException(ex.toString());
-    }
-  }
-
-  @Override
-  public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
-    throw new SQLFeatureNotSupportedException("executeUpdate not supported");
-  }
-
-  @Override
-  public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
-    throw new SQLFeatureNotSupportedException("executeUpdate not supported");
-  }
-
-  @Override
-  public int executeUpdate(String sql, String[] columnNames) throws SQLException {
-    throw new SQLFeatureNotSupportedException("executeUpdate not supported");
-  }
-
-  @Override
-  public Connection getConnection() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getConnection not supported");
-  }
-
-  @Override
-  public int getFetchDirection() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getFetchDirection not supported");
-  }
-
-  @Override
-  public int getFetchSize() throws SQLException {
-    return fetchSize;
-  }
-
-  @Override
-  public ResultSet getGeneratedKeys() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getGeneratedKeys not supported");
-  }
-
-  @Override
-  public int getMaxFieldSize() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxFieldSize not supported");
-  }
-
-  @Override
-  public int getMaxRows() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMaxRows not supported");
-  }
-
-  @Override
-  public boolean getMoreResults() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMoreResults not supported");
-  }
-
-  @Override
-  public boolean getMoreResults(int current) throws SQLException {
-    throw new SQLFeatureNotSupportedException("getMoreResults not supported");
-  }
-
-  @Override
-  public int getQueryTimeout() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getQueryTimeout not supported");
-  }
-
-  @Override
-  public ResultSet getResultSet() throws SQLException {
-    return resultSet;
-  }
-
-  @Override
-  public int getResultSetConcurrency() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getResultSetConcurrency not supported");
-  }
-
-  @Override
-  public int getResultSetHoldability() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getResultSetHoldability not supported");
-  }
-
-  @Override
-  public int getResultSetType() throws SQLException {
-    throw new SQLFeatureNotSupportedException("getResultSetType not supported");
-  }
-
-  @Override
-  public int getUpdateCount() throws SQLException {
-    return 0;
-  }
-
-  @Override
-  public SQLWarning getWarnings() throws SQLException {
-    return warningChain;
-  }
-
-  @Override
-  public boolean isClosed() throws SQLException {
-    return isClosed;
-  }
-
-  public boolean isCloseOnCompletion() throws SQLException {
-    // JDK 1.7
-    throw new SQLFeatureNotSupportedException("isCloseOnCompletion not supported");
-  }
-
-  @Override
-  public boolean isPoolable() throws SQLException {
-    throw new SQLFeatureNotSupportedException("isPoolable not supported");
-  }
-
-  @Override
-  public void setCursorName(String name) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setCursorName not supported");
-  }
-
-  @Override
-  public void setEscapeProcessing(boolean enable) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setEscapeProcessing not supported");
-  }
-
-  @Override
-  public void setFetchDirection(int direction) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setFetchDirection not supported");
-  }
-
-  @Override
-  public void setFetchSize(int rows) throws SQLException {
-    fetchSize = rows;
-  }
-
-  @Override
-  public void setMaxFieldSize(int max) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setMaxFieldSize not supported");
-  }
-
-  @Override
-  public void setMaxRows(int max) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setMaxRows not supported");
-  }
-
-  @Override
-  public void setPoolable(boolean poolable) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setPoolable not supported");
-  }
-
-  @Override
-  public void setQueryTimeout(int seconds) throws SQLException {
-    throw new SQLFeatureNotSupportedException("setQueryTimeout not supported");
-  }
-
-  @Override
-  public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    throw new SQLFeatureNotSupportedException("isWrapperFor not supported");
-  }
-
-  @Override
-  public <T> T unwrap(Class<T> iface) throws SQLException {
-    throw new SQLFeatureNotSupportedException("unwrap not supported");
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/proto/ClientProtos.proto
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/proto/ClientProtos.proto b/tajo-core/tajo-core-backend/src/main/proto/ClientProtos.proto
deleted file mode 100644
index 0637023..0000000
--- a/tajo-core/tajo-core-backend/src/main/proto/ClientProtos.proto
+++ /dev/null
@@ -1,139 +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.
- */
-
-option java_package = "org.apache.tajo.ipc";
-option java_outer_classname = "ClientProtos";
-option java_generic_services = true;
-option java_generate_equals_and_hash = true;
-
-import "yarn_protos.proto";
-import "tajo_protos.proto";
-import "TajoIdProtos.proto";
-import "CatalogProtos.proto";
-import "PrimitiveProtos.proto";
-
-enum ResultCode {
-  OK = 0;
-  ERROR = 1;
-}
-
-message UpdateSessionVariableRequest {
-  optional SessionIdProto sessionId = 1;
-  repeated KeyValueProto setVariables = 2;
-  repeated string unsetVariables = 3;
-}
-
-message QueryRequest {
-  optional SessionIdProto sessionId = 1;
-  required string query = 2;
-  repeated KeyValueProto setVariables = 3;
-}
-
-message UpdateQueryResponse {
-  required ResultCode resultCode = 1;
-  optional string errorMessage = 2;
-}
-
-message SubmitQueryResponse {
-  required ResultCode resultCode = 1;
-  optional QueryIdProto queryId = 2;
-  optional string errorMessage = 3;
-}
-
-message GetQueryResultRequest {
-  optional SessionIdProto sessionId = 1;
-  required QueryIdProto queryId = 2;
-}
-
-message GetQueryResultResponse {
-  optional TableDescProto tableDesc = 1;
-  optional string errorMessage = 2;
-  required string tajoUserName = 3;
-}
-
-message GetQueryListRequest {
-  optional SessionIdProto sessionId = 1;
-}
-
-message BriefQueryStatus {
-  required QueryIdProto queryId = 1;
-  required QueryState state = 2;
-  required int32 executionTime = 3;
-}
-
-message GetQueryListResponse {
-  repeated BriefQueryStatus queryList = 1;
-}
-
-message GetQueryStatusRequest {
-  optional SessionIdProto sessionId = 1;
-  required QueryIdProto queryId = 2;
-}
-
-message GetQueryStatusResponse {
-  required ResultCode resultCode = 1;
-  required QueryIdProto queryId = 2;
-  optional QueryState state = 3;
-  optional float progress = 4;
-  optional int64 submitTime = 5;
-  optional int64 finishTime = 7;
-  optional bool hasResult = 8;
-  optional string errorMessage = 9;
-  optional string queryMasterHost = 10;
-  optional int32 queryMasterPort = 11;
-}
-
-message GetClusterInfoRequest {
-  optional SessionIdProto sessionId = 1;
-}
-
-message GetClusterInfoResponse {
-  repeated string serverName = 1;
-}
-
-message GetTableListRequest {
-  optional SessionIdProto sessionId = 1;
-}
-
-message GetTableListResponse {
-  repeated string tables = 1;
-}
-
-message GetTableDescRequest {
-  optional SessionIdProto sessionId = 1;
-  required string tableName = 2;
-}
-
-message CreateTableRequest {
-  required string name = 1;
-  required SchemaProto schema = 2;
-  required TableProto meta = 3;
-  required string path = 4;
-  optional PartitionDescProto partitions = 5;
-}
-
-message DropTableRequest {
-  required string name = 1;
-  optional bool purge = 2 [default = false];
-}
-
-message TableResponse {
-  required ResultCode resultCode = 1;
-  optional TableDescProto tableDesc = 2;
-  optional string errorMessage = 3;
-}

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/b6a5ff0c/tajo-core/tajo-core-backend/src/main/proto/QueryMasterClientProtocol.proto
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/proto/QueryMasterClientProtocol.proto b/tajo-core/tajo-core-backend/src/main/proto/QueryMasterClientProtocol.proto
deleted file mode 100644
index 7da83bc..0000000
--- a/tajo-core/tajo-core-backend/src/main/proto/QueryMasterClientProtocol.proto
+++ /dev/null
@@ -1,36 +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.
- */
-
-option java_package = "org.apache.tajo.ipc";
-option java_outer_classname = "QueryMasterClientProtocol";
-option java_generic_services = true;
-option java_generate_equals_and_hash = true;
-
-import "yarn_protos.proto";
-import "tajo_protos.proto";
-import "TajoIdProtos.proto";
-import "CatalogProtos.proto";
-import "PrimitiveProtos.proto";
-import "ClientProtos.proto";
-
-service QueryMasterClientProtocolService {
-  rpc updateSessionVariables(UpdateSessionVariableRequest) returns (BoolProto);
-  rpc getQueryResult(GetQueryResultRequest) returns (GetQueryResultResponse);
-  rpc getQueryStatus(GetQueryStatusRequest) returns (GetQueryStatusResponse);
-  rpc killQuery(QueryIdProto) returns (BoolProto);
-}
\ 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/proto/TajoMasterClientProtocol.proto
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/proto/TajoMasterClientProtocol.proto b/tajo-core/tajo-core-backend/src/main/proto/TajoMasterClientProtocol.proto
deleted file mode 100644
index 94ea7bf..0000000
--- a/tajo-core/tajo-core-backend/src/main/proto/TajoMasterClientProtocol.proto
+++ /dev/null
@@ -1,63 +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.
- */
-
-//TajoClient -> TajoMaster Protocol
-option java_package = "org.apache.tajo.ipc";
-option java_outer_classname = "TajoMasterClientProtocol";
-option java_generic_services = true;
-option java_generate_equals_and_hash = true;
-
-import "yarn_protos.proto";
-import "tajo_protos.proto";
-import "TajoIdProtos.proto";
-import "CatalogProtos.proto";
-import "PrimitiveProtos.proto";
-import "ClientProtos.proto";
-
-service TajoMasterClientProtocolService {
-  rpc updateSessionVariables(UpdateSessionVariableRequest) returns (BoolProto);
-  rpc submitQuery(QueryRequest) returns (GetQueryStatusResponse);
-  rpc updateQuery(QueryRequest) returns (UpdateQueryResponse);
-  rpc getQueryResult(GetQueryResultRequest) returns (GetQueryResultResponse);
-  rpc getQueryList(GetQueryListRequest) returns (GetQueryListResponse);
-  rpc getQueryStatus(GetQueryStatusRequest) returns (GetQueryStatusResponse);
-  rpc killQuery(QueryIdProto) returns (BoolProto);
-  rpc getClusterInfo(GetClusterInfoRequest) returns (GetClusterInfoResponse);
-  rpc existTable(StringProto) returns (BoolProto);
-  rpc getTableList(GetTableListRequest) returns (GetTableListResponse);
-  rpc getTableDesc(GetTableDescRequest) returns (TableResponse);
-  rpc createExternalTable(CreateTableRequest) returns (TableResponse);
-  rpc dropTable(DropTableRequest) returns (BoolProto);
-
-
-  // TODO - to be implemented
-  //
-  // authenticate
-  //
-  // getSessionVariableList
-  // dropTable
-  // detachTable
-  // createIndex
-  // dropIndex
-  // registerUDF
-  // dropUDF
-  // listUdfs
-  // getUDFDesc
-  // registerJars
-  // getListRegisteredJars
-}
\ 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/proto/tajo_protos.proto
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/proto/tajo_protos.proto b/tajo-core/tajo-core-backend/src/main/proto/tajo_protos.proto
deleted file mode 100644
index d337315..0000000
--- a/tajo-core/tajo-core-backend/src/main/proto/tajo_protos.proto
+++ /dev/null
@@ -1,46 +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.
- */
-
-option java_package = "org.apache.tajo";
-option java_outer_classname = "TajoProtos";
-option java_generic_services = false;
-option java_generate_equals_and_hash = true;
-
-enum QueryState {
-  QUERY_MASTER_INIT = 0;
-  QUERY_MASTER_LAUNCHED = 1;
-  QUERY_NEW = 2;
-  QUERY_INIT = 3;
-  QUERY_RUNNING = 4;
-  QUERY_SUCCEEDED = 5;
-  QUERY_FAILED = 6;
-  QUERY_KILLED = 7;
-  QUERY_ERROR = 8;
-  QUERY_NOT_ASSIGNED = 9;
-}
-
-enum TaskAttemptState {
-  TA_NEW = 0;
-  TA_UNASSIGNED = 1;
-  TA_ASSIGNED = 2;
-  TA_PENDING = 3;
-  TA_RUNNING = 4;
-  TA_SUCCEEDED = 5;
-  TA_FAILED = 6;
-  TA_KILLED = 7;
-}
\ No newline at end of file