HTHou commented on code in PR #13550:
URL: https://github.com/apache/iotdb/pull/13550#discussion_r1776293378


##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java:
##########
@@ -2697,6 +2790,111 @@ public void insertRelationalTablet(Tablet tablet)
     insertRelationalTablet(tablet, false);
   }
 
+  private void insertRelationalTabletWithLeaderCache(Tablet tablet)
+      throws IoTDBConnectionException, StatementExecutionException {
+    Map<SessionConnection, Tablet> relationalTabletGroup = new HashMap<>();
+    if (tableModelDeviceIdToEndpoint.isEmpty()) {
+      relationalTabletGroup.put(defaultSessionConnection, tablet);
+    } else {
+      for (int i = 0; i < tablet.rowSize; i++) {
+        IDeviceID iDeviceID = tablet.getDeviceID(i);
+        final SessionConnection connection = getSessionConnection(iDeviceID);
+        int finalI = i;
+        relationalTabletGroup.compute(
+            connection,
+            (k, v) -> {
+              if (v == null) {
+                v =
+                    new Tablet(
+                        tablet.getTableName(),
+                        tablet.getSchemas(),
+                        tablet.getColumnTypes(),
+                        tablet.rowSize);
+              }
+              for (int j = 0; j < v.getSchemas().size(); j++) {
+                v.addValue(
+                    v.getSchemas().get(j).getMeasurementId(),
+                    v.rowSize,
+                    tablet.getValue(finalI, j));
+              }
+              v.addTimestamp(v.rowSize, tablet.timestamps[finalI]);
+              v.rowSize++;
+              return v;
+            });
+      }
+    }
+    insertRelationalTabletByGroup(relationalTabletGroup);
+  }
+
+  @SuppressWarnings({
+    "squid:S3776"
+  }) // ignore Cognitive Complexity of methods should not be too high
+  private <T> void insertRelationalTabletByGroup(

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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to