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


##########
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:
   **Low:** Zero-row relational Tablets are not filtered before this merge. Two 
compatible empty Tablets are merged into a new Tablet with `rowCount == 0`, 
hence zero-capacity value arrays. With redirection enabled, 
`addRelationalTabletToGroup` then calls 
`SessionUtils.isTabletContainsSingleDevice`, which evaluates `getDeviceID(0)`; 
a tagged zero-capacity Tablet throws `IndexOutOfBoundsException` there. This is 
inconsistent with `insertRelationalTablet`, which explicitly treats `rowSize == 
0` as a no-op, and with the server parser, which skips empty Tablets. Please 
filter zero-row Tablets before merging, define the all-empty batch behavior, 
and add a regression test.



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