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

[iotdb] branch lmh/AlignedPathGroupDebug created (now 4b18645b46)

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

hui pushed a change to branch lmh/AlignedPathGroupDebug
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 4b18645b46 Fix aligned path group bug

This branch includes the following new commits:

     new cc466fc940 Fix aligned path group bug
     new 4b18645b46 Fix aligned path group bug

The 2 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/02: Fix aligned path group bug

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

hui pushed a commit to branch lmh/AlignedPathGroupDebug
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit cc466fc9405c722873d2ff944b52b36b09718c75
Author: liuminghui233 <54...@qq.com>
AuthorDate: Mon May 30 21:04:48 2022 +0800

    Fix aligned path group bug
---
 .../java/org/apache/iotdb/db/metadata/utils/MetaUtils.java   | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java b/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java
index 96189b8551..5c2c4ff3b5 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java
@@ -73,21 +73,23 @@ public class MetaUtils {
    */
   public static List<PartialPath> groupAlignedPaths(List<PartialPath> fullPaths) {
     List<PartialPath> result = new LinkedList<>();
-    AlignedPath alignedPath = null;
+    Map<String, AlignedPath> deviceToAlignedPathMap = new HashMap<>();
     for (PartialPath path : fullPaths) {
       MeasurementPath measurementPath = (MeasurementPath) path;
       if (!measurementPath.isUnderAlignedEntity()) {
         result.add(measurementPath);
-        alignedPath = null;
       } else {
-        if (alignedPath == null || !alignedPath.equals(measurementPath.getDevice())) {
-          alignedPath = new AlignedPath(measurementPath);
-          result.add(alignedPath);
+        String deviceName = measurementPath.getDevice();
+        if (!deviceToAlignedPathMap.containsKey(deviceName)) {
+          AlignedPath alignedPath = new AlignedPath(measurementPath);
+          deviceToAlignedPathMap.put(deviceName, alignedPath);
         } else {
+          AlignedPath alignedPath = deviceToAlignedPathMap.get(deviceName);
           alignedPath.addMeasurement(measurementPath);
         }
       }
     }
+    result.addAll(deviceToAlignedPathMap.values());
     return result;
   }
 


[iotdb] 02/02: Fix aligned path group bug

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

hui pushed a commit to branch lmh/AlignedPathGroupDebug
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 4b18645b4678e7bfa8426ac1cb582aa6dd8b19f6
Author: liuminghui233 <54...@qq.com>
AuthorDate: Mon May 30 21:05:03 2022 +0800

    Fix aligned path group bug
---
 server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java b/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java
index 5c2c4ff3b5..2a3ccc98f0 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaUtils.java
@@ -72,7 +72,7 @@ public class MetaUtils {
    *     vector1 (s1,s2) would be returned once.
    */
   public static List<PartialPath> groupAlignedPaths(List<PartialPath> fullPaths) {
-    List<PartialPath> result = new LinkedList<>();
+    List<PartialPath> result = new ArrayList<>();
     Map<String, AlignedPath> deviceToAlignedPathMap = new HashMap<>();
     for (PartialPath path : fullPaths) {
       MeasurementPath measurementPath = (MeasurementPath) path;