You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/03/09 12:28:00 UTC

[GitHub] [incubator-iotdb] qiaojialin opened a new pull request #896: Refine exception code

qiaojialin opened a new pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] jixuan1989 commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r389847302
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
 ##########
 @@ -886,11 +837,8 @@ public TSFetchResultsResp fetchResults(TSFetchResultsReq req) {
           QueryResourceManager.getInstance().endQuery(req.queryId);
           queryId2DataSet.remove(req.queryId);
         }
-        TSFetchResultsResp resp =
-            getTSFetchResultsResp(
-                getStatus(
-                    TSStatusCode.SUCCESS_STATUS,
-                    "FetchResult successfully. Has more result: " + hasResultSet));
+        TSFetchResultsResp resp = RpcUtils.getTSFetchResultsResp(
+            TSStatusCode.SUCCESS_STATUS, "FetchResult successfully. Has more result: " + hasResultSet);
 
 Review comment:
   do we really need such a long string as the message?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] sonarcloud[bot] removed a comment on issue #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on issue #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#issuecomment-597076885
 
 
   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B.png' alt='B' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=VULNERABILITY) [2 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=896) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=896&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=896&metric=new_duplicated_lines_density&view=list)
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] jixuan1989 commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r389841542
 
 

 ##########
 File path: example/rocketmq/src/main/java/org/apache/iotdb/rocketmq/RocketMQConsumer.java
 ##########
 @@ -120,7 +120,7 @@ public void prepareConsume() throws MQClientException {
             new String(msg.getBody())));
         try {
           insert(new String(msg.getBody()));
-        } catch (IoTDBConnectionException e) {
+        } catch (Exception e) {
           logger.error(e.getMessage());
 
 Review comment:
   it is better to throw MQClientException

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r390042422
 
 

 ##########
 File path: service-rpc/src/main/thrift/rpc.thrift
 ##########
 @@ -19,18 +19,11 @@
 namespace java org.apache.iotdb.service.rpc.thrift
 
 // The return status code and message in each response.
-struct TSStatusType {
+struct TSStatus {
   1: required i32 code
   2: required string message
 
 Review comment:
   fixed

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r390049492
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
 ##########
 @@ -537,7 +540,7 @@ public void insert(InsertPlan insertPlan) throws QueryProcessException {
       while (loc < batchInsertPlan.getRowCount()) {
         long time = batchInsertPlan.getTimes()[loc];
         long curTimePartition = StorageEngine.fromTimeToTimePartition(time);
-        results[loc] = TSStatusCode.SUCCESS_STATUS.getStatusCode();
+        results[loc] = RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
 
 Review comment:
   Yes, I create a public static TSStatus SUCCESS_STATUS = new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
   in RpcUtils and reuse this.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r390049871
 
 

 ##########
 File path: jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
 ##########
 @@ -258,41 +257,27 @@ private boolean executeSQL(String sql) throws TException, SQLException {
     }
   }
 
-  private int[] executeBatchSQL() throws TException, SQLException {
+  private int[] executeBatchSQL() throws TException, BatchUpdateException {
     isCancelled = false;
-    TSExecuteBatchStatementReq execReq = new TSExecuteBatchStatementReq(sessionId,
-        batchSQLList);
+    TSExecuteBatchStatementReq execReq = new TSExecuteBatchStatementReq(sessionId, batchSQLList);
     TSExecuteBatchStatementResp execResp = client.executeBatchStatement(execReq);
-    if (execResp.getStatus().getStatusType().getCode() == TSStatusCode.SUCCESS_STATUS
-        .getStatusCode()) {
-      if (execResp.getResult() == null) {
-        return new int[0];
-      } else {
-        List<Integer> result = execResp.getResult();
-        int len = result.size();
-        int[] updateArray = new int[len];
-        for (int i = 0; i < len; i++) {
-          updateArray[i] = result.get(i);
-        }
-        return updateArray;
-      }
-    } else {
-      BatchUpdateException exception;
-      if (execResp.getResult() == null) {
-        exception = new BatchUpdateException(execResp.getStatus().getStatusType().getMessage(),
-            new int[0]);
-      } else {
-        List<Integer> result = execResp.getResult();
-        int len = result.size();
-        int[] updateArray = new int[len];
-        for (int i = 0; i < len; i++) {
-          updateArray[i] = result.get(i);
-        }
-        exception = new BatchUpdateException(execResp.getStatus().getStatusType().getMessage(),
-            updateArray);
+    if (execResp.statusList == null) {
+
+    }
+    int[] result = new int[execResp.statusList.size()];
+    boolean allSuccess = true;
+    String message = "";
+    for (int i = 0; i < result.length; i++) {
+      result[i] = execResp.statusList.get(i).code;
+      if (result[i] != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+        allSuccess = false;
+        message = execResp.statusList.get(i).message;
 
 Review comment:
   Yes, the more detailed message could be found in the result.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] sonarcloud[bot] commented on issue #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on issue #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#issuecomment-597151971
 
 
   Kudos, SonarCloud Quality Gate passed!
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=896) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=896&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=896&metric=new_duplicated_lines_density&view=list)
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r390042871
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
 ##########
 @@ -910,18 +858,16 @@ public TSFetchResultsResp fetchResults(TSFetchResultsReq req) {
           queryId2DataSet.remove(req.queryId);
         }
         TSFetchResultsResp resp =
-            getTSFetchResultsResp(
-                getStatus(
-                    TSStatusCode.SUCCESS_STATUS,
-                    "FetchResult successfully. Has more result: " + hasResultSet));
+            RpcUtils.getTSFetchResultsResp(TSStatusCode.SUCCESS_STATUS,
+                "FetchResult successfully. Has more result: " + hasResultSet);
 
 Review comment:
   removed message

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] jixuan1989 commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r389848290
 
 

 ##########
 File path: service-rpc/src/main/thrift/rpc.thrift
 ##########
 @@ -19,18 +19,11 @@
 namespace java org.apache.iotdb.service.rpc.thrift
 
 // The return status code and message in each response.
-struct TSStatusType {
+struct TSStatus {
   1: required i32 code
   2: required string message
 
 Review comment:
   maybe the message can be optional.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] jixuan1989 commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r389845216
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
 ##########
 @@ -537,7 +540,7 @@ public void insert(InsertPlan insertPlan) throws QueryProcessException {
       while (loc < batchInsertPlan.getRowCount()) {
         long time = batchInsertPlan.getTimes()[loc];
         long curTimePartition = StorageEngine.fromTimeToTimePartition(time);
-        results[loc] = TSStatusCode.SUCCESS_STATUS.getStatusCode();
+        results[loc] = RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
 
 Review comment:
   overhead if all are successful. (too many TSStatus instances.. right?)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] qiaojialin merged pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
qiaojialin merged pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r390056262
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
 ##########
 @@ -537,7 +540,7 @@ public void insert(InsertPlan insertPlan) throws QueryProcessException {
       while (loc < batchInsertPlan.getRowCount()) {
         long time = batchInsertPlan.getTimes()[loc];
         long curTimePartition = StorageEngine.fromTimeToTimePartition(time);
-        results[loc] = TSStatusCode.SUCCESS_STATUS.getStatusCode();
+        results[loc] = RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
 
 Review comment:
   If all are successful, I will return one TSStatus in TSServiceImpl line 1194
   
   if (isAllSuccessful) {
           if (logger.isDebugEnabled()) {
             logger.debug("Insert one RowBatch successfully");
           }
           return RpcUtils.getTSBatchExecuteStatementResp(TSStatusCode.SUCCESS_STATUS);
         } else {

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r390049913
 
 

 ##########
 File path: jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
 ##########
 @@ -258,41 +257,27 @@ private boolean executeSQL(String sql) throws TException, SQLException {
     }
   }
 
-  private int[] executeBatchSQL() throws TException, SQLException {
+  private int[] executeBatchSQL() throws TException, BatchUpdateException {
     isCancelled = false;
-    TSExecuteBatchStatementReq execReq = new TSExecuteBatchStatementReq(sessionId,
-        batchSQLList);
+    TSExecuteBatchStatementReq execReq = new TSExecuteBatchStatementReq(sessionId, batchSQLList);
     TSExecuteBatchStatementResp execResp = client.executeBatchStatement(execReq);
-    if (execResp.getStatus().getStatusType().getCode() == TSStatusCode.SUCCESS_STATUS
-        .getStatusCode()) {
-      if (execResp.getResult() == null) {
-        return new int[0];
-      } else {
-        List<Integer> result = execResp.getResult();
-        int len = result.size();
-        int[] updateArray = new int[len];
-        for (int i = 0; i < len; i++) {
-          updateArray[i] = result.get(i);
-        }
-        return updateArray;
-      }
-    } else {
-      BatchUpdateException exception;
-      if (execResp.getResult() == null) {
-        exception = new BatchUpdateException(execResp.getStatus().getStatusType().getMessage(),
-            new int[0]);
-      } else {
-        List<Integer> result = execResp.getResult();
-        int len = result.size();
-        int[] updateArray = new int[len];
-        for (int i = 0; i < len; i++) {
-          updateArray[i] = result.get(i);
-        }
-        exception = new BatchUpdateException(execResp.getStatus().getStatusType().getMessage(),
-            updateArray);
+    if (execResp.statusList == null) {
+
 
 Review comment:
   removed

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] jixuan1989 commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r389843152
 
 

 ##########
 File path: jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
 ##########
 @@ -258,41 +257,27 @@ private boolean executeSQL(String sql) throws TException, SQLException {
     }
   }
 
-  private int[] executeBatchSQL() throws TException, SQLException {
+  private int[] executeBatchSQL() throws TException, BatchUpdateException {
     isCancelled = false;
-    TSExecuteBatchStatementReq execReq = new TSExecuteBatchStatementReq(sessionId,
-        batchSQLList);
+    TSExecuteBatchStatementReq execReq = new TSExecuteBatchStatementReq(sessionId, batchSQLList);
     TSExecuteBatchStatementResp execResp = client.executeBatchStatement(execReq);
-    if (execResp.getStatus().getStatusType().getCode() == TSStatusCode.SUCCESS_STATUS
-        .getStatusCode()) {
-      if (execResp.getResult() == null) {
-        return new int[0];
-      } else {
-        List<Integer> result = execResp.getResult();
-        int len = result.size();
-        int[] updateArray = new int[len];
-        for (int i = 0; i < len; i++) {
-          updateArray[i] = result.get(i);
-        }
-        return updateArray;
-      }
-    } else {
-      BatchUpdateException exception;
-      if (execResp.getResult() == null) {
-        exception = new BatchUpdateException(execResp.getStatus().getStatusType().getMessage(),
-            new int[0]);
-      } else {
-        List<Integer> result = execResp.getResult();
-        int len = result.size();
-        int[] updateArray = new int[len];
-        for (int i = 0; i < len; i++) {
-          updateArray[i] = result.get(i);
-        }
-        exception = new BatchUpdateException(execResp.getStatus().getStatusType().getMessage(),
-            updateArray);
+    if (execResp.statusList == null) {
+
+    }
+    int[] result = new int[execResp.statusList.size()];
+    boolean allSuccess = true;
+    String message = "";
+    for (int i = 0; i < result.length; i++) {
+      result[i] = execResp.statusList.get(i).code;
+      if (result[i] != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+        allSuccess = false;
+        message = execResp.statusList.get(i).message;
 
 Review comment:
   so, only keep the final message?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r390042707
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
 ##########
 @@ -886,11 +837,8 @@ public TSFetchResultsResp fetchResults(TSFetchResultsReq req) {
           QueryResourceManager.getInstance().endQuery(req.queryId);
           queryId2DataSet.remove(req.queryId);
         }
-        TSFetchResultsResp resp =
-            getTSFetchResultsResp(
-                getStatus(
-                    TSStatusCode.SUCCESS_STATUS,
-                    "FetchResult successfully. Has more result: " + hasResultSet));
+        TSFetchResultsResp resp = RpcUtils.getTSFetchResultsResp(
+            TSStatusCode.SUCCESS_STATUS, "FetchResult successfully. Has more result: " + hasResultSet);
 
 Review comment:
   This message is not needed, removed

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] jixuan1989 commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r389847618
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
 ##########
 @@ -910,18 +858,16 @@ public TSFetchResultsResp fetchResults(TSFetchResultsReq req) {
           queryId2DataSet.remove(req.queryId);
         }
         TSFetchResultsResp resp =
-            getTSFetchResultsResp(
-                getStatus(
-                    TSStatusCode.SUCCESS_STATUS,
-                    "FetchResult successfully. Has more result: " + hasResultSet));
+            RpcUtils.getTSFetchResultsResp(TSStatusCode.SUCCESS_STATUS,
+                "FetchResult successfully. Has more result: " + hasResultSet);
 
 Review comment:
   The same with Line 841.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] jixuan1989 commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
jixuan1989 commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r389842543
 
 

 ##########
 File path: jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java
 ##########
 @@ -258,41 +257,27 @@ private boolean executeSQL(String sql) throws TException, SQLException {
     }
   }
 
-  private int[] executeBatchSQL() throws TException, SQLException {
+  private int[] executeBatchSQL() throws TException, BatchUpdateException {
     isCancelled = false;
-    TSExecuteBatchStatementReq execReq = new TSExecuteBatchStatementReq(sessionId,
-        batchSQLList);
+    TSExecuteBatchStatementReq execReq = new TSExecuteBatchStatementReq(sessionId, batchSQLList);
     TSExecuteBatchStatementResp execResp = client.executeBatchStatement(execReq);
-    if (execResp.getStatus().getStatusType().getCode() == TSStatusCode.SUCCESS_STATUS
-        .getStatusCode()) {
-      if (execResp.getResult() == null) {
-        return new int[0];
-      } else {
-        List<Integer> result = execResp.getResult();
-        int len = result.size();
-        int[] updateArray = new int[len];
-        for (int i = 0; i < len; i++) {
-          updateArray[i] = result.get(i);
-        }
-        return updateArray;
-      }
-    } else {
-      BatchUpdateException exception;
-      if (execResp.getResult() == null) {
-        exception = new BatchUpdateException(execResp.getStatus().getStatusType().getMessage(),
-            new int[0]);
-      } else {
-        List<Integer> result = execResp.getResult();
-        int len = result.size();
-        int[] updateArray = new int[len];
-        for (int i = 0; i < len; i++) {
-          updateArray[i] = result.get(i);
-        }
-        exception = new BatchUpdateException(execResp.getStatus().getStatusType().getMessage(),
-            updateArray);
+    if (execResp.statusList == null) {
+
 
 Review comment:
   ?? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] sonarcloud[bot] commented on issue #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on issue #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#issuecomment-597076885
 
 
   SonarCloud Quality Gate failed.
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=BUG)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B.png' alt='B' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=VULNERABILITY) [2 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=SECURITY_HOTSPOT) to review)  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=896&resolved=false&types=CODE_SMELL)
   
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=896) No Coverage information  
   [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3.png' alt='0.0%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=896&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=896&metric=new_duplicated_lines_density&view=list)
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-iotdb] qiaojialin commented on a change in pull request #896: Refine exception code

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #896: Refine exception code
URL: https://github.com/apache/incubator-iotdb/pull/896#discussion_r390062684
 
 

 ##########
 File path: example/rocketmq/src/main/java/org/apache/iotdb/rocketmq/RocketMQConsumer.java
 ##########
 @@ -120,7 +120,7 @@ public void prepareConsume() throws MQClientException {
             new String(msg.getBody())));
         try {
           insert(new String(msg.getBody()));
-        } catch (IoTDBConnectionException e) {
+        } catch (Exception e) {
           logger.error(e.getMessage());
 
 Review comment:
   The  MessageListenerOrderly interface doesn't allow to throw an exception

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services