jt2594838 commented on code in PR #18132:
URL: https://github.com/apache/iotdb/pull/18132#discussion_r3611782078


##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java:
##########
@@ -2857,6 +2867,572 @@ public void insertRelationalTablet(Tablet tablet)
     }
   }
 
+  /**
+   * insert relational Tablets.
+   *
+   * @param tablets data batches
+   */
+  public void insertRelationalTablets(List<Tablet> tablets)
+      throws IoTDBConnectionException, StatementExecutionException {
+    final boolean recordMergeTabletsCost = enableMergeTablets;
+    long mergeTabletsCost = 0;
+    if (enableMergeTablets) {
+      final long mergeTabletsStartTime = System.nanoTime();
+      tablets = mergeRelationalTablets(tablets);
+      mergeTabletsCost = System.nanoTime() - mergeTabletsStartTime;
+    }
+    if (tablets.isEmpty()) {
+      throw new BatchExecutionException(SessionMessages.NO_TABLET_INSERTING);
+    }
+    final long insertTabletsStartTime = System.nanoTime();
+    if (enableRedirection) {
+      insertRelationalTabletsWithLeaderCache(tablets);
+    } else {
+      TSInsertTabletsReq request = genTSInsertTabletsReq(tablets, false, 
false);
+      request.setWriteToTable(true);
+      for (Tablet tablet : tablets) {
+        
request.addToColumnCategoriesList(toEnumOrdinalsAsBytes(tablet.getColumnTypes()));
+      }
+      try {
+        getDefaultSessionConnection().insertTablets(request);

Review Comment:
   Fixed in f0b92eff49. When redirection is disabled, relational batch inserts 
now call `SessionConnection.insertTabletsWithoutRedirect`, which uses the 
normal success verifier. `REDIRECTION_RECOMMEND` remains a successful write, 
but row redirect metadata is deliberately not decoded, so no 
`RedirectException` or device endpoint map is created, no leader cache is 
updated, and the successful write is not retried. Added 
`testInsertRelationalTabletsWithRedirectionDisabledIgnoresRedirect` and 
`testInsertTabletsWithoutRedirectIgnoresRowRedirectStatus`; the latter covers a 
two-row response redirected to two non-local endpoints.



##########
iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java:
##########
@@ -2857,6 +2867,572 @@ public void insertRelationalTablet(Tablet tablet)
     }
   }
 
+  /**
+   * insert relational Tablets.
+   *
+   * @param tablets data batches
+   */
+  public void insertRelationalTablets(List<Tablet> tablets)
+      throws IoTDBConnectionException, StatementExecutionException {
+    final boolean recordMergeTabletsCost = enableMergeTablets;
+    long mergeTabletsCost = 0;
+    if (enableMergeTablets) {
+      final long mergeTabletsStartTime = System.nanoTime();
+      tablets = mergeRelationalTablets(tablets);

Review Comment:
   Fixed in f0b92eff49. `insertRelationalTablets` now preserves the existing 
error for a truly empty input list, filters zero-row Tablets before merging, 
and returns without issuing an RPC when a non-empty batch contains only empty 
Tablets. Mixed batches process only their non-empty Tablets. Added 
`testInsertRelationalTabletsIgnoresAllEmptyTablets` to cover the all-empty 
no-op path with redirection enabled.



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