You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2019/10/29 06:20:12 UTC

[GitHub] [incubator-iotdb] Ring-k commented on a change in pull request #482: implement quoted path

Ring-k commented on a change in pull request #482: implement quoted path
URL: https://github.com/apache/incubator-iotdb/pull/482#discussion_r339907965
 
 

 ##########
 File path: server/src/main/java/org/apache/iotdb/db/metadata/MGraph.java
 ##########
 @@ -81,12 +81,33 @@ public void addPathToMTree(String path, String dataType, String encoding)
    */
   public void addPathToMTree(String path, TSDataType dataType, TSEncoding encoding,
       CompressionType compressor, Map<String, String> props) throws PathErrorException {
-    String[] nodes = path.trim().split(DOUB_SEPARATOR);
+    String[] nodes = getNodeNames(path);
     if (nodes.length == 0) {
       throw new PathErrorException("Timeseries is null");
     }
     mtree.addTimeseriesPath(path, dataType, encoding, compressor, props);
   }
+  private String[] getNodeNames(String path) {
+    String[] nodeNames;
+    path = path.trim();
+    if(path.contains("\"") || path.contains("\'")){
+      String[] deviceAndMeasurement;
+      if(path.contains("\"")){
+        deviceAndMeasurement = path.split("\"");
+      }else {
+        deviceAndMeasurement = path.split("\'");
+      }
+      String device = deviceAndMeasurement[0];
+      String measurement = deviceAndMeasurement[1];
+      int nodeNumber = device.split(DOUB_SEPARATOR).length + 1;
+      nodeNames = new String[nodeNumber];
+      System.arraycopy(device.split(DOUB_SEPARATOR), 0, nodeNames, 0, nodeNumber - 1);
+      nodeNames[nodeNumber - 1] = measurement;
+    }else{
+      nodeNames = path.split(DOUB_SEPARATOR);
+    }
 
 Review comment:
   The quotes are only used in measurement name, which is in the last level. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services