This is an automated email from the ASF dual-hosted git repository.
jt2594838 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 6e7448d9beb Fix relational insert tablet redirect row count (#19221)
6e7448d9beb is described below
commit 6e7448d9bebd644259b695dfc8774d3d9f91252e
Author: shuwenwei <[email protected]>
AuthorDate: Wed Nov 11 16:30:19 2026 +0800
Fix relational insert tablet redirect row count (#19221)
---
.../node/write/RelationalInsertTabletNode.java | 4 +--
.../planner/node/write/WritePlanNodeSplitTest.java | 29 ++++++++++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertTabletNode.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertTabletNode.java
index 50924da4447..28bd6eeffa4 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertTabletNode.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertTabletNode.java
@@ -287,8 +287,8 @@ public class RelationalInsertTabletNode extends
InsertTabletNode {
subRanges.add(splitInfo.ranges.get(2 * i + 1));
}
}
- final List<TDataNodeLocation> redirectNodeList = new
ArrayList<>(times.length);
- for (int i = 0; i < times.length; i++) {
+ final List<TDataNodeLocation> redirectNodeList = new ArrayList<>(rowCount);
+ for (int i = 0; i < rowCount; i++) {
final IDeviceID deviceId = getDeviceID(i);
redirectNodeList.add(dataNodeLocationMap.get(deviceId));
}
diff --git
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/WritePlanNodeSplitTest.java
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/WritePlanNodeSplitTest.java
index f7da4e06144..f4d83b19e7f 100644
---
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/WritePlanNodeSplitTest.java
+++
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/node/write/WritePlanNodeSplitTest.java
@@ -411,6 +411,35 @@ public class WritePlanNodeSplitTest {
}
}
+ @Test
+ public void testSplitRelationalInsertTabletUsesRowCountForRedirects()
+ throws IllegalPathException {
+ RelationalInsertTabletNode relationalInsertTabletNode =
+ new RelationalInsertTabletNode(new PlanNodeId("plan node with spare
row capacity"));
+ relationalInsertTabletNode.setTargetPath(new PartialPath("root.sg1"));
+ relationalInsertTabletNode.setTimes(new long[] {1, 2, 3, 4});
+ relationalInsertTabletNode.setDataTypes(new TSDataType[]
{TSDataType.STRING, TSDataType.INT32});
+ Binary device = new Binary("d1", StandardCharsets.UTF_8);
+ relationalInsertTabletNode.setColumns(
+ new Object[] {new Binary[] {device, device, device, device}, new int[]
{10, 20, 30, 40}});
+ relationalInsertTabletNode.setColumnCategories(
+ new TsTableColumnCategory[] {TsTableColumnCategory.TAG,
TsTableColumnCategory.FIELD});
+ relationalInsertTabletNode.setRowCount(2);
+
+ DataPartitionQueryParam dataPartitionQueryParam = new
DataPartitionQueryParam();
+
dataPartitionQueryParam.setDeviceID(relationalInsertTabletNode.getDeviceID(0));
+ dataPartitionQueryParam.setTimePartitionSlotList(
+ relationalInsertTabletNode.getTimePartitionSlots());
+ Analysis analysis = new Analysis();
+ analysis.setDataPartitionInfo(
+ getDataPartition(Collections.singletonList(dataPartitionQueryParam)));
+
+ List<WritePlanNode> splitNodes =
relationalInsertTabletNode.splitByPartition(analysis);
+
+ Assert.assertEquals(1, splitNodes.size());
+ Assert.assertEquals(2, analysis.getRedirectNodeList().size());
+ }
+
@Test
public void testInsertMultiTablets() throws IllegalPathException {
InsertMultiTabletsNode insertMultiTabletsNode =