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/02/24 11:18:17 UTC

[GitHub] [iotdb] yanhongwangg commented on a change in pull request #2725: [IOTDB-1164]Optimize the executeBatch interface in JDBC

yanhongwangg commented on a change in pull request #2725:
URL: https://github.com/apache/iotdb/pull/2725#discussion_r581874664



##########
File path: server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
##########
@@ -441,12 +441,31 @@ public TSStatus executeBatchStatement(TSExecuteBatchStatementReq req) {
 
       List<TSStatus> result = new ArrayList<>();
       boolean isAllSuccessful = true;
+      InsertRowsPlan insertRowsPlan = new InsertRowsPlan();
+      int index = 0;
       for (String statement : req.getStatements()) {
-        long t2 = System.currentTimeMillis();
-        isAllSuccessful =
-            executeStatementInBatch(statement, result, req.getSessionId()) && isAllSuccessful;
-        Measurement.INSTANCE.addOperationLatency(Operation.EXECUTE_ONE_SQL_IN_BATCH, t2);
+        PhysicalPlan physicalPlan =
+            processor.parseSQLToPhysicalPlan(
+                statement, sessionIdZoneIdMap.get(req.getSessionId()), DEFAULT_FETCH_SIZE);
+        if (physicalPlan.getOperatorType().equals(INSERT)) {
+          insertRowsPlan.addOneInsertRowPlan((InsertRowPlan) physicalPlan, index);
+          index++;
+        } else {
+          long t2 = System.currentTimeMillis();
+          isAllSuccessful =
+              executeStatementInBatch(statement, result, req.getSessionId()) && isAllSuccessful;
+          Measurement.INSTANCE.addOperationLatency(Operation.EXECUTE_ONE_SQL_IN_BATCH, t2);
+        }

Review comment:
       OK, thanks for your guidance




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