tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [31/52] [abbrv] tajo git commit: Merging master
Date Wed, 22 Jul 2015 13:01:04 GMT
Merging master


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

Branch: refs/heads/index_support
Commit: 6c01a2c33ca885e489cc08a9125c6aad40dd0a54
Parents: 9838cae
Author: Jihoon Son <jihoonson@apache.org>
Authored: Tue Jul 21 23:40:50 2015 +0900
Committer: Jihoon Son <jihoonson@apache.org>
Committed: Tue Jul 21 23:40:50 2015 +0900

----------------------------------------------------------------------
 .../tajo/catalog/AbstractCatalogClient.java     |  18 +-
 .../src/main/proto/CatalogProtocol.proto        |  23 +-
 .../org/apache/tajo/catalog/CatalogUtil.java    |   5 +-
 .../src/main/proto/CatalogProtos.proto          |  10 +
 .../org/apache/tajo/catalog/CatalogServer.java  |  51 +-
 .../tajo/client/CatalogAdminClientImpl.java     | 114 ++--
 .../org/apache/tajo/client/QueryClientImpl.java | 246 +-------
 .../apache/tajo/client/SessionConnection.java   | 110 ----
 tajo-client/src/main/proto/ClientProtos.proto   |  25 +-
 .../main/proto/TajoMasterClientProtocol.proto   |  14 +-
 .../apache/tajo/exception/ReturnStateUtil.java  |  11 +-
 .../apache/tajo/engine/parser/SQLAnalyzer.java  |   4 -
 .../org/apache/tajo/master/GlobalEngine.java    |  28 +-
 .../tajo/master/TajoMasterClientService.java    | 137 ----
 .../apache/tajo/master/exec/QueryExecutor.java  |  50 --
 .../tajo/querymaster/QueryMasterTask.java       |   3 -
 .../tajo/webapp/QueryExecutorServlet.java       |  11 -
 .../tajo/worker/TajoWorkerClientService.java    |  36 --
 .../main/java/org/apache/tajo/worker/Task.java  | 632 -------------------
 .../tajo/ws/rs/resources/QueryResource.java     |  14 -
 .../tajo/engine/query/TestTablePartitions.java  |  18 +-
 .../org/apache/tajo/jdbc/TajoStatement.java     |  14 +-
 .../org/apache/tajo/plan/LogicalOptimizer.java  |   9 +-
 23 files changed, 152 insertions(+), 1431 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java b/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
index df07f4c..e935312 100644
--- a/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
+++ b/tajo-catalog/tajo-catalog-client/src/main/java/org/apache/tajo/catalog/AbstractCatalogClient.java
@@ -319,8 +319,8 @@ public abstract class AbstractCatalogClient implements CatalogService, Closeable
   public List<IndexDescProto> getAllIndexes() {
     try {
       CatalogProtocolService.BlockingInterface stub = getStub();
-      GetIndexesProto response = stub.getAllIndexes(null, ProtoUtil.NULL_PROTO);
-      return response.getIndexList();
+      IndexListResponse response = stub.getAllIndexes(null, ProtoUtil.NULL_PROTO);
+      return response.getIndexDescList();
     } catch (ServiceException e) {
       LOG.error(e.getMessage(), e);
       return null;
@@ -550,7 +550,7 @@ public abstract class AbstractCatalogClient implements CatalogService, Closeable
 
       final BlockingInterface stub = getStub();
 
-      return isSuccess(stub.existIndexByColumnNames(null, builder.build()).getValue());
+      return isSuccess(stub.existIndexByColumnNames(null, builder.build()));
     } catch (ServiceException e) {
       throw new RuntimeException(e);
     }
@@ -562,7 +562,7 @@ public abstract class AbstractCatalogClient implements CatalogService, Closeable
       final BlockingInterface stub = getStub();
 
       return isSuccess(
-          stub.existIndexesByTable(null, CatalogUtil.buildTableIdentifier(databaseName, tableName)).getValue());
+          stub.existIndexesByTable(null, CatalogUtil.buildTableIdentifier(databaseName, tableName)));
     } catch (ServiceException e) {
       throw new RuntimeException(e);
     }
@@ -578,10 +578,10 @@ public abstract class AbstractCatalogClient implements CatalogService, Closeable
           .build();
 
       final BlockingInterface stub = getStub();
-      final GetIndexResponse response = stub.getIndexByName(null, request);
+      final IndexResponse response = stub.getIndexByName(null, request);
       ensureOk(response.getState());
 
-      return new IndexDesc(response.getIndex());
+      return new IndexDesc(response.getIndexDesc());
 
     } catch (ServiceException e) {
       throw new RuntimeException(e);
@@ -615,10 +615,10 @@ public abstract class AbstractCatalogClient implements CatalogService, Closeable
       }
 
       final BlockingInterface stub = getStub();
-      final GetIndexResponse response = stub.getIndexByColumnNames(null, builder.build());
+      final IndexResponse response = stub.getIndexByColumnNames(null, builder.build());
       ensureOk(response.getState());
 
-      return new IndexDesc(response.getIndex());
+      return new IndexDesc(response.getIndexDesc());
     } catch (ServiceException e) {
       throw new RuntimeException(e);
     }
@@ -631,7 +631,7 @@ public abstract class AbstractCatalogClient implements CatalogService, Closeable
       TableIdentifierProto proto = CatalogUtil.buildTableIdentifier(databaseName, tableName);
 
       final BlockingInterface stub = getStub();
-      final GetAllIndexesResponse response = stub.getAllIndexesByTable(null, proto);
+      final IndexListResponse response = stub.getAllIndexesByTable(null, proto);
       ensureOk(response.getState());
 
       List<IndexDesc> indexDescs = TUtil.newList();

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-catalog/tajo-catalog-client/src/main/proto/CatalogProtocol.proto
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-client/src/main/proto/CatalogProtocol.proto b/tajo-catalog/tajo-catalog-client/src/main/proto/CatalogProtocol.proto
index 8b4b134..ee74aa0 100644
--- a/tajo-catalog/tajo-catalog-client/src/main/proto/CatalogProtocol.proto
+++ b/tajo-catalog/tajo-catalog-client/src/main/proto/CatalogProtocol.proto
@@ -79,21 +79,6 @@ message GetIndexByColumnNamesRequest {
   repeated string columnNames = 2;
 }
 
-message GetIndexesResponse {
-  required ReturnState state = 1;
-  repeated IndexDescProto indexDesc = 2;
-}
-
-//message GetIndexResponse {
-//  required ReturnState state = 1;
-//  optional IndexDescProto index = 2;
-//}
-//
-//message GetIndexesResponse {
-//  required ReturnState state = 1;
-//  repeated IndexProto index = 2;
-//}
-
 message GetPartitionsResponse {
   required ReturnState state = 1;
   repeated PartitionDescProto partition = 2;
@@ -145,10 +130,10 @@ service CatalogProtocolService {
   rpc existIndexByName(IndexNameProto) returns (ReturnState);
   rpc existIndexByColumnNames(GetIndexByColumnNamesRequest) returns (ReturnState);
   rpc existIndexesByTable(TableIdentifierProto) returns (ReturnState);
-  rpc getIndexByName(IndexNameProto) returns (IndexDescProto);
-  rpc getIndexByColumnNames(GetIndexByColumnNamesRequest) returns (IndexDescProto);
-  rpc getAllIndexesByTable(TableIdentifierProto) returns (GetAllIndexesResponse);
-  rpc getAllIndexes(NullProto) returns (GetIndexesProto);
+  rpc getIndexByName(IndexNameProto) returns (IndexResponse);
+  rpc getIndexByColumnNames(GetIndexByColumnNamesRequest) returns (IndexResponse);
+  rpc getAllIndexesByTable(TableIdentifierProto) returns (IndexListResponse);
+  rpc getAllIndexes(NullProto) returns (IndexListResponse);
 
   rpc createFunction(FunctionDescProto) returns (ReturnState);
   rpc dropFunction(UnregisterFunctionRequest) returns (ReturnState);

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
index 0e5776e..f2e7c59 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
@@ -44,10 +44,7 @@ import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 import static org.apache.tajo.common.TajoDataTypes.Type;
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto b/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
index 90888d7..95479ac 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
+++ b/tajo-catalog/tajo-catalog-common/src/main/proto/CatalogProtos.proto
@@ -387,3 +387,13 @@ message FunctionListResponse {
   required ReturnState state = 1;
   repeated FunctionDescProto function = 2;
 }
+
+message IndexListResponse {
+  required ReturnState state = 1;
+  repeated IndexDescProto indexDesc = 2;
+}
+
+message IndexResponse {
+  required ReturnState state = 1;
+  optional IndexDescProto indexDesc = 2;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
index 68f9576..2494012 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
@@ -1143,7 +1143,7 @@ public class CatalogServer extends AbstractService {
     }
 
     @Override
-    public GetIndexResponse getIndexByName(RpcController controller, IndexNameProto request)
+    public IndexResponse getIndexByName(RpcController controller, IndexNameProto request)
         throws ServiceException {
 
       String databaseName = request.getDatabaseName();
@@ -1153,20 +1153,20 @@ public class CatalogServer extends AbstractService {
       try {
 
         if (!store.existIndexByName(databaseName, indexName)) {
-          return GetIndexResponse.newBuilder()
+          return IndexResponse.newBuilder()
               .setState(errUndefinedIndexName(indexName))
               .build();
         }
 
-        return GetIndexResponse.newBuilder()
+        return IndexResponse.newBuilder()
             .setState(OK)
-            .setIndex(store.getIndexByName(databaseName, indexName))
+            .setIndexDesc(store.getIndexByName(databaseName, indexName))
             .build();
 
       } catch (Throwable t) {
         printStackTraceIfError(LOG, t);
 
-        return GetIndexResponse.newBuilder()
+        return IndexResponse.newBuilder()
             .setState(returnError(t))
             .build();
 
@@ -1176,7 +1176,7 @@ public class CatalogServer extends AbstractService {
     }
 
     @Override
-    public GetIndexResponse getIndexByColumnNames(RpcController controller, GetIndexByColumnNamesRequest request)
+    public IndexResponse getIndexByColumnNames(RpcController controller, GetIndexByColumnNamesRequest request)
         throws ServiceException {
 
       TableIdentifierProto identifier = request.getTableIdentifier();
@@ -1189,18 +1189,18 @@ public class CatalogServer extends AbstractService {
       rlock.lock();
       try {
         if (!store.existIndexByColumns(databaseName, tableName, columnNames)) {
-          return GetIndexResponse.newBuilder()
-              .setState(errUndefinedIndex(tableName, columnName))
+          return IndexResponse.newBuilder()
+              .setState(errUndefinedIndex(tableName, columnNamesList))
               .build();
         }
-        return GetIndexResponse.newBuilder()
+        return IndexResponse.newBuilder()
             .setState(OK)
-            .setIndex(store.getIndexByColumn(databaseName, tableName, columnName))
+            .setIndexDesc(store.getIndexByColumns(databaseName, tableName, columnNames))
             .build();
-      }  catch (Throwable t) {
+      } catch (Throwable t) {
         printStackTraceIfError(LOG, t);
 
-        return GetIndexResponse.newBuilder()
+        return IndexResponse.newBuilder()
             .setState(returnError(t))
             .build();
       } finally {
@@ -1209,35 +1209,44 @@ public class CatalogServer extends AbstractService {
     }
 
     @Override
-    public GetAllIndexesResponse getAllIndexesByTable(RpcController controller, TableIdentifierProto request)
+    public IndexListResponse getAllIndexesByTable(RpcController controller, TableIdentifierProto request)
         throws ServiceException {
-      rlock.lock();
       String databaseName = request.getDatabaseName();
       String tableName = request.getTableName();
+
+      rlock.lock();
       try {
-        GetAllIndexesResponse.Builder builder = GetAllIndexesResponse.newBuilder();
+        if (!store.existIndexesByTable(databaseName, tableName)) {
+          return IndexListResponse.newBuilder()
+              .setState(errUndefinedIndex(tableName))
+              .build();
+        }
+        IndexListResponse.Builder builder = IndexListResponse.newBuilder().setState(OK);
         for (String eachIndexName : store.getAllIndexNamesByTable(databaseName, tableName)) {
           builder.addIndexDesc(store.getIndexByName(databaseName, eachIndexName));
         }
         return builder.build();
-      } catch (Exception e) {
-        LOG.error("ERROR: cannot get all indexes for " + databaseName + "." + tableName, e);
-        return null;
+      } catch (Throwable t) {
+        printStackTraceIfError(LOG, t);
+
+        return IndexListResponse.newBuilder()
+            .setState(returnError(t))
+            .build();
       } finally {
         rlock.unlock();
       }
     }
 
     @Override
-    public GetIndexesResponse getAllIndexes(RpcController controller, NullProto request) throws ServiceException {
+    public IndexListResponse getAllIndexes(RpcController controller, NullProto request) throws ServiceException {
       rlock.lock();
       try {
-        return GetIndexesResponse.newBuilder().addAllIndex(store.getAllIndexes()).build();
+        return IndexListResponse.newBuilder().addAllIndexDesc(store.getAllIndexes()).build();
 
       } catch (Throwable t) {
         printStackTraceIfError(LOG, t);
 
-        return GetIndexesResponse.newBuilder()
+        return IndexListResponse.newBuilder()
             .setState(returnError(t))
             .build();
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClientImpl.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClientImpl.java b/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClientImpl.java
index 9ef325b..8745d19 100644
--- a/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClientImpl.java
+++ b/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClientImpl.java
@@ -26,11 +26,10 @@ import org.apache.tajo.catalog.TableDesc;
 import org.apache.tajo.catalog.TableMeta;
 import org.apache.tajo.catalog.partition.PartitionMethodDesc;
 import org.apache.tajo.catalog.proto.CatalogProtos;
-import org.apache.tajo.catalog.proto.CatalogProtos.IndexDescProto;
+import org.apache.tajo.catalog.proto.CatalogProtos.*;
+import org.apache.tajo.error.Errors.ResultCode;
 import org.apache.tajo.ipc.ClientProtos;
 import org.apache.tajo.ipc.ClientProtos.*;
-import org.apache.tajo.catalog.proto.CatalogProtos.FunctionDescProto;
-import org.apache.tajo.catalog.proto.CatalogProtos.TableResponse;
 import org.apache.tajo.exception.SQLExceptionUtil;
 import org.apache.tajo.ipc.ClientProtos;
 import org.apache.tajo.ipc.ClientProtos.DropTableRequest;
@@ -224,86 +223,107 @@ public class CatalogAdminClientImpl implements CatalogAdminClient {
 
   @Override
   public IndexDescProto getIndex(final String indexName) throws SQLException {
-    NettyClientBase client = connection.getTajoMasterConnection();
-    connection.checkSessionAndGet(client);
-    BlockingInterface tajoMasterService = client.getStub();
-    return tajoMasterService.getIndexWithName(null,
-        connection.convertSessionedString(indexName));
+    final BlockingInterface stub = conn.getTMStub();
+
+    IndexResponse res;
+    try {
+      res = stub.getIndexWithName(null, conn.getSessionedString(indexName));
+    } catch (ServiceException e) {
+      throw new RuntimeException(e);
+    }
+
+    throwIfError(res.getState());
+    return res.getIndexDesc();
   }
 
   @Override
   public boolean existIndex(final String indexName) throws SQLException {
-    NettyClientBase client = connection.getTajoMasterConnection();
-    connection.checkSessionAndGet(client);
-    BlockingInterface tajoMasterService = client.getStub();
-    return tajoMasterService.existIndexWithName(null,
-        connection.convertSessionedString(indexName)).getValue();
+    final BlockingInterface stub = conn.getTMStub();
+
+    try {
+      return isSuccess(stub.existIndexWithName(null, conn.getSessionedString(indexName)));
+    } catch (ServiceException e) {
+      throw new RuntimeException(e);
+    }
   }
 
   @Override
   public List<IndexDescProto> getIndexes(final String tableName) throws SQLException {
-    NettyClientBase client = connection.getTajoMasterConnection();
-    connection.checkSessionAndGet(client);
-    BlockingInterface tajoMasterService = client.getStub();
-    GetIndexesResponse response = tajoMasterService.getIndexesForTable(null,
-        connection.convertSessionedString(tableName));
-    if (response.getResult().getResultCode() == ResultCode.OK) {
-      return response.getIndexesList();
-    } else {
-      throw new ServiceException(response.getResult().getErrorMessage());
+    final BlockingInterface stub = conn.getTMStub();
+
+    IndexListResponse response;
+    try {
+      response = stub.getIndexesForTable(null,
+          conn.getSessionedString(tableName));
+    } catch (ServiceException e) {
+      throw new RuntimeException(e);
     }
+
+    throwIfError(response.getState());
+    return response.getIndexDescList();
   }
 
   @Override
   public boolean hasIndexes(final String tableName) throws SQLException {
-    NettyClientBase client = connection.getTajoMasterConnection();
-    connection.checkSessionAndGet(client);
-    BlockingInterface tajoMasterService = client.getStub();
-    return tajoMasterService.existIndexesForTable(null,
-        connection.convertSessionedString(tableName)).getValue();
+    final BlockingInterface stub = conn.getTMStub();
+
+    try {
+      return isSuccess(stub.existIndexesForTable(null, conn.getSessionedString(tableName)));
+    } catch (ServiceException e) {
+      throw new RuntimeException(e);
+    }
   }
 
   @Override
   public IndexDescProto getIndex(final String tableName, final String[] columnNames) throws SQLException {
-    NettyClientBase client = connection.getTajoMasterConnection();
-    connection.checkSessionAndGet(client);
-    BlockingInterface tajoMasterService = client.getStub();
+    final BlockingInterface stub = conn.getTMStub();
+
     GetIndexWithColumnsRequest.Builder builder = GetIndexWithColumnsRequest.newBuilder();
-    builder.setSessionId(connection.sessionId);
+    builder.setSessionId(conn.sessionId);
     builder.setTableName(tableName);
     for (String eachColumnName : columnNames) {
       builder.addColumnNames(eachColumnName);
     }
-    GetIndexWithColumnsResponse response = tajoMasterService.getIndexWithColumns(null, builder.build());
-    if (response.getResult().getResultCode() == ResultCode.OK) {
-      return response.getIndexDesc();
-    } else {
-      throw new ServiceException(response.getResult().getErrorMessage());
+
+    IndexResponse response;
+    try {
+      response = stub.getIndexWithColumns(null, builder.build());
+    } catch (ServiceException e) {
+      throw new RuntimeException(e);
     }
+
+    throwIfError(response.getState());
+    return response.getIndexDesc();
   }
 
   @Override
   public boolean existIndex(final String tableName, final String[] columnName) throws SQLException {
-    NettyClientBase client = connection.getTajoMasterConnection();
-    connection.checkSessionAndGet(client);
-    BlockingInterface tajoMasterService = client.getStub();
+    final BlockingInterface stub = conn.getTMStub();
+
     GetIndexWithColumnsRequest.Builder builder = GetIndexWithColumnsRequest.newBuilder();
-    builder.setSessionId(connection.sessionId);
+    builder.setSessionId(conn.sessionId);
     builder.setTableName(tableName);
     for (String eachColumnName : columnName) {
       builder.addColumnNames(eachColumnName);
     }
-    return tajoMasterService.existIndexWithColumns(null, builder.build()).getValue();
+
+    try {
+      return isSuccess(stub.existIndexWithColumns(null, builder.build()));
+    } catch (ServiceException e) {
+      throw new RuntimeException(e);
+    }
   }
 
   @Override
   public boolean dropIndex(final String indexName) throws SQLException {
-    NettyClientBase client = connection.getTajoMasterConnection();
-    connection.checkSessionAndGet(client);
-    BlockingInterface tajoMasterService = client.getStub();
-    return tajoMasterService.dropIndex(null,
-        connection.convertSessionedString(indexName)).getValue();
-=======
+    final BlockingInterface stub = conn.getTMStub();
+
+    try {
+      return isSuccess(stub.dropIndex(null, conn.getSessionedString(indexName)));
+    } catch (ServiceException e) {
+      throw new RuntimeException(e);
+    }
+  }
 
   @Override
   public void close() throws IOException {

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-client/src/main/java/org/apache/tajo/client/QueryClientImpl.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/client/QueryClientImpl.java b/tajo-client/src/main/java/org/apache/tajo/client/QueryClientImpl.java
index 04098fc..0a02fcb 100644
--- a/tajo-client/src/main/java/org/apache/tajo/client/QueryClientImpl.java
+++ b/tajo-client/src/main/java/org/apache/tajo/client/QueryClientImpl.java
@@ -146,16 +146,6 @@ public class QueryClientImpl implements QueryClient {
   @Override
   public ClientProtos.SubmitQueryResponse executeQuery(final String sql) throws SQLException {
 
-<<<<<<< HEAD
-    final QueryRequest.Builder builder = QueryRequest.newBuilder();
-    builder.setSessionId(connection.sessionId);
-    builder.setQuery(sql);
-    builder.setIsJson(false);
-    TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-    SubmitQueryResponse response = tajoMasterService.submitQuery(null, builder.build());
-    if (response.getResult().getResultCode() == ResultCode.OK) {
-      connection.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
-=======
     final BlockingInterface stub = conn.getTMStub();
     final QueryRequest request = buildQueryRequest(sql, false);
 
@@ -168,31 +158,10 @@ public class QueryClientImpl implements QueryClient {
 
     if (isSuccess(response.getState())) {
       conn.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
     }
 
     return response;
 
-//<<<<<<< HEAD
-//        connection.checkSessionAndGet(client);
-//
-//        final QueryRequest.Builder builder = QueryRequest.newBuilder();
-//        builder.setSessionId(connection.sessionId);
-//        builder.setQuery(sql);
-//        builder.setIsJson(false);
-//        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-//
-//
-//
-//      }
-//    }.withRetries();
-//=======
-//    SubmitQueryResponse response = tajoMasterService.submitQuery(null, builder.build());
-//    if (response.getResultCode() == ResultCode.OK) {
-//      connection.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
-//    }
-//    return response;
-//>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
   }
 
   @Override
@@ -211,18 +180,7 @@ public class QueryClientImpl implements QueryClient {
   public ResultSet executeQueryAndGetResult(String sql) throws SQLException {
 
     ClientProtos.SubmitQueryResponse response = executeQuery(sql);
-<<<<<<< HEAD
-
-    if (response.getResult().getResultCode() == ClientProtos.ResultCode.ERROR) {
-      if (response.getResult().hasErrorMessage()) {
-        throw new ServiceException(response.getResult().getErrorMessage());
-      } else if (response.getResult().hasErrorTrace()) {
-        throw new ServiceException(response.getResult().getErrorTrace());
-      }
-    }
-=======
     throwIfError(response.getState());
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 
     QueryId queryId = new QueryId(response.getQueryId());
 
@@ -251,14 +209,7 @@ public class QueryClientImpl implements QueryClient {
   public ResultSet executeJsonQueryAndGetResult(final String json) throws SQLException {
 
     ClientProtos.SubmitQueryResponse response = executeQueryWithJson(json);
-<<<<<<< HEAD
-
-    if (response.getResult().getResultCode() == ClientProtos.ResultCode.ERROR) {
-      throw new ServiceException(response.getResult().getErrorTrace());
-    }
-=======
     throwIfError(response.getState());
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 
     QueryId queryId = new QueryId(response.getQueryId());
     if (response.getIsForwarded()) {
@@ -367,58 +318,6 @@ public class QueryClientImpl implements QueryClient {
   @Override
   public TajoMemoryResultSet fetchNextQueryResult(final QueryId queryId, final int fetchRowNum) throws SQLException {
 
-<<<<<<< HEAD
-    try {
-//<<<<<<< HEAD
-//      final ServerCallable<ClientProtos.SerializedResultSet> callable =
-//          new ServerCallable<ClientProtos.SerializedResultSet>(connection.manager, connection.getTajoMasterAddr(),
-//              TajoMasterClientProtocol.class, false) {
-//
-//            public ClientProtos.SerializedResultSet call(NettyClientBase client) throws ServiceException {
-//
-//              connection.checkSessionAndGet(client);
-//              TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-//
-//              GetQueryResultDataRequest.Builder builder = GetQueryResultDataRequest.newBuilder();
-//              builder.setSessionId(connection.sessionId);
-//              builder.setQueryId(queryId.getProto());
-//              builder.setFetchRowNum(fetchRowNum);
-//              try {
-//                GetQueryResultDataResponse response = tajoMasterService.getQueryResultData(null, builder.build());
-//                if (response.getResult().getResultCode() == ClientProtos.ResultCode.ERROR) {
-//                  abort();
-//                  throw new ServiceException(response.getResult().getErrorMessage());
-//                }
-//
-//                return response.getResultSet();
-//              } catch (ServiceException e) {
-//                abort();
-//                throw e;
-//              } catch (Throwable t) {
-//                throw new ServiceException(t.getMessage(), t);
-//              }
-//            }
-//          };
-//
-//      ClientProtos.SerializedResultSet serializedResultSet = callable.withRetries();
-//=======
-      NettyClientBase client = connection.getTajoMasterConnection();
-      connection.checkSessionAndGet(client);
-      TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-
-      GetQueryResultDataRequest.Builder builder = GetQueryResultDataRequest.newBuilder();
-      builder.setSessionId(connection.sessionId);
-      builder.setQueryId(queryId.getProto());
-      builder.setFetchRowNum(fetchRowNum);
-
-      GetQueryResultDataResponse response = tajoMasterService.getQueryResultData(null, builder.build());
-      if (response.getResult().getResultCode() == ClientProtos.ResultCode.ERROR) {
-        throw new ServiceException(response.getResult().getErrorMessage());
-      }
-
-      ClientProtos.SerializedResultSet resultSet = response.getResultSet();
-//>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
-=======
     final BlockingInterface stub = conn.getTMStub();
     final GetQueryResultDataRequest request = GetQueryResultDataRequest.newBuilder()
         .setSessionId(conn.sessionId)
@@ -426,8 +325,6 @@ public class QueryClientImpl implements QueryClient {
         .setFetchRowNum(fetchRowNum)
         .build();
 
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
-
     GetQueryResultDataResponse response;
     try {
       response = stub.getQueryResultData(null, request);
@@ -451,43 +348,11 @@ public class QueryClientImpl implements QueryClient {
     final BlockingInterface stub = conn.getTMStub();
     final QueryRequest request = buildQueryRequest(sql, false);
 
-<<<<<<< HEAD
-//<<<<<<< HEAD
-//        connection.checkSessionAndGet(client);
-//        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-//
-//        QueryRequest.Builder builder = QueryRequest.newBuilder();
-//        builder.setSessionId(connection.sessionId);
-//        builder.setQuery(sql);
-//        builder.setIsJson(false);
-//        ClientProtos.UpdateQueryResponse response = tajoMasterService.updateQuery(null, builder.build());
-//
-//        if (response.getResult().getResultCode() == ClientProtos.ResultCode.OK) {
-//          connection.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
-//          return true;
-//        } else {
-//          if (response.getResult().hasErrorMessage()) {
-//            System.err.println("ERROR: " + response.getResult().getErrorMessage());
-//          }
-//          return false;
-//        }
-//=======
-    if (response.getResult().getResultCode() == ClientProtos.ResultCode.OK) {
-      connection.updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
-      return true;
-    } else {
-      if (response.getResult().hasErrorMessage()) {
-        LOG.error("ERROR: " + response.getResult().getErrorMessage());
-//>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
-      }
-      return false;
-=======
     UpdateQueryResponse response;
     try {
       response = stub.updateQuery(null, request);
     } catch (ServiceException e) {
       throw new RuntimeException(e);
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
     }
 
     throwIfError(response.getState());
@@ -499,48 +364,6 @@ public class QueryClientImpl implements QueryClient {
   @Override
   public boolean updateQueryWithJson(final String json) throws SQLException {
 
-<<<<<<< HEAD
-//<<<<<<< HEAD
-//    return new ServerCallable<Boolean>(connection.manager, connection.getTajoMasterAddr(),
-//        TajoMasterClientProtocol.class, false) {
-//
-//      public Boolean call(NettyClientBase client) throws ServiceException {
-//
-//        connection.checkSessionAndGet(client);
-//        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-//
-//        QueryRequest.Builder builder = QueryRequest.newBuilder();
-//        builder.setSessionId(connection.sessionId);
-//        builder.setQuery(json);
-//        builder.setIsJson(true);
-//        ClientProtos.UpdateQueryResponse response = tajoMasterService.updateQuery(null, builder.build());
-//        if (response.getResult().getResultCode() == ClientProtos.ResultCode.OK) {
-//          return true;
-//        } else {
-//          if (response.getResult().hasErrorMessage()) {
-//            System.err.println("ERROR: " + response.getResult().getErrorMessage());
-//          }
-//          return false;
-//        }
-//=======
-    NettyClientBase client = connection.getTajoMasterConnection();
-    connection.checkSessionAndGet(client);
-    TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-
-    QueryRequest.Builder builder = QueryRequest.newBuilder();
-    builder.setSessionId(connection.sessionId);
-    builder.setQuery(json);
-    builder.setIsJson(true);
-    ClientProtos.UpdateQueryResponse response = tajoMasterService.updateQuery(null, builder.build());
-    if (response.getResult().getResultCode() == ClientProtos.ResultCode.OK) {
-      return true;
-    } else {
-      if (response.getResult().hasErrorMessage()) {
-        LOG.error("ERROR: " + response.getResult().getErrorMessage());
-//>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
-      }
-      return false;
-=======
     final BlockingInterface stub = conn.getTMStub();
     final QueryRequest request = buildQueryRequest(json, true);
 
@@ -549,7 +372,6 @@ public class QueryClientImpl implements QueryClient {
       response = stub.updateQuery(null, request);
     } catch (ServiceException e) {
       throw new RuntimeException(e);
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
     }
 
     throwIfError(response.getState());
@@ -648,46 +470,7 @@ public class QueryClientImpl implements QueryClient {
   public int getMaxRows() {
   	return this.maxRows;
   }
-  
-<<<<<<< HEAD
-  public QueryInfoProto getQueryInfo(final QueryId queryId) throws ServiceException {
-//<<<<<<< HEAD
-//    return new ServerCallable<QueryInfoProto>(connection.manager, connection.getTajoMasterAddr(),
-//        TajoMasterClientProtocol.class, false) {
-//      public QueryInfoProto call(NettyClientBase client) throws ServiceException {
-//        connection.checkSessionAndGet(client);
-//
-//        QueryIdRequest.Builder builder = QueryIdRequest.newBuilder();
-//        builder.setSessionId(connection.sessionId);
-//        builder.setQueryId(queryId.getProto());
-//
-//        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-//        GetQueryInfoResponse res = tajoMasterService.getQueryInfo(null,builder.build());
-//        if (res.getResult().getResultCode() == ResultCode.OK) {
-//          return res.getQueryInfo();
-//        } else {
-//          abort();
-//          throw new ServiceException(res.getResult().getErrorMessage());
-//        }
-//      }
-//    }.withRetries();
-//=======
-    NettyClientBase client = connection.getTajoMasterConnection();
-    connection.checkSessionAndGet(client);
-
-    QueryIdRequest.Builder builder = QueryIdRequest.newBuilder();
-    builder.setSessionId(connection.sessionId);
-    builder.setQueryId(queryId.getProto());
-
-    TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-    GetQueryInfoResponse res = tajoMasterService.getQueryInfo(null,builder.build());
-    if (res.getResult().getResultCode() == ResultCode.OK) {
-      return res.getQueryInfo();
-    } else {
-      throw new ServiceException(res.getResult().getErrorMessage());
-    }
-//>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
-=======
+
   public QueryInfoProto getQueryInfo(final QueryId queryId) throws SQLException {
 
     final BlockingInterface stub = conn.getTMStub();
@@ -702,7 +485,6 @@ public class QueryClientImpl implements QueryClient {
 
     throwIfError(res.getState());
     return res.getQueryInfo();
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
   }
 
   public QueryHistoryProto getQueryHistory(final QueryId queryId) throws SQLException {
@@ -719,31 +501,6 @@ public class QueryClientImpl implements QueryClient {
     NettyClientBase qmClient = null;
 
     try {
-<<<<<<< HEAD
-      connection.checkSessionAndGet(connection.getTajoMasterConnection());
-
-//<<<<<<< HEAD
-//        QueryMasterClientProtocolService.BlockingInterface queryMasterService = client.getStub();
-//        GetQueryHistoryResponse res = queryMasterService.getQueryHistory(null,builder.build());
-//        if (res.getResult().getResultCode() == ResultCode.OK) {
-//          return res.getQueryHistory();
-//        } else {
-//          abort();
-//          throw new ServiceException(res.getResult().getErrorMessage());
-//        }
-//=======
-      QueryIdRequest.Builder builder = QueryIdRequest.newBuilder();
-      builder.setSessionId(connection.sessionId);
-      builder.setQueryId(queryId.getProto());
-
-      QueryMasterClientProtocolService.BlockingInterface queryMasterService = queryMasterClient.getStub();
-      GetQueryHistoryResponse res = queryMasterService.getQueryHistory(null, builder.build());
-      if (res.getResult().getResultCode() == ResultCode.OK) {
-        return res.getQueryHistory();
-      } else {
-        throw new ServiceException(res.getResult().getErrorMessage());
-//>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
-=======
 
       qmClient = manager.newClient(
           qmAddress,
@@ -768,7 +525,6 @@ public class QueryClientImpl implements QueryClient {
         res = stub.getQueryHistory(null, request);
       } catch (ServiceException e) {
         throw new RuntimeException(e);
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       }
 
       throwIfError(res.getState());

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java b/tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java
index ad6dbd5..3cff88a 100644
--- a/tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java
+++ b/tajo-client/src/main/java/org/apache/tajo/client/SessionConnection.java
@@ -198,40 +198,9 @@ public class SessionConnection implements Closeable {
     return response.getValue();
   }
 
-<<<<<<< HEAD
-  public Map<String, String> updateSessionVariables(final Map<String, String> variables) throws ServiceException {
-//<<<<<<< HEAD
-//    return new ServerCallable<Map<String, String>>(manager, getTajoMasterAddr(),
-//        TajoMasterClientProtocol.class, false) {
-//
-//      public Map<String, String> call(NettyClientBase client) throws ServiceException {
-//        checkSessionAndGet(client);
-//
-//        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-//        KeyValueSet keyValueSet = new KeyValueSet();
-//        keyValueSet.putAll(variables);
-//        ClientProtos.UpdateSessionVariableRequest request = ClientProtos.UpdateSessionVariableRequest.newBuilder()
-//            .setSessionId(sessionId)
-//            .setSessionVars(keyValueSet.getProto()).build();
-//
-//        SessionUpdateResponse response = tajoMasterService.updateSessionVariables(null, request);
-//
-//        if (response.getResult().getResultCode() == ResultCode.OK) {
-//          updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
-//          return Collections.unmodifiableMap(sessionVarsCache);
-//        } else {
-//          throw new ServiceException(response.getResult().getErrorMessage());
-//        }
-//      }
-//    }.withRetries();
-//  }
-//=======
-=======
   public Map<String, String> updateSessionVariables(final Map<String, String> variables) throws SQLException {
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
     NettyClientBase client = getTajoMasterConnection();
     checkSessionAndGet(client);
-//>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
 
     BlockingInterface tajoMasterService = client.getStub();
     KeyValueSet keyValueSet = new KeyValueSet();
@@ -242,13 +211,6 @@ public class SessionConnection implements Closeable {
 
     SessionUpdateResponse response;
 
-<<<<<<< HEAD
-    if (response.getResult().getResultCode() == ResultCode.OK) {
-      updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
-      return Collections.unmodifiableMap(sessionVarsCache);
-    } else {
-      throw new ServiceException(response.getResult().getErrorMessage());
-=======
     try {
       response = tajoMasterService.updateSessionVariables(null, request);
     } catch (ServiceException e) {
@@ -260,29 +222,13 @@ public class SessionConnection implements Closeable {
       return Collections.unmodifiableMap(sessionVarsCache);
     } else {
       throw toSQLException(response.getState());
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
     }
   }
 
   public Map<String, String> unsetSessionVariables(final List<String> variables) throws SQLException {
 
-<<<<<<< HEAD
-//<<<<<<< HEAD
-//        if (response.getResult().getResultCode() == ResultCode.OK) {
-//          updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
-//          return Collections.unmodifiableMap(sessionVarsCache);
-//        } else {
-//          throw new ServiceException(response.getResult().getErrorMessage());
-//        }
-//      }
-//    }.withRetries();
-//=======
-    TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-    ClientProtos.UpdateSessionVariableRequest request = ClientProtos.UpdateSessionVariableRequest.newBuilder()
-=======
     final BlockingInterface stub = getTMStub();
     final UpdateSessionVariableRequest request = UpdateSessionVariableRequest.newBuilder()
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
         .setSessionId(sessionId)
         .addAllUnsetVariables(variables)
         .build();
@@ -294,21 +240,12 @@ public class SessionConnection implements Closeable {
       throw new RuntimeException(e);
     }
 
-<<<<<<< HEAD
-    if (response.getResult().getResultCode() == ResultCode.OK) {
-      updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
-      return Collections.unmodifiableMap(sessionVarsCache);
-    } else {
-      throw new ServiceException(response.getResult().getErrorMessage());
-=======
     if (isSuccess(response.getState())) {
       updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
       return Collections.unmodifiableMap(sessionVarsCache);
     } else {
       throw toSQLException(response.getState());
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
     }
-//>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
   }
 
   void updateSessionVarsCache(Map<String, String> variables) {
@@ -424,10 +361,6 @@ public class SessionConnection implements Closeable {
         builder.setBaseDatabaseName(baseDatabase);
       }
 
-
-<<<<<<< HEAD
-      if (response.getResult().getResultCode() == ResultCode.OK) {
-=======
       CreateSessionResponse response = null;
 
       try {
@@ -437,7 +370,6 @@ public class SessionConnection implements Closeable {
       }
 
       if (isSuccess(response.getState())) {
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 
         sessionId = response.getSessionId();
         updateSessionVarsCache(ProtoUtil.convertToMap(response.getSessionVars()));
@@ -445,11 +377,7 @@ public class SessionConnection implements Closeable {
           LOG.debug(String.format("Got session %s as a user '%s'.", sessionId.getId(), userInfo.getUserName()));
         }
       } else {
-<<<<<<< HEAD
-        throw new InvalidClientSessionException(response.getResult().getErrorMessage());
-=======
         throw SQLExceptionUtil.toSQLException(response.getState());
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       }
     }
   }
@@ -463,25 +391,12 @@ public class SessionConnection implements Closeable {
 
     NettyClientBase client = getTajoMasterConnection();
 
-//<<<<<<< HEAD
-//        // create new session
-//        TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();
-//        CreateSessionResponse response = tajoMasterService.createSession(null, builder.build());
-//        if (response.getResult().getResultCode() != ResultCode.OK) {
-//          return false;
-//        }
-//=======
     // create new session
     BlockingInterface tajoMasterService = client.getStub();
     CreateSessionResponse response = tajoMasterService.createSession(null, builder.build());
-<<<<<<< HEAD
-    if (response.getResult().getResultCode() != ResultCode.OK) {
-=======
     if (isError(response.getState())) {
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       return false;
     }
-//>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
 
     // Invalidate some session variables in client cache
     sessionId = response.getSessionId();
@@ -495,26 +410,6 @@ public class SessionConnection implements Closeable {
       }
     }
 
-//<<<<<<< HEAD
-//        // Update the session variables in server side
-//        try {
-//          KeyValueSet keyValueSet = new KeyValueSet();
-//          keyValueSet.putAll(sessionVarsCache);
-//          ClientProtos.UpdateSessionVariableRequest request = ClientProtos.UpdateSessionVariableRequest.newBuilder()
-//              .setSessionId(sessionId)
-//              .setSessionVars(keyValueSet.getProto()).build();
-//
-//          if (tajoMasterService.updateSessionVariables(null, request).getResult().getResultCode() != ResultCode.OK) {
-//            tajoMasterService.removeSession(null, sessionId);
-//            return false;
-//          }
-//          LOG.info(String.format("Reconnected to session %s as a user '%s'.", sessionId.getId(), userInfo.getUserName()));
-//          return true;
-//        } catch (ServiceException e) {
-//          tajoMasterService.removeSession(null, sessionId);
-//          return false;
-//        }
-//=======
     // Update the session variables in server side
     try {
       KeyValueSet keyValueSet = new KeyValueSet();
@@ -523,14 +418,9 @@ public class SessionConnection implements Closeable {
           .setSessionId(sessionId)
           .setSessionVars(keyValueSet.getProto()).build();
 
-<<<<<<< HEAD
-      if (tajoMasterService.updateSessionVariables(null, request).getResult().getResultCode() != ResultCode.OK) {
-=======
       if (isError(tajoMasterService.updateSessionVariables(null, request).getState())) {
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
         tajoMasterService.removeSession(null, sessionId);
         return false;
-//>>>>>>> 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746
       }
       LOG.info(String.format("Reconnected to session %s as a user '%s'.", sessionId.getId(), userInfo.getUserName()));
       return true;

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-client/src/main/proto/ClientProtos.proto
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/proto/ClientProtos.proto b/tajo-client/src/main/proto/ClientProtos.proto
index ed5939c..f1aa9c9 100644
--- a/tajo-client/src/main/proto/ClientProtos.proto
+++ b/tajo-client/src/main/proto/ClientProtos.proto
@@ -192,19 +192,6 @@ message DropTableRequest {
   optional bool purge = 3 [default = false];
 }
 
-//<<<<<<< HEAD
-//message TableResponse {
-//  required RequestResult result = 1;
-//  optional TableDescProto tableDesc = 2;
-//}
-//
-//message FunctionResponse {
-//  required RequestResult result = 1;
-//  repeated FunctionDescProto functions = 2;
-//}
-//
-//=======
-//>>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 message QueryInfoProto {
   required string queryId = 1;
   optional string sql = 2;
@@ -265,22 +252,12 @@ message GetQueryInfoResponse {
 }
 
 message CreateIndexResponse {
-  required RequestResult result = 1;
+  required ReturnState result = 1;
   optional IndexDescProto indexDesc = 2;
 }
 
-message GetIndexesResponse {
-  required RequestResult result = 1;
-  repeated IndexDescProto indexes = 2;
-}
-
 message GetIndexWithColumnsRequest {
   required SessionIdProto sessionId = 1;
   required string tableName = 2;
   repeated string columnNames = 3;
 }
-
-message GetIndexWithColumnsResponse {
-  required RequestResult result = 1;
-  optional IndexDescProto indexDesc = 2;
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-client/src/main/proto/TajoMasterClientProtocol.proto
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/proto/TajoMasterClientProtocol.proto b/tajo-client/src/main/proto/TajoMasterClientProtocol.proto
index edf98cd..b772abe 100644
--- a/tajo-client/src/main/proto/TajoMasterClientProtocol.proto
+++ b/tajo-client/src/main/proto/TajoMasterClientProtocol.proto
@@ -72,11 +72,11 @@ service TajoMasterClientProtocolService {
   rpc getFunctionList(SessionedStringProto) returns (FunctionListResponse);
 
   // Index Management APIs
-  rpc getIndexWithName(SessionedStringProto) returns (IndexDescProto);
-  rpc existIndexWithName(SessionedStringProto) returns (BoolProto);
-  rpc getIndexesForTable(SessionedStringProto) returns (GetIndexesResponse);
-  rpc existIndexesForTable(SessionedStringProto) returns (BoolProto);
-  rpc getIndexWithColumns(GetIndexWithColumnsRequest) returns (GetIndexWithColumnsResponse);
-  rpc existIndexWithColumns(GetIndexWithColumnsRequest) returns (BoolProto);
-  rpc dropIndex(SessionedStringProto) returns (BoolProto);
+  rpc getIndexWithName(SessionedStringProto) returns (IndexResponse);
+  rpc existIndexWithName(SessionedStringProto) returns (ReturnState);
+  rpc getIndexesForTable(SessionedStringProto) returns (IndexListResponse);
+  rpc existIndexesForTable(SessionedStringProto) returns (ReturnState);
+  rpc getIndexWithColumns(GetIndexWithColumnsRequest) returns (IndexResponse);
+  rpc existIndexWithColumns(GetIndexWithColumnsRequest) returns (ReturnState);
+  rpc dropIndex(SessionedStringProto) returns (ReturnState);
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-common/src/main/java/org/apache/tajo/exception/ReturnStateUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/exception/ReturnStateUtil.java b/tajo-common/src/main/java/org/apache/tajo/exception/ReturnStateUtil.java
index 862889e..c62c647 100644
--- a/tajo-common/src/main/java/org/apache/tajo/exception/ReturnStateUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/exception/ReturnStateUtil.java
@@ -30,8 +30,10 @@ import org.apache.tajo.exception.TajoExceptionInterface;
 import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos;
 import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.ReturnState;
 import org.apache.tajo.rpc.protocolrecords.PrimitiveProtos.StringListResponse;
+import org.apache.tajo.util.StringUtils;
 
 import java.util.Collection;
+import java.util.List;
 
 public class ReturnStateUtil {
 
@@ -170,8 +172,13 @@ public class ReturnStateUtil {
     return returnError(ResultCode.UNDEFINED_PARTITION_METHOD, tbName);
   }
 
-  public static ReturnState errUndefinedIndex(String tbName, String columnName) {
-    return returnError(ResultCode.UNDEFINED_INDEX, tbName, columnName);
+  public static ReturnState errUndefinedIndex(String tbName) {
+    return returnError(ResultCode.UNDEFINED_INDEX, tbName);
+  }
+
+  public static ReturnState errUndefinedIndex(String tbName, List<String> columnNameList) {
+    String columnNames = StringUtils.join(columnNameList, ",");
+    return returnError(ResultCode.UNDEFINED_INDEX, tbName, columnNames);
   }
 
   public static ReturnState errUndefinedIndexName(String indexName) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-core/src/main/java/org/apache/tajo/engine/parser/SQLAnalyzer.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/parser/SQLAnalyzer.java b/tajo-core/src/main/java/org/apache/tajo/engine/parser/SQLAnalyzer.java
index 0b1e585..1c53893 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/parser/SQLAnalyzer.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/parser/SQLAnalyzer.java
@@ -29,11 +29,7 @@ import org.apache.tajo.algebra.*;
 import org.apache.tajo.algebra.Aggregation.GroupType;
 import org.apache.tajo.algebra.CreateIndex.IndexMethodSpec;
 import org.apache.tajo.algebra.LiteralValue.LiteralType;
-<<<<<<< HEAD
 import org.apache.tajo.algebra.Sort.SortSpec;
-import org.apache.tajo.catalog.CatalogUtil;
-=======
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 import org.apache.tajo.engine.parser.SQLParser.*;
 import org.apache.tajo.storage.StorageConstants;
 import org.apache.tajo.util.StringUtils;

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java b/tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java
index 6bec409..71dcbd6 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java
@@ -34,42 +34,35 @@ import org.apache.tajo.algebra.JsonHelper;
 import org.apache.tajo.catalog.CatalogService;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.exception.ReturnStateUtil;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.engine.parser.SQLAnalyzer;
 import org.apache.tajo.engine.parser.SQLSyntaxError;
 import org.apache.tajo.engine.query.QueryContext;
-<<<<<<< HEAD
-import org.apache.tajo.ipc.ClientProtos.ResultCode;
-=======
 import org.apache.tajo.exception.ExceptionUtil;
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
+import org.apache.tajo.exception.ReturnStateUtil;
 import org.apache.tajo.master.TajoMaster.MasterContext;
 import org.apache.tajo.master.exec.DDLExecutor;
 import org.apache.tajo.master.exec.QueryExecutor;
-import org.apache.tajo.plan.*;
+import org.apache.tajo.plan.IllegalQueryStatusException;
+import org.apache.tajo.plan.LogicalOptimizer;
+import org.apache.tajo.plan.LogicalPlan;
+import org.apache.tajo.plan.LogicalPlanner;
 import org.apache.tajo.plan.logical.InsertNode;
 import org.apache.tajo.plan.logical.LogicalRootNode;
 import org.apache.tajo.plan.logical.NodeType;
 import org.apache.tajo.plan.util.PlannerUtil;
-<<<<<<< HEAD
 import org.apache.tajo.plan.verifier.LogicalPlanVerifier;
 import org.apache.tajo.plan.verifier.PreLogicalPlanVerifier;
+import org.apache.tajo.plan.verifier.SyntaxErrorUtil;
 import org.apache.tajo.plan.verifier.VerificationState;
-import org.apache.tajo.plan.verifier.VerifyException;
-=======
-import org.apache.tajo.plan.verifier.*;
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 import org.apache.tajo.session.Session;
 import org.apache.tajo.storage.TablespaceManager;
 import org.apache.tajo.util.CommonTestingUtil;
-import org.apache.tajo.util.IPCUtil;
 
 import java.io.IOException;
 import java.sql.SQLException;
 import java.util.concurrent.TimeUnit;
 
-import static org.apache.tajo.exception.ReturnStateUtil.returnError;
 import static org.apache.tajo.ipc.ClientProtos.SubmitQueryResponse;
 
 public class GlobalEngine extends AbstractService {
@@ -208,16 +201,7 @@ public class GlobalEngine extends AbstractService {
       responseBuilder.setUserName(queryContext.get(SessionVars.USERNAME));
       responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
       responseBuilder.setIsForwarded(true);
-<<<<<<< HEAD
-      String errorMessage = t.getMessage();
-      if (t.getMessage() == null) {
-        errorMessage = t.getClass().getName();
-      }
-      responseBuilder.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR,
-          errorMessage, StringUtils.stringifyException(t)));
-=======
       responseBuilder.setState(ReturnStateUtil.returnError(t));
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       return responseBuilder.build();
     }
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-core/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/TajoMasterClientService.java b/tajo-core/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
index 7d88b34..5f44839 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/TajoMasterClientService.java
@@ -36,12 +36,9 @@ import org.apache.tajo.catalog.*;
 import org.apache.tajo.catalog.exception.UndefinedDatabaseException;
 import org.apache.tajo.catalog.partition.PartitionMethodDesc;
 import org.apache.tajo.catalog.proto.CatalogProtos;
-<<<<<<< HEAD
 import org.apache.tajo.catalog.proto.CatalogProtos.IndexDescProto;
-=======
 import org.apache.tajo.catalog.proto.CatalogProtos.FunctionListResponse;
 import org.apache.tajo.catalog.proto.CatalogProtos.TableResponse;
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.conf.TajoConf.ConfVars;
 import org.apache.tajo.engine.query.QueryContext;
@@ -139,19 +136,6 @@ public class TajoMasterClientService extends AbstractService {
         String sessionId =
             context.getSessionManager().createSession(request.getUsername(), databaseName);
         CreateSessionResponse.Builder builder = CreateSessionResponse.newBuilder();
-<<<<<<< HEAD
-        builder.setResult(IPCUtil.buildOkRequestResult());
-        builder.setSessionId(TajoIdProtos.SessionIdProto.newBuilder().setId(sessionId).build());
-        builder.setSessionVars(ProtoUtil.convertFromMap(context.getSessionManager().getAllVariables(sessionId)));
-        return builder.build();
-      } catch (NoSuchDatabaseException nsde) {
-        CreateSessionResponse.Builder builder = CreateSessionResponse.newBuilder();
-        builder.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR, nsde.getMessage(), null));
-        return builder.build();
-      } catch (InvalidSessionException e) {
-        CreateSessionResponse.Builder builder = CreateSessionResponse.newBuilder();
-        builder.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR, e.getMessage(), null));
-=======
         builder.setState(OK);
         builder.setSessionId(TajoIdProtos.SessionIdProto.newBuilder().setId(sessionId).build());
         builder.setSessionVars(ProtoUtil.convertFromMap(context.getSessionManager().getAllVariables(sessionId)));
@@ -160,7 +144,6 @@ public class TajoMasterClientService extends AbstractService {
       } catch (Throwable t) {
         CreateSessionResponse.Builder builder = CreateSessionResponse.newBuilder();
         builder.setState(returnError(t));
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
         return builder.build();
       }
     }
@@ -176,27 +159,12 @@ public class TajoMasterClientService extends AbstractService {
       return OK;
     }
 
-<<<<<<< HEAD
-    public SessionUpdateResponse buildSessionUpdateOnSuccess(Map<String, String> variables) {
-      SessionUpdateResponse.Builder builder = SessionUpdateResponse.newBuilder();
-      builder.setResult(IPCUtil.buildOkRequestResult());
-      builder.setSessionVars(new KeyValueSet(variables).getProto());
-      return builder.build();
-    }
-=======
     @Override
     public SessionUpdateResponse updateSessionVariables(RpcController controller,
                                                         UpdateSessionVariableRequest request)
         throws ServiceException {
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 
       SessionUpdateResponse.Builder builder = SessionUpdateResponse.newBuilder();
-<<<<<<< HEAD
-      builder.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR, message, null));
-      return builder.build();
-    }
-=======
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 
       try {
         String sessionId = request.getSessionId().getId();
@@ -312,16 +280,6 @@ public class TajoMasterClientService extends AbstractService {
         return context.getGlobalEngine().executeQuery(session, request.getQuery(), request.getIsJson());
 
       } catch (Exception e) {
-<<<<<<< HEAD
-        LOG.error(e.getMessage(), e);
-        SubmitQueryResponse.Builder responseBuilder = ClientProtos.SubmitQueryResponse.newBuilder();
-        responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
-        responseBuilder.setIsForwarded(true);
-        responseBuilder.setUserName(context.getConf().getVar(ConfVars.USERNAME));
-        responseBuilder.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR,
-            e.getMessage() == null ? "Internal Error" : ExceptionUtils.getStackTrace(e), null));
-        return responseBuilder.build();
-=======
 
         return ClientProtos.SubmitQueryResponse.newBuilder()
             .setState(returnError(e))
@@ -329,8 +287,6 @@ public class TajoMasterClientService extends AbstractService {
             .setIsForwarded(true)
             .setUserName(context.getConf().getVar(ConfVars.USERNAME))
             .build();
-
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       }
     }
 
@@ -344,18 +300,6 @@ public class TajoMasterClientService extends AbstractService {
         context.getGlobalEngine().updateQuery(queryContext, request.getQuery(), request.getIsJson());
         builder.setState(OK);
 
-<<<<<<< HEAD
-        UpdateQueryResponse.Builder responseBuilder = UpdateQueryResponse.newBuilder();
-        try {
-          context.getGlobalEngine().updateQuery(queryContext, request.getQuery(), request.getIsJson());
-          return responseBuilder.setResult(IPCUtil.buildOkRequestResult()).build();
-        } catch (Exception e) {
-          responseBuilder.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR,
-              e.getMessage() == null ? ExceptionUtils.getStackTrace(e) : null, null));
-          return responseBuilder.build();
-        }
-=======
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       } catch (Throwable t) {
         builder.setState(returnError(t));
       }
@@ -500,13 +444,8 @@ public class TajoMasterClientService extends AbstractService {
         builder.setQueryId(request.getQueryId());
 
         if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
-<<<<<<< HEAD
-          builder.setResult(IPCUtil.buildOkRequestResult());
-          builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
-=======
           builder.setState(OK);
           builder.setQueryState(QueryState.QUERY_SUCCEEDED);
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
         } else {
           QueryInProgress queryInProgress = context.getQueryJobManager().getQueryInProgress(queryId);
 
@@ -519,13 +458,8 @@ public class TajoMasterClientService extends AbstractService {
           }
 
           if (queryInfo != null) {
-<<<<<<< HEAD
-            builder.setResult(IPCUtil.buildOkRequestResult());
-            builder.setState(queryInfo.getQueryState());
-=======
             builder.setState(OK);
             builder.setQueryState(queryInfo.getQueryState());
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 
             boolean isCreateTable = queryInfo.getQueryContext().isCreateTable();
             boolean isInsert = queryInfo.getQueryContext().isInsert();
@@ -545,18 +479,10 @@ public class TajoMasterClientService extends AbstractService {
           } else {
             Session session = context.getSessionManager().getSession(request.getSessionId().getId());
             if (session.getNonForwardQueryResultScanner(queryId) != null) {
-<<<<<<< HEAD
-              builder.setResult(IPCUtil.buildOkRequestResult());
-              builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
-            } else {
-              builder.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR,
-                  "No such query: " + queryId.toString(), null));
-=======
               builder.setState(OK);
               builder.setQueryState(QueryState.QUERY_SUCCEEDED);
             } else {
               builder.setState(errNoSuchQueryId(queryId));
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
             }
           }
         }
@@ -608,24 +534,14 @@ public class TajoMasterClientService extends AbstractService {
         resultSetBuilder.addAllSerializedTuples(rows);
 
         builder.setResultSet(resultSetBuilder.build());
-<<<<<<< HEAD
-        builder.setResult(IPCUtil.buildOkRequestResult());
-=======
         builder.setState(OK);
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 
         LOG.info("Send result to client for " +
             request.getSessionId().getId() + "," + queryId + ", " + rows.size() + " rows");
 
       } catch (Throwable t) {
         builder.setResultSet(resultSetBuilder.build()); // required field
-<<<<<<< HEAD
-        String errorMessage = t.getMessage() == null ? t.getClass().getName() : t.getMessage();
-        builder.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR,
-            errorMessage, org.apache.hadoop.util.StringUtils.stringifyException(t)));
-=======
         builder.setState(returnError(t));
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       }
 
       return builder.build();
@@ -669,18 +585,10 @@ public class TajoMasterClientService extends AbstractService {
         if (queryInfo != null) {
           builder.setQueryInfo(queryInfo.getProto());
         }
-<<<<<<< HEAD
-        builder.setResult(IPCUtil.buildOkRequestResult());
-      } catch (Throwable t) {
-        LOG.warn(t.getMessage(), t);
-        builder.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR,
-            org.apache.hadoop.util.StringUtils.stringifyException(t), null));
-=======
         builder.setState(OK);
 
       } catch (Throwable t) {
         builder.setState(returnError(t));
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       }
 
       return builder.build();
@@ -872,14 +780,8 @@ public class TajoMasterClientService extends AbstractService {
 
         if (!request.hasValue()) {
           return TableResponse.newBuilder()
-<<<<<<< HEAD
-              .setResult(
-                  IPCUtil.buildRequestResult(ResultCode.ERROR, "table name is required.", null)
-              ).build();
-=======
               .setState(errInvalidRpcCall("Table name is required"))
               .build();
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
         }
 
         Session session = context.getSessionManager().getSession(request.getSessionId().getId());
@@ -897,22 +799,12 @@ public class TajoMasterClientService extends AbstractService {
 
         if (catalog.existsTable(databaseName, tableName)) {
           return TableResponse.newBuilder()
-<<<<<<< HEAD
-              .setResult(IPCUtil.buildOkRequestResult())
-              .setTableDesc(catalog.getTableDesc(databaseName, tableName).getProto())
-              .build();
-        } else {
-          return TableResponse.newBuilder()
-              .setResult(IPCUtil.buildRequestResult(ResultCode.ERROR,
-                  "ERROR: no such a table: " + request.getValue(), null))
-=======
               .setState(OK)
               .setTable(catalog.getTableDesc(databaseName, tableName).getProto())
               .build();
         } else {
           return TableResponse.newBuilder()
               .setState(errUndefinedTable(request.getValue()))
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
               .build();
         }
       } catch (Throwable t) {
@@ -941,28 +833,6 @@ public class TajoMasterClientService extends AbstractService {
           partitionDesc = new PartitionMethodDesc(request.getPartition());
         }
 
-<<<<<<< HEAD
-        TableDesc desc;
-        try {
-          desc = context.getGlobalEngine().getDDLExecutor().createTable(queryContext, request.getName(),
-              null, meta.getStoreType(), schema, meta, path.toUri(), true, partitionDesc, false);
-        } catch (Exception e) {
-          return TableResponse.newBuilder()
-              .setResult(IPCUtil.buildRequestResult(ResultCode.ERROR, e.getMessage(), null))
-              .build();
-        }
-
-        return TableResponse.newBuilder()
-            .setResult(IPCUtil.buildOkRequestResult())
-            .setTableDesc(desc.getProto()).build();
-      } catch (InvalidSessionException ise) {
-        return TableResponse.newBuilder()
-            .setResult(IPCUtil.buildRequestResult(ResultCode.ERROR, ise.getMessage(), null))
-            .build();
-      } catch (IOException ioe) {
-        return TableResponse.newBuilder()
-            .setResult(IPCUtil.buildRequestResult(ResultCode.ERROR, ioe.getMessage(), null))
-=======
         TableDesc desc = context.getGlobalEngine().getDDLExecutor().createTable(
             queryContext,
             request.getName(),
@@ -983,7 +853,6 @@ public class TajoMasterClientService extends AbstractService {
       } catch (Throwable t) {
         return TableResponse.newBuilder()
             .setState(returnError(t))
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
             .build();
       }
     }
@@ -1024,15 +893,9 @@ public class TajoMasterClientService extends AbstractService {
             }
           }
         }
-<<<<<<< HEAD
-        return FunctionResponse.newBuilder()
-            .setResult(IPCUtil.buildOkRequestResult())
-            .addAllFunctions(functionProtos)
-=======
         return FunctionListResponse.newBuilder()
             .setState(OK)
             .addAllFunction(functionProtos)
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
             .build();
 
       } catch (Throwable t) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java b/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
index 1e35d6e..2487708 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
@@ -107,12 +107,9 @@ public class QueryExecutor {
 
     } else if (PlannerUtil.checkIfDDLPlan(rootNode)) {
       context.getSystemMetrics().counter("Query", "numDDLQuery").inc();
-<<<<<<< HEAD
-=======
       ddlExecutor.execute(queryContext, plan);
       response.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
       response.setState(OK);
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 
       if (PlannerUtil.isDistExecDDL(rootNode)) {
         if (rootNode.getChild().getType() == NodeType.CREATE_INDEX) {
@@ -162,12 +159,7 @@ public class QueryExecutor {
         session.selectDatabase(setSessionNode.getValue());
       } else {
         response.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
-<<<<<<< HEAD
-        response.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR,
-            "database \"" + databaseName + "\" does not exists.", null));
-=======
         response.setState(errUndefinedDatabase(databaseName));
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       }
 
       // others
@@ -181,11 +173,7 @@ public class QueryExecutor {
 
     context.getSystemMetrics().counter("Query", "numDDLQuery").inc();
     response.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
-<<<<<<< HEAD
-    response.setResult(IPCUtil.buildOkRequestResult());
-=======
     response.setState(OK);
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
   }
 
   public void execExplain(LogicalPlan plan, QueryContext queryContext, boolean isGlobal,
@@ -231,10 +219,6 @@ public class QueryExecutor {
     response.setState(OK);
     response.setResultSet(serializedResBuilder.build());
     response.setMaxRowNum(lines.length);
-<<<<<<< HEAD
-    response.setResult(IPCUtil.buildOkRequestResult());
-=======
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
     response.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
   }
 
@@ -257,10 +241,6 @@ public class QueryExecutor {
     response.setQueryId(queryId.getProto());
     response.setMaxRowNum(maxRow);
     response.setTableDesc(queryResultScanner.getTableDesc().getProto());
-<<<<<<< HEAD
-    response.setResult(IPCUtil.buildOkRequestResult());
-=======
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
   }
 
   public void execSimpleQuery(QueryContext queryContext, Session session, String query, LogicalPlan plan,
@@ -297,10 +277,6 @@ public class QueryExecutor {
     response.setQueryId(queryInfo.getQueryId().getProto());
     response.setMaxRowNum(maxRow);
     response.setTableDesc(desc.getProto());
-<<<<<<< HEAD
-    response.setResult(IPCUtil.buildOkRequestResult());
-=======
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
   }
 
   public void execNonFromQuery(QueryContext queryContext, LogicalPlan plan, SubmitQueryResponse.Builder responseBuilder)
@@ -338,10 +314,6 @@ public class QueryExecutor {
         responseBuilder.setResultSet(serializedResBuilder);
         responseBuilder.setMaxRowNum(1);
         responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
-<<<<<<< HEAD
-        responseBuilder.setResult(IPCUtil.buildOkRequestResult());
-=======
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       }
     } finally {
       // stop script executor
@@ -503,11 +475,7 @@ public class QueryExecutor {
       // If queryId == NULL_QUERY_ID and MaxRowNum == -1, TajoCli prints only number of inserted rows.
       responseBuilder.setMaxRowNum(-1);
       responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
-<<<<<<< HEAD
-      responseBuilder.setResult(IPCUtil.buildOkRequestResult());
-=======
       responseBuilder.setState(OK);
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
     } catch (Throwable t) {
       throw new RuntimeException(t);
     }
@@ -541,29 +509,11 @@ public class QueryExecutor {
 
     queryInfo = queryManager.scheduleQuery(session, queryContext, sql, jsonExpr, rootNode);
 
-<<<<<<< HEAD
-    if(queryInfo == null) {
-      responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
-      responseBuilder.setResult(IPCUtil.buildRequestResult(ResultCode.ERROR,
-          "Fail starting QueryMaster.", null));
-      LOG.error("Fail starting QueryMaster: " + sql);
-    } else {
-      responseBuilder.setIsForwarded(true);
-      responseBuilder.setQueryId(queryInfo.getQueryId().getProto());
-      responseBuilder.setResult(IPCUtil.buildOkRequestResult());
-      if(queryInfo.getQueryMasterHost() != null) {
-        responseBuilder.setQueryMasterHost(queryInfo.getQueryMasterHost());
-      }
-      responseBuilder.setQueryMasterPort(queryInfo.getQueryMasterClientPort());
-      LOG.info("Query " + queryInfo.getQueryId().toString() + "," + queryInfo.getSql() + "," +
-          " is forwarded to " + queryInfo.getQueryMasterHost() + ":" + queryInfo.getQueryMasterPort());
-=======
     responseBuilder.setIsForwarded(true);
     responseBuilder.setQueryId(queryInfo.getQueryId().getProto());
     responseBuilder.setState(OK);
     if (queryInfo.getQueryMasterHost() != null) {
       responseBuilder.setQueryMasterHost(queryInfo.getQueryMasterHost());
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
     }
     responseBuilder.setQueryMasterPort(queryInfo.getQueryMasterClientPort());
     LOG.info("Query " + queryInfo.getQueryId().toString() + "," + queryInfo.getSql() + "," +

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-core/src/main/java/org/apache/tajo/querymaster/QueryMasterTask.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/querymaster/QueryMasterTask.java b/tajo-core/src/main/java/org/apache/tajo/querymaster/QueryMasterTask.java
index a1662e6..d2784c2 100644
--- a/tajo-core/src/main/java/org/apache/tajo/querymaster/QueryMasterTask.java
+++ b/tajo-core/src/main/java/org/apache/tajo/querymaster/QueryMasterTask.java
@@ -55,10 +55,7 @@ import org.apache.tajo.session.Session;
 import org.apache.tajo.storage.FormatProperty;
 import org.apache.tajo.storage.Tablespace;
 import org.apache.tajo.storage.TablespaceManager;
-<<<<<<< HEAD
-=======
 import org.apache.tajo.util.TUtil;
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 import org.apache.tajo.util.metrics.TajoMetrics;
 import org.apache.tajo.util.metrics.reporter.MetricsConsoleReporter;
 import org.apache.tajo.worker.event.NodeResourceDeallocateEvent;

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-core/src/main/java/org/apache/tajo/webapp/QueryExecutorServlet.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/webapp/QueryExecutorServlet.java b/tajo-core/src/main/java/org/apache/tajo/webapp/QueryExecutorServlet.java
index 5b13342..1df8e7a 100644
--- a/tajo-core/src/main/java/org/apache/tajo/webapp/QueryExecutorServlet.java
+++ b/tajo-core/src/main/java/org/apache/tajo/webapp/QueryExecutorServlet.java
@@ -319,11 +319,7 @@ public class QueryExecutorServlet extends HttpServlet {
           LOG.error("Internal Error: SubmissionResponse is NULL");
           error = new Exception("Internal Error: SubmissionResponse is NULL");
 
-<<<<<<< HEAD
-        } else if (response.getResult().getResultCode() == ClientProtos.ResultCode.OK) {
-=======
         } else if (isSuccess(response.getState())) {
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
           if (response.getIsForwarded()) {
             queryId = new QueryId(response.getQueryId());
             getQueryResult(queryId);
@@ -335,16 +331,9 @@ public class QueryExecutorServlet extends HttpServlet {
 
             progress.set(100);
           }
-<<<<<<< HEAD
-        } else if (response.getResult().getResultCode() == ClientProtos.ResultCode.ERROR) {
-          if (response.getResult().hasErrorMessage()) {
-            StringBuffer errorMessage = new StringBuffer(response.getResult().getErrorMessage());
-            String modifiedMessage;
-=======
         } else if (isError(response.getState())) {
           StringBuffer errorMessage = new StringBuffer(response.getState().getMessage());
           String modifiedMessage;
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 
           if (errorMessage.length() > 200) {
             modifiedMessage = errorMessage.substring(0, 200);

http://git-wip-us.apache.org/repos/asf/tajo/blob/6c01a2c3/tajo-core/src/main/java/org/apache/tajo/worker/TajoWorkerClientService.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/worker/TajoWorkerClientService.java b/tajo-core/src/main/java/org/apache/tajo/worker/TajoWorkerClientService.java
index 77481ae..281e23e 100644
--- a/tajo-core/src/main/java/org/apache/tajo/worker/TajoWorkerClientService.java
+++ b/tajo-core/src/main/java/org/apache/tajo/worker/TajoWorkerClientService.java
@@ -25,21 +25,11 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.service.AbstractService;
-import org.apache.hadoop.util.StringUtils;
 import org.apache.tajo.QueryId;
-<<<<<<< HEAD
-import org.apache.tajo.annotation.Nullable;
 import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.ipc.ClientProtos.GetQueryHistoryResponse;
-import org.apache.tajo.ipc.ClientProtos.QueryIdRequest;
-import org.apache.tajo.ipc.ClientProtos.RequestResult;
-import org.apache.tajo.ipc.ClientProtos.ResultCode;
-=======
 import org.apache.tajo.exception.ReturnStateUtil;
-import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.ipc.ClientProtos.GetQueryHistoryResponse;
 import org.apache.tajo.ipc.ClientProtos.QueryIdRequest;
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
 import org.apache.tajo.ipc.QueryMasterClientProtocol;
 import org.apache.tajo.querymaster.QueryMasterTask;
 import org.apache.tajo.rpc.BlockingRpcServer;
@@ -139,39 +129,13 @@ public class TajoWorkerClientService extends AbstractService {
         if (queryHistory != null) {
           builder.setQueryHistory(queryHistory.getProto());
         }
-<<<<<<< HEAD
-        builder.setResult(buildOkRequestResult());
-      } catch (Throwable t) {
-        LOG.warn(t.getMessage(), t);
-        builder.setResult(buildRequestResult(ResultCode.ERROR,
-            StringUtils.stringifyException(t), null));
-=======
         builder.setState(ReturnStateUtil.OK);
       } catch (Throwable t) {
         LOG.error(t.getMessage(), t);
         builder.setState(ReturnStateUtil.returnError(t));
->>>>>>> c50a5dadff90fa90709abbce59856e834baa4867
       }
 
       return builder.build();
     }
-
-    private RequestResult buildOkRequestResult() {
-      return buildRequestResult(ResultCode.OK, null, null);
-    }
-
-    private RequestResult buildRequestResult(ResultCode code,
-                                                    @Nullable String errorMessage,
-                                                    @Nullable String errorTrace) {
-      RequestResult.Builder builder = RequestResult.newBuilder();
-      builder.setResultCode(code);
-      if (errorMessage != null) {
-        builder.setErrorMessage(errorMessage);
-      }
-      if (errorTrace != null) {
-        builder.setErrorTrace(errorTrace);
-      }
-      return builder.build();
-    }
   }
 }


Mime
View raw message