You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2019/06/06 01:35:09 UTC
[incubator-iotdb] 01/01: simplify Path construction
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch f_construct_path
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit a7c02215bcf6239b2638105843e03fbfc5b363b3
Author: qiaojialin <64...@qq.com>
AuthorDate: Thu Jun 6 09:34:55 2019 +0800
simplify Path construction
---
.../java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java | 2 +-
.../main/java/org/apache/iotdb/tsfile/read/common/Path.java | 11 ++++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java b/iotdb/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java
index cdb519c..b350cce 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertPlan.java
@@ -70,7 +70,7 @@ public class InsertPlan extends PhysicalPlan {
List<Path> ret = new ArrayList<>();
for (String m : measurements) {
- ret.add(new Path(deviceId + "." + m));
+ ret.add(new Path(deviceId, m));
}
return ret;
}
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/Path.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/Path.java
index 54d9f73..3d448d7 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/Path.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/common/Path.java
@@ -65,13 +65,18 @@ public class Path implements Serializable {
init(splits);
}
+ /**
+ * construct a Path directly using device and measurement, no need to reformat the path
+ * @param device root.deviceType.d1
+ * @param measurement s1 , does not contain SystemConstant.PATH_SEPARATOR
+ */
public Path(String device, String measurement) {
if (device == null || measurement == null) {
throw new IllegalArgumentException(illegalPathArgument);
}
- String[] splits = (device + SystemConstant.PATH_SEPARATOR + measurement)
- .split(SystemConstant.PATH_SEPARATER_NO_REGEX);
- init(splits);
+ this.device = device;
+ this.measurement = measurement;
+ this.fullPath = device + SystemConstant.PATH_SEPARATOR + measurement;
}
public static Path mergePath(Path prefix, Path suffix) {