You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2021/04/29 07:18:57 UTC

[iotdb] branch PR1331 updated (26256cc -> 5fa0eb2)

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

jincheng pushed a change to branch PR1331
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


 discard 26256cc  [IoTDB-1331] Add transformPath for CMManger
     new 5fa0eb2  [IoTDB-1331] Add transformPath for CMManger

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (26256cc)
            \
             N -- N -- N   refs/heads/PR1331 (5fa0eb2)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 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.


Summary of changes:
 cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java | 1 +
 1 file changed, 1 insertion(+)

[iotdb] 01/01: [IoTDB-1331] Add transformPath for CMManger

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

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

commit 5fa0eb293df62734555d59fcc97122e4dfa3a5fd
Author: Jincheng Sun <su...@gmail.com>
AuthorDate: Thu Apr 29 15:14:55 2021 +0800

    [IoTDB-1331] Add transformPath for CMManger
---
 .../java/org/apache/iotdb/cluster/metadata/CMManager.java | 15 +++++++++++++++
 .../main/java/org/apache/iotdb/db/metadata/MManager.java  | 15 ++++++++++-----
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java b/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
index 3524db8..7849f0e 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
@@ -81,6 +81,7 @@ import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
 import org.apache.iotdb.tsfile.read.TimeValuePair;
 import org.apache.iotdb.tsfile.utils.Pair;
 import org.apache.iotdb.tsfile.write.schema.IMeasurementSchema;
+import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
 import org.apache.iotdb.tsfile.write.schema.TimeseriesSchema;
 import org.apache.iotdb.tsfile.write.schema.VectorMeasurementSchema;
 
@@ -265,6 +266,20 @@ public class CMManager extends MManager {
     return super.getSeriesSchema(fullPath, getMeasurementMNode(fullPath));
   }
 
+  /**
+   * Transform the PartialPath to VectorPartialPath if it is a sub sensor of one vector. otherwise,
+   * we don't change it.
+   */
+  @Override
+  public PartialPath transformPath(PartialPath partialPath) throws MetadataException {
+    MeasurementMNode node = getMeasurementMNode(partialPath);
+    if (node.getSchema() instanceof MeasurementSchema) {
+      return partialPath;
+    } else {
+      return toVectorPath(partialPath, node.getName());
+    }
+  }
+
   private MeasurementMNode getMeasurementMNode(PartialPath fullPath) throws MetadataException {
     MeasurementMNode node = null;
     // try remote cache first
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
index 5e35f82..e03b1ba 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
@@ -1190,7 +1190,7 @@ public class MManager {
   }
 
   /**
-   * transform the PartialPath to VectorPartialPath if it is a sub sensor of one vector otherwise,
+   * Transform the PartialPath to VectorPartialPath if it is a sub sensor of one vector. otherwise,
    * we don't change it.
    */
   public PartialPath transformPath(PartialPath partialPath) throws MetadataException {
@@ -1198,13 +1198,18 @@ public class MManager {
     if (node.getSchema() instanceof MeasurementSchema) {
       return partialPath;
     } else {
-      List<PartialPath> subSensorsPathList = new ArrayList<>();
-      subSensorsPathList.add(partialPath);
-      return new VectorPartialPath(
-          partialPath.getDevice() + "." + node.getName(), subSensorsPathList);
+      return toVectorPath(partialPath, node.getName());
     }
   }
 
+  /** Convert the PartialPath to VectorPartialPath. */
+  protected VectorPartialPath toVectorPath(PartialPath partialPath, String name)
+      throws MetadataException {
+    List<PartialPath> subSensorsPathList = new ArrayList<>();
+    subSensorsPathList.add(partialPath);
+    return new VectorPartialPath(partialPath.getDevice() + "." + name, subSensorsPathList);
+  }
+
   /**
    * Get schema of partialPaths, in which aligned timeseries should only organized to one schema.
    * This method should be called when logical plan converts to physical plan.