You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2023/05/16 10:01:40 UTC

[iotdb] branch lmh/optPPTcs updated (3843322146 -> 8056bee0b3)

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

hui pushed a change to branch lmh/optPPTcs
in repository https://gitbox.apache.org/repos/asf/iotdb.git


    from 3843322146 opt
     new 39b983df65 add comment
     new 8056bee0b3 add test

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/iotdb/commons/path/PathPatternTree.java |  1 +
 .../iotdb/commons/path/PathPatternTreeTest.java    | 51 +++++++++++++++++-----
 2 files changed, 41 insertions(+), 11 deletions(-)


[iotdb] 01/02: add comment

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hui pushed a commit to branch lmh/optPPTcs
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 39b983df653f71c07b9bf2bc67ed820389009f83
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Tue May 16 17:55:16 2023 +0800

    add comment
---
 .../src/main/java/org/apache/iotdb/commons/path/PathPatternTree.java     | 1 +
 1 file changed, 1 insertion(+)

diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternTree.java b/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternTree.java
index 056c4a240b..629195d4a6 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternTree.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternTree.java
@@ -43,6 +43,7 @@ public class PathPatternTree {
 
   private List<PartialPath> pathPatternList;
 
+  // set the default value to TRUE to ensure correctness
   private boolean useWildcard = true;
 
   public PathPatternTree(boolean useWildcard) {


[iotdb] 02/02: add test

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hui pushed a commit to branch lmh/optPPTcs
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 8056bee0b3e8cf33d4647a56e47e61feb352714e
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Tue May 16 18:01:02 2023 +0800

    add test
---
 .../iotdb/commons/path/PathPatternTreeTest.java    | 51 +++++++++++++++++-----
 1 file changed, 40 insertions(+), 11 deletions(-)

diff --git a/node-commons/src/test/java/org/apache/iotdb/commons/path/PathPatternTreeTest.java b/node-commons/src/test/java/org/apache/iotdb/commons/path/PathPatternTreeTest.java
index 08dcbbe6d8..47dc23bf31 100644
--- a/node-commons/src/test/java/org/apache/iotdb/commons/path/PathPatternTreeTest.java
+++ b/node-commons/src/test/java/org/apache/iotdb/commons/path/PathPatternTreeTest.java
@@ -43,7 +43,8 @@ public class PathPatternTreeTest {
             new PartialPath("root.sg1.d1.*"),
             new PartialPath("root.sg1.d1.s3")),
         Collections.singletonList(new PartialPath("root.sg1.d1.*")),
-        Collections.singletonList(new PartialPath("root.sg1.d1")));
+        Collections.singletonList(new PartialPath("root.sg1.d1")),
+        true);
   }
 
   @Test
@@ -55,7 +56,8 @@ public class PathPatternTreeTest {
             new PartialPath("root.sg1.*.t1.s1"),
             new PartialPath("root.sg1.d2.t1.s1")),
         Arrays.asList(new PartialPath("root.sg1.d1.t2.s2"), new PartialPath("root.sg1.*.t1.s1")),
-        Arrays.asList(new PartialPath("root.sg1.d1.t2"), new PartialPath("root.sg1.*")));
+        Arrays.asList(new PartialPath("root.sg1.d1.t2"), new PartialPath("root.sg1.*")),
+        true);
   }
 
   @Test
@@ -74,7 +76,8 @@ public class PathPatternTreeTest {
         Arrays.asList(
             new PartialPath("root.sg1.d1"),
             new PartialPath("root.sg1.d1.t1"),
-            new PartialPath("root.sg1.*")));
+            new PartialPath("root.sg1.*")),
+        true);
   }
 
   @Test
@@ -91,7 +94,8 @@ public class PathPatternTreeTest {
             new PartialPath("root.sg1.d1.t1.s1"),
             new PartialPath("root.sg1.d2.s3")),
         Collections.singletonList(new PartialPath("root.**")),
-        Collections.singletonList(new PartialPath("root.**")));
+        Collections.singletonList(new PartialPath("root.**")),
+        true);
   }
 
   @Test
@@ -104,7 +108,8 @@ public class PathPatternTreeTest {
             new PartialPath("root.sg1.d2.s1"),
             new PartialPath("root.sg1.**.s1")),
         Arrays.asList(new PartialPath("root.sg1.d1.s2"), new PartialPath("root.sg1.**.s1")),
-        Arrays.asList(new PartialPath("root.sg1.d1"), new PartialPath("root.sg1.**")));
+        Arrays.asList(new PartialPath("root.sg1.d1"), new PartialPath("root.sg1.**")),
+        true);
   }
 
   @Test
@@ -132,7 +137,8 @@ public class PathPatternTreeTest {
             new PartialPath("root.sg1.d2"),
             new PartialPath("root.sg1.**"),
             new PartialPath("root.sg1.*"),
-            new PartialPath("root.sg1.d3.t1")));
+            new PartialPath("root.sg1.d3.t1")),
+        true);
   }
 
   /** This use case is used to test the de-duplication of getAllPathPatterns results */
@@ -146,7 +152,8 @@ public class PathPatternTreeTest {
             new PartialPath("root.sg1.*.s1"),
             new PartialPath("root.sg1.**.s1")),
         Arrays.asList(new PartialPath("root.sg1.*.s2"), new PartialPath("root.sg1.**.s1")),
-        Arrays.asList(new PartialPath("root.sg1.*"), new PartialPath("root.sg1.**")));
+        Arrays.asList(new PartialPath("root.sg1.*"), new PartialPath("root.sg1.**")),
+        true);
   }
 
   /** This use case is used to test the de-duplication of getAllDevicePatterns results */
@@ -155,7 +162,8 @@ public class PathPatternTreeTest {
     checkPathPatternTree(
         Arrays.asList(new PartialPath("root.sg1.d1.s1"), new PartialPath("root.sg1.d1.s2")),
         Arrays.asList(new PartialPath("root.sg1.d1.s1"), new PartialPath("root.sg1.d1.s2")),
-        Collections.singletonList(new PartialPath("root.sg1.d1")));
+        Collections.singletonList(new PartialPath("root.sg1.d1")),
+        true);
   }
 
   /**
@@ -177,7 +185,27 @@ public class PathPatternTreeTest {
         Arrays.asList(
             new PartialPath("root.sg1"),
             new PartialPath("root.sg1.d1"),
-            new PartialPath("root.sg1.d1.**")));
+            new PartialPath("root.sg1.d1.**")),
+        true);
+  }
+
+  @Test
+  public void pathPatternTreeWithoutWildcardTest() throws IllegalPathException, IOException {
+    checkPathPatternTree(
+        Arrays.asList(
+            new PartialPath("root.sg1.d1.s1"),
+            new PartialPath("root.sg1.d2.s1"),
+            new PartialPath("root.sg1.d1.s2"),
+            new PartialPath("root.sg1.d2.s1"),
+            new PartialPath("root.sg1.d2.s2"),
+            new PartialPath("root.sg1.d1.s1")),
+        Arrays.asList(
+            new PartialPath("root.sg1.d1.s1"),
+            new PartialPath("root.sg1.d1.s2"),
+            new PartialPath("root.sg1.d2.s1"),
+            new PartialPath("root.sg1.d2.s2")),
+        Arrays.asList(new PartialPath("root.sg1.d1"), new PartialPath("root.sg1.d2")),
+        false);
   }
 
   /**
@@ -189,9 +217,10 @@ public class PathPatternTreeTest {
   private void checkPathPatternTree(
       List<PartialPath> paths,
       List<PartialPath> compressedPaths,
-      List<PartialPath> compressedDevicePaths)
+      List<PartialPath> compressedDevicePaths,
+      boolean useWildcard)
       throws IOException {
-    PathPatternTree patternTree = new PathPatternTree();
+    PathPatternTree patternTree = new PathPatternTree(useWildcard);
     for (PartialPath path : paths) {
       patternTree.appendPathPattern(path);
     }