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

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


The following commit(s) were added to refs/heads/master by this push:
     new e1edeb7  fix count timeseries bug (#1891)
e1edeb7 is described below

commit e1edeb74be43cb255392345407313d5277dbcdcd
Author: Xiangwei Wei <[email protected]>
AuthorDate: Thu Oct 29 09:20:41 2020 +0800

    fix count timeseries bug (#1891)
---
 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 387c7b5..043742b 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
@@ -867,7 +867,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)) {
       MNode next = node.getChild(nodeReg);
@@ -878,7 +878,7 @@ public class MTree implements Serializable {
           return getCount(next, nodes, idx + 1);
         }
       } else {
-        throw new MetadataException(node.getName() + NO_CHILDNODE_MSG + 
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 86a4901..bd83fc8 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
@@ -439,6 +439,8 @@ public class MTreeTest {
           CompressionType.GZIP, null, null);
 
       assertEquals(4, root.getAllTimeseriesCount(new 
PartialPath("root.laptop")));
+      assertEquals(2, root.getAllTimeseriesCount(new 
PartialPath("root.laptop.*.s1")));
+      assertEquals(0, root.getAllTimeseriesCount(new 
PartialPath("root.laptop.d1.s3")));
 
       assertEquals(2, root.getNodesCountInGivenLevel(new 
PartialPath("root.laptop"), 2));
       assertEquals(4, root.getNodesCountInGivenLevel(new 
PartialPath("root.laptop"), 3));

Reply via email to