Skip to content
Open
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 @@ -864,6 +864,9 @@ private TSStatus insertTabletsInternal(TSInsertTabletsReq request) throws TExcep

protected void deleteTimeseries(List<String> paths)
throws IoTDBConnectionException, StatementExecutionException {
if (paths.isEmpty()) {
return;
}
callWithRetryAndVerify(() -> client.deleteTimeseries(sessionId, paths));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2013,6 +2013,9 @@ public void deleteTimeseries(String path)
@Override
public void deleteTimeseries(List<String> paths)
throws IoTDBConnectionException, StatementExecutionException {
if (paths.isEmpty()) {
return;
}
ISession session = getSession();
try {
session.deleteTimeseries(paths);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,14 @@ public void testInsertRecord()
sessionConnection.deleteTimeseries(Arrays.asList("root.sg1.d1.s1"));
}

@Test
public void testDeleteEmptyTimeseries()
throws IoTDBConnectionException, StatementExecutionException, TException {
sessionConnection.deleteTimeseries(Collections.emptyList());

Mockito.verify(client, Mockito.never()).deleteTimeseries(anyLong(), any());
}

@Test
public void testDeleteData() throws IoTDBConnectionException, StatementExecutionException {
sessionConnection.deleteData(new TSDeleteDataReq());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,17 @@ public void testDeleteTimeseriesList()
((ConcurrentLinkedDeque<ISession>) Whitebox.getInternalState(sessionPool, "queue")).size());
}

@Test
public void testDeleteEmptyTimeseriesList()
throws IoTDBConnectionException, StatementExecutionException {
sessionPool.deleteTimeseries(Collections.emptyList());

Mockito.verify(session, Mockito.never()).deleteTimeseries(Mockito.<List<String>>any());
assertEquals(
1,
((ConcurrentLinkedDeque<ISession>) Whitebox.getInternalState(sessionPool, "queue")).size());
}

@Test
public void testDeleteData() throws IoTDBConnectionException, StatementExecutionException {
String path = "root.device1.temperature";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,9 @@ public TSStatus deleteTimeseries(long sessionId, List<String> path) {
return getNotLoggedInStatus();
}

if (path.isEmpty()) {
return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
}
// Step 1: transfer from DeleteStorageGroupsReq to Statement
DeleteTimeSeriesStatement statement =
StatementGenerator.createDeleteTimeSeriesStatement(path);
Expand Down
Loading