Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ protected Map<TRegionReplicaSet, List<Integer>> splitByReplicaSet(
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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,35 @@ public void testSplitRelationalInsertTablet() throws IllegalPathException {
}
}

@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 =
Expand Down
Loading