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:43 UTC
[iotdb] 01/02: Fix aligned path group bug
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;
}