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 2020/01/13 09:22:05 UTC

[incubator-iotdb] branch master updated: avoid using String when constructing Path in autoCreateSchema (#734)

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

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 178f244  avoid using String when constructing Path in autoCreateSchema (#734)
178f244 is described below

commit 178f2449f86a7246651c69f2c1530a1bb34fdab9
Author: Jialin Qiao <qj...@mails.tsinghua.edu.cn>
AuthorDate: Mon Jan 13 17:21:57 2020 +0800

    avoid using String when constructing Path in autoCreateSchema (#734)
---
 .../iotdb/db/qp/executor/QueryProcessExecutor.java | 29 ++++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java b/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
index f2586bf..c5c4db3 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
@@ -847,11 +847,11 @@ public class QueryProcessExecutor extends AbstractQueryProcessExecutor {
   private void addPathToMTree(String deviceId, String measurementId, Object value)
       throws PathException, MetadataException, StorageEngineException {
     TSDataType predictedDataType = TypeInferenceUtils.getPredictedDataType(value);
-    String fullPath = deviceId + IoTDBConstant.PATH_SEPARATOR + measurementId;
+    Path path = new Path(deviceId, measurementId);
     TSEncoding encoding = getDefaultEncoding(predictedDataType);
     CompressionType compressionType =
         CompressionType.valueOf(TSFileDescriptor.getInstance().getConfig().getCompressor());
-    addPathToMTree(fullPath, predictedDataType, encoding, compressionType);
+    addPathToMTree(path, predictedDataType, encoding, compressionType);
   }
 
   /**
@@ -859,24 +859,37 @@ public class QueryProcessExecutor extends AbstractQueryProcessExecutor {
    */
   private void addPathToMTree(String deviceId, String measurementId, TSDataType dataType)
       throws PathException, MetadataException, StorageEngineException {
-    String fullPath = deviceId + IoTDBConstant.PATH_SEPARATOR + measurementId;
+    Path path = new Path(deviceId, measurementId);
     TSEncoding encoding = getDefaultEncoding(dataType);
     CompressionType compressionType =
         CompressionType.valueOf(TSFileDescriptor.getInstance().getConfig().getCompressor());
-    addPathToMTree(fullPath, dataType, encoding, compressionType);
+    addPathToMTree(path, dataType, encoding, compressionType);
   }
 
   /**
    * Add a seriesPath to MTree, register with datatype, encoding and compression
    */
-  private void addPathToMTree(String fullPath, TSDataType dataType, TSEncoding encoding,
+  private void addPathToMTree(Path path, TSDataType dataType, TSEncoding encoding,
       CompressionType compressionType)
       throws PathException, MetadataException, StorageEngineException {
     boolean result = mManager.addPathToMTree(
-        fullPath, dataType, encoding, compressionType, Collections.emptyMap());
+        path, dataType, encoding, compressionType, Collections.emptyMap());
     if (result) {
-      storageEngine.addTimeSeries(
-          new Path(fullPath), dataType, encoding, compressionType, Collections.emptyMap());
+      storageEngine.addTimeSeries(path, dataType, encoding, compressionType, Collections.emptyMap());
+    }
+  }
+
+  /**
+   * Add a seriesPath to MTree, register with datatype, encoding and compression
+   */
+  private void addPathToMTree(String path, TSDataType dataType, TSEncoding encoding,
+      CompressionType compressionType)
+      throws PathException, MetadataException, StorageEngineException {
+    boolean result = mManager.addPathToMTree(
+        path, dataType, encoding, compressionType, Collections.emptyMap());
+    if (result) {
+      storageEngine.addTimeSeries(new Path(path),
+          dataType, encoding, compressionType, Collections.emptyMap());
     }
   }