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

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


The following commit(s) were added to refs/heads/rel/0.10 by this push:
     new 1dae7fa  fix count timeseries bug (#1892)
1dae7fa is described below

commit 1dae7faf70db601ebf8f48421e6624f8615f921c
Author: Xiangwei Wei <[email protected]>
AuthorDate: Thu Oct 29 09:03:30 2020 +0800

    fix count timeseries bug (#1892)
---
 server/src/main/java/org/apache/iotdb/db/metadata/MTree.java     | 4 ++--
 server/src/test/java/org/apache/iotdb/db/metadata/MTreeTest.java | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java 
b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
index 3f2648a..5f38a23 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
@@ -585,7 +585,7 @@ public class MTree implements Serializable {
   /**
    * Traverse the MTree to get the count of timeseries.
    */
-  private int getCount(MNode node, String[] nodes, int idx) throws 
MetadataException {
+  private int getCount(MNode node, String[] nodes, int idx) {
     String nodeReg = MetaUtils.getNodeRegByIdx(idx, nodes);
     if (!(PATH_WILDCARD).equals(nodeReg)) {
       if (node.hasChild(nodeReg)) {
@@ -595,7 +595,7 @@ public class MTree implements Serializable {
           return getCount(node.getChild(nodeReg), nodes, idx + 1);
         }
       } else {
-        throw new MetadataException(node.getName() + " does not have the child 
node " + nodeReg);
+        return 0;
       }
     } else {
       int cnt = 0;
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/MTreeTest.java 
b/server/src/test/java/org/apache/iotdb/db/metadata/MTreeTest.java
index b84b568..a4d7c66 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/MTreeTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/MTreeTest.java
@@ -438,6 +438,8 @@ public class MTreeTest {
           CompressionType.GZIP, null, null);
 
       assertEquals(4, root.getAllTimeseriesCount("root.laptop"));
+      assertEquals(2, root.getAllTimeseriesCount("root.laptop.*.s1"));
+      assertEquals(0, root.getAllTimeseriesCount("root.laptop.d1.s3"));
 
       assertEquals(2, root.getNodesCountInGivenLevel("root.laptop", 2));
       assertEquals(4, root.getNodesCountInGivenLevel("root.laptop", 3));

Reply via email to