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:15:57 UTC
[iotdb] 01/01: [IoTDB-1331] Add transformPath for CMManger
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 26256ccc0697bdd528189ec9ded87c14f55093f1
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 | 14 ++++++++++++++
.../main/java/org/apache/iotdb/db/metadata/MManager.java | 15 ++++++++++-----
2 files changed, 24 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..41656f9 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,19 @@ 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.
+ */
+ 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.