You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/11/17 10:41:09 UTC

[iotdb] 01/03: Remove unnecessary delete path check

This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch rel/0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 6b8aad868b764152f00f456713570fb0d8e9441b
Author: wshao08 <ko...@163.com>
AuthorDate: Mon Nov 16 11:55:31 2020 +0800

    Remove unnecessary delete path check
    
    (cherry picked from commit 5b653a48dfc00703ccb8611c8791378a7a95b795)
---
 .../apache/iotdb/db/qp/executor/PlanExecutor.java  |  4 ---
 .../iotdb/db/integration/IoTDBDeletionIT.java      | 29 ++++++++++++++++++++++
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
index e8fe6ad..66a6dcf 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
@@ -848,10 +848,6 @@ public class PlanExecutor implements IPlanExecutor {
   public void delete(PartialPath path, long startTime, long endTime, long planIndex)
       throws QueryProcessException {
     try {
-      if (!IoTDB.metaManager.isPathExist(path)) {
-        throw new QueryProcessException(
-            String.format("Time series %s does not exist.", path.getFullPath()));
-      }
       StorageEngine.getInstance().delete(path, startTime, endTime, planIndex);
     } catch (StorageEngineException e) {
       throw new QueryProcessException(e);
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java
index 3f9daf7..3da375a 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java
@@ -203,6 +203,35 @@ public class IoTDBDeletionIT {
   }
 
   @Test
+  public void testPartialPathRangeDelete() throws SQLException {
+    prepareData();
+    try (Connection connection = DriverManager
+            .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
+                    "root");
+         Statement statement = connection.createStatement()) {
+
+      statement.execute("DELETE FROM root.vehicle.d0.* WHERE time <= 300 and time > 150");
+      try (ResultSet set = statement.executeQuery("SELECT s0 FROM root.vehicle.d0")) {
+        int cnt = 0;
+        while (set.next()) {
+          cnt++;
+        }
+        assertEquals(250, cnt);
+      }
+
+      statement.execute("DELETE FROM root.vehicle.*.s0 WHERE time <= 100");
+      try (ResultSet set = statement.executeQuery("SELECT s0 FROM root.vehicle.d0")) {
+        int cnt = 0;
+        while (set.next()) {
+          cnt++;
+        }
+        assertEquals(150, cnt);
+      }
+    }
+    cleanData();
+  }
+
+  @Test
   public void testDelFlushingMemtable() throws SQLException {
     long size = IoTDBDescriptor.getInstance().getConfig().getMemtableSizeThreshold();
     // Adjust memstable threshold size to make it flush automatically