You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/04/21 13:44:05 UTC

[iotdb] branch xingtanzjr/fix_schema_tree_match created (now d320ea5d1e)

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

xingtanzjr pushed a change to branch xingtanzjr/fix_schema_tree_match
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at d320ea5d1e fix the bug when matching multi-wildcard in pattern tree

This branch includes the following new commits:

     new d320ea5d1e fix the bug when matching multi-wildcard in pattern tree

The 1 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.



[iotdb] 01/01: fix the bug when matching multi-wildcard in pattern tree

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

xingtanzjr pushed a commit to branch xingtanzjr/fix_schema_tree_match
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit d320ea5d1ea9b158b72271bf72b6766e715823ae
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Thu Apr 21 21:43:51 2022 +0800

    fix the bug when matching multi-wildcard in pattern tree
---
 .../iotdb/db/mpp/common/schematree/SchemaTreeVisitor.java  |  6 ++++--
 .../iotdb/db/mpp/common/schematree/SchemaTreeTest.java     | 14 ++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/SchemaTreeVisitor.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/SchemaTreeVisitor.java
index c19d854bde..b186881064 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/SchemaTreeVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/SchemaTreeVisitor.java
@@ -199,9 +199,11 @@ public class SchemaTreeVisitor implements Iterator<MeasurementPath> {
     SchemaNode child = node.getChild(childName);
     if (child != null) {
       stack.push(Collections.singletonList(child).iterator());
-      context.push(node);
-      indexStack.push(patternIndex);
+    } else {
+      stack.push(Collections.emptyIterator());
     }
+    context.push(node);
+    indexStack.push(patternIndex);
   }
 
   private boolean checkOneLevelWildcardMatch(String regex, SchemaNode node) {
diff --git a/server/src/test/java/org/apache/iotdb/db/mpp/common/schematree/SchemaTreeTest.java b/server/src/test/java/org/apache/iotdb/db/mpp/common/schematree/SchemaTreeTest.java
index 3e7f9cdd92..adbd42431e 100644
--- a/server/src/test/java/org/apache/iotdb/db/mpp/common/schematree/SchemaTreeTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/mpp/common/schematree/SchemaTreeTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.iotdb.db.mpp.common.schematree;
 
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
 import org.apache.iotdb.db.metadata.path.MeasurementPath;
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -42,6 +43,19 @@ public class SchemaTreeTest {
     testSchemaTree(root);
   }
 
+  @Test
+  public void testMultiWildcard() throws IllegalPathException {
+    SchemaNode root = generateSchemaTree();
+    SchemaTreeVisitor visitor =
+        new SchemaTreeVisitor(root, new PartialPath("root.**.s1"), 0, 0, false);
+    checkVisitorResult(
+        visitor,
+        3,
+        new String[] {"root.sg.d1.s1", "root.sg.d2.s1", "root.sg.d2.a.s1"},
+        null,
+        new boolean[] {false, false, true});
+  }
+
   private void testSchemaTree(SchemaNode root) throws Exception {
 
     SchemaTreeVisitor visitor =