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 2021/09/06 03:28:58 UTC

[iotdb] 02/02: Fix bug

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

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

commit eeaa9f88d5ad02339a5b5de95062516bd94ee008
Author: Alima777 <wx...@gmail.com>
AuthorDate: Mon Sep 6 11:28:21 2021 +0800

    Fix bug
---
 .../java/org/apache/iotdb/db/metadata/MTree.java   | 70 +++++++++++-----------
 1 file changed, 36 insertions(+), 34 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 2ba23c0..27c43e1 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
@@ -1271,29 +1271,30 @@ public class MTree implements Serializable {
       QueryContext queryContext,
       Template upperTemplate)
       throws MetadataException {
-    if (curNode instanceof MeasurementMNode
-        // For example: nodes: [root, sg, d1, s1, ss1], mTree: root.sg.d1.s1
-        // node: root.sg.d1.s1, childIndex = 4 < length, will not be chosen
-        && (nodes.length <= childIndex
-            || ((MeasurementMNode) curNode).getSchema() instanceof VectorMeasurementSchema)) {
-      if (hasLimit) {
-        curOffset.set(curOffset.get() + 1);
-        if (curOffset.get() < offset.get() || count.get().intValue() == limit.get().intValue()) {
-          return;
+    if (curNode.isMeasurement()) {
+      // For example: nodes: [root, sg, d1, s1, ss1], mTree: root.sg.d1.s1
+      // node: root.sg.d1.s1, childIndex = 4 < length, will not be chosen
+      if (nodes.length <= childIndex
+          || ((MeasurementMNode) curNode).getSchema() instanceof VectorMeasurementSchema) {
+        if (hasLimit) {
+          curOffset.set(curOffset.get() + 1);
+          if (curOffset.get() < offset.get() || count.get().intValue() == limit.get().intValue()) {
+            return;
+          }
+        }
+        MeasurementMNode measurementMNode = (MeasurementMNode) curNode;
+        IMeasurementSchema measurementSchema = measurementMNode.getSchema();
+
+        if (measurementSchema instanceof MeasurementSchema) {
+          timeseriesSchemaList.add(getTimeseriesInfo(measurementMNode, needLast, queryContext));
+        } else if (measurementSchema instanceof VectorMeasurementSchema) {
+          String nextNode = MetaUtils.getNodeRegByIdx(childIndex, nodes);
+          timeseriesSchemaList.addAll(
+              getVectorTimeseriesInfo(measurementMNode, needLast, queryContext, nextNode));
+        }
+        if (hasLimit) {
+          count.set(count.get() + 1);
         }
-      }
-      MeasurementMNode measurementMNode = (MeasurementMNode) curNode;
-      IMeasurementSchema measurementSchema = measurementMNode.getSchema();
-
-      if (measurementSchema instanceof MeasurementSchema) {
-        timeseriesSchemaList.add(getTimeseriesInfo(measurementMNode, needLast, queryContext));
-      } else if (measurementSchema instanceof VectorMeasurementSchema) {
-        String nextNode = MetaUtils.getNodeRegByIdx(childIndex, nodes);
-        timeseriesSchemaList.addAll(
-            getVectorTimeseriesInfo(measurementMNode, needLast, queryContext, nextNode));
-      }
-      if (hasLimit) {
-        count.set(count.get() + 1);
       }
       return;
     }
@@ -1385,18 +1386,19 @@ public class MTree implements Serializable {
       List<PartialPath> pathList,
       Template upperTemplate)
       throws MetadataException {
-    if (curNode instanceof MeasurementMNode
-        // For example: nodes: [root, sg, d1, s1, ss1], mtree: root.sg.d1.s1
-        // node: root.sg.d1.s1, idx = 4 < length, will not be chosen
-        && (nodes.length <= childIndex
-            || ((MeasurementMNode) curNode).getSchema() instanceof VectorMeasurementSchema)) {
-      MeasurementMNode measurementMNode = (MeasurementMNode) curNode;
-      IMeasurementSchema measurementSchema = ((MeasurementMNode) curNode).getSchema();
-      if (measurementSchema instanceof MeasurementSchema) {
-        pathList.add(curNode.getPartialPath());
-      } else if (measurementSchema instanceof VectorMeasurementSchema) {
-        String nextNode = MetaUtils.getNodeRegByIdx(childIndex, nodes);
-        pathList.addAll(getVectorMeasurementPaths(measurementMNode, nextNode));
+    if (curNode.isMeasurement()) {
+      // For example: nodes: [root, sg, d1, s1, ss1], mtree: root.sg.d1.s1
+      // node: root.sg.d1.s1, idx = 4 < length, will not be chosen
+      if (nodes.length <= childIndex
+          || ((MeasurementMNode) curNode).getSchema() instanceof VectorMeasurementSchema) {
+        MeasurementMNode measurementMNode = (MeasurementMNode) curNode;
+        IMeasurementSchema measurementSchema = ((MeasurementMNode) curNode).getSchema();
+        if (measurementSchema instanceof MeasurementSchema) {
+          pathList.add(curNode.getPartialPath());
+        } else if (measurementSchema instanceof VectorMeasurementSchema) {
+          String nextNode = MetaUtils.getNodeRegByIdx(childIndex, nodes);
+          pathList.addAll(getVectorMeasurementPaths(measurementMNode, nextNode));
+        }
       }
       return;
     }