Alima777 commented on a change in pull request #2389:
URL: https://github.com/apache/iotdb/pull/2389#discussion_r550384655



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -1134,16 +1160,25 @@ private void findChildNodePathInNextLevel(
    * @param res   store all matched device names
    */
   @SuppressWarnings("squid:S3776")
-  private void findDevices(MNode node, String[] nodes, int idx, 
Set<PartialPath> res) {
+  private void findDevices(MNode node, String[] nodes, int idx, 
Set<PartialPath> res, boolean hasLimit) {
     String nodeReg = MetaUtils.getNodeRegByIdx(idx, nodes);
     // the node path doesn't contains '*'
     if (!nodeReg.contains(PATH_WILDCARD)) {
       MNode next = node.getChild(nodeReg);
       if (next != null) {
         if (next instanceof MeasurementMNode && idx >= nodes.length) {
+          if (hasLimit) {
+            curOffset.set(curOffset.get() + 1);
+            if (curOffset.get() < offset.get() || count.get().intValue() == 
limit.get().intValue()) {
+              return;
+            }
+          }
           res.add(node.getPartialPath());
+          if (hasLimit) {
+            count.set(count.get() + 1);
+          }

Review comment:
       ```suggestion
             if (hasLimit) {
               curOffset.set(curOffset.get() + 1);
               if (curOffset.get() < offset.get() || count.get().intValue() == 
limit.get().intValue()) {
                 return;
               }
               count.set(count.get() + 1);
             }
             res.add(node.getPartialPath());
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -1155,10 +1190,19 @@ private void findDevices(MNode node, String[] nodes, 
int idx, Set<PartialPath> r
           continue;
         }
         if (child instanceof MeasurementMNode && !deviceAdded && idx >= 
nodes.length) {
+          if (hasLimit) {
+            curOffset.set(curOffset.get() + 1);
+            if (curOffset.get() < offset.get() || count.get().intValue() == 
limit.get().intValue()) {
+              return;
+            }
+          }
           res.add(node.getPartialPath());
+          if (hasLimit) {
+            count.set(count.get() + 1);
+          }

Review comment:
       The same.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to