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 2021/03/20 08:19:39 UTC

[GitHub] [iotdb] neuyilan commented on a change in pull request #2872: [IOTDB-1236] Improve jdbc performance for creating timeseries in cluster module

neuyilan commented on a change in pull request #2872:
URL: https://github.com/apache/iotdb/pull/2872#discussion_r598080962



##########
File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
##########
@@ -506,6 +534,30 @@ public TSStatus executeBatchStatement(TSExecuteBatchStatementReq req) {
         }
       }
     }
+    if (paths.size() > 0) {
+      multiPlan.setPaths(paths);
+      multiPlan.setDataTypes(tsDataTypes);
+      multiPlan.setEncodings(tsEncodings);
+      multiPlan.setCompressors(tsCompressionTypes);
+      multiPlan.setTags(tagsList);
+      multiPlan.setAttributes(attributesList);
+      multiPlan.setAlias(aliasList);
+      TSStatus status = executeNonQueryPlan(multiPlan);
+      if (status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
+        int startIndex = result.size();
+        if (startIndex > 0) {
+          startIndex = startIndex - 1;
+        }
+        for (int i = 0; i < paths.size(); i++) {
+          result.add(RpcUtils.SUCCESS_STATUS);
+        }
+        for (Entry<Integer, TSStatus> entry : multiPlan.getResults().entrySet()) {
+          result.set(startIndex + entry.getKey(), entry.getValue());
+        }
+        isAllSuccessful = false;
+      }
+    }
+
     Measurement.INSTANCE.addOperationLatency(Operation.EXECUTE_JDBC_BATCH, t1);
     return isAllSuccessful
         ? RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS, "Execute batch statements successfully")

Review comment:
       We can not do the meta operation in the last step, for example, we have the following SQL statements:
   
   example1: 
   
   > delete timeseries root.ln.wf01.wt01.status
   > insert into root.ln.wf01.wt01(timestamp,status) values(1,true)
   
   example2:
   
   > create timeseries root.ln.wf01.wt01.temperature with datatype=FLOAT,encoding=RLE
   > create timeseries root.ln.wf01.wt01.status with datatype=BOOLEAN,encoding=PLAIN
   > // insert one record with wrong type
   > insert into root.ln.wf01.wt01(timestamp,status) values(1,"this is wrong type, can not be insert success")
   
   For example 1, if we first execute the insert statement, then execute the delete statement, all data will be deleted.
   
   For example 2, if we first execute the insert statement, IoTDB will create **TEXT** type for root.ln.wf01.wt01.status  automatically, which is in conflict with the  user given type(**BOOLEN**).
   
   
   
   
   




-- 
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