You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ge...@apache.org on 2020/04/12 03:44:10 UTC

[incubator-iotdb] 02/02: update physical plan.

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

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

commit a5c38d687c00c2a9cf9b5e9fceee07a5a7076f39
Author: zhutianci <zh...@gmail.com>
AuthorDate: Sun Apr 12 11:43:50 2020 +0800

    update physical plan.
---
 .../apache/iotdb/db/qp/executor/PlanExecutor.java  |  2 +-
 .../db/qp/physical/sys/CreateTimeSeriesPlan.java   | 36 +++++++++++++++++-----
 .../iotdb/db/qp/strategy/LogicalGenerator.java     | 14 ++++++---
 .../iotdb/db/qp/strategy/PhysicalGenerator.java    |  3 +-
 4 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
index f2d45e2..efec48a 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/executor/PlanExecutor.java
@@ -885,7 +885,7 @@ public class PlanExecutor implements IPlanExecutor {
     TSDataType dataType = createTimeSeriesPlan.getDataType();
     CompressionType compressor = createTimeSeriesPlan.getCompressor();
     TSEncoding encoding = createTimeSeriesPlan.getEncoding();
-    Map<String, String> props = createTimeSeriesPlan.getProps();
+    Map<String, String> props = createTimeSeriesPlan.getAttributes();
     try {
       mManager.createTimeseries(path.getFullPath(), dataType, encoding, compressor, props);
     } catch (MetadataException e) {
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateTimeSeriesPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateTimeSeriesPlan.java
index 7e35ff9..2980aed 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateTimeSeriesPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateTimeSeriesPlan.java
@@ -38,7 +38,9 @@ public class CreateTimeSeriesPlan extends PhysicalPlan {
   private TSDataType dataType;
   private TSEncoding encoding;
   private CompressionType compressor;
-  private Map<String, String> props;
+  private String alias;
+  private Map<String, String> attributes;
+  private Map<String, String> tags;
 
   public CreateTimeSeriesPlan() {
     super(false, Operator.OperatorType.CREATE_TIMESERIES);
@@ -46,13 +48,15 @@ public class CreateTimeSeriesPlan extends PhysicalPlan {
   }
 
   public CreateTimeSeriesPlan(Path path, TSDataType dataType, TSEncoding encoding,
-      CompressionType compressor, Map<String, String> props) {
+      CompressionType compressor, Map<String, String> attributes, Map<String, String> tags, String alias) {
     super(false, Operator.OperatorType.CREATE_TIMESERIES);
     this.path = path;
     this.dataType = dataType;
     this.encoding = encoding;
     this.compressor = compressor;
-    this.props = props;
+    this.attributes = attributes;
+    this.tags = tags;
+    this.alias = alias;
     canbeSplit = false;
   }
   
@@ -88,14 +92,30 @@ public class CreateTimeSeriesPlan extends PhysicalPlan {
     this.encoding = encoding;
   }
   
-  public Map<String, String> getProps() {
-    return props;
+  public Map<String, String> getAttributes() {
+    return attributes;
   }
 
-  public void setProps(Map<String, String> props) {
-    this.props = props;
+  public void setAttributes(Map<String, String> attributes) {
+    this.attributes = attributes;
   }
-  
+
+  public String getAlias() {
+    return alias;
+  }
+
+  public void setAlias(String alias) {
+    this.alias = alias;
+  }
+
+  public Map<String, String> getTags() {
+    return tags;
+  }
+
+  public void setTags(Map<String, String> tags) {
+    this.tags = tags;
+  }
+
   @Override
   public String toString() {
     return String.format("seriesPath: %s, resultDataType: %s, encoding: %s, compression: %s", path,
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
index ad07198..caa9785 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
@@ -913,11 +913,14 @@ public class LogicalGenerator extends SqlBaseBaseListener {
   public void enterAttributeClause(AttributeClauseContext ctx) {
     super.enterAttributeClause(ctx);
     List<PropertyContext> attributesList = ctx.property();
+    String value = "";
     Map<String, String> attributes = new HashMap<>(attributesList.size(), 1);
     if (ctx.property(0) != null) {
       for (PropertyContext property : attributesList) {
-        attributes.put(property.ID().getText().toLowerCase(),
-            property.propertyValue().getText().toLowerCase());
+        if(property.propertyValue().STRING_LITERAL() != null) {
+          value = removeStringQuote(property.propertyValue().getText().toLowerCase());
+        }
+        attributes.put(property.ID().getText().toLowerCase(), value);
       }
     }
     createTimeSeriesOperator.setAttributes(attributes);
@@ -927,11 +930,14 @@ public class LogicalGenerator extends SqlBaseBaseListener {
   public void enterTagClause(TagClauseContext ctx) {
     super.enterTagClause(ctx);
     List<PropertyContext> tagsList = ctx.property();
+    String value = "";
     Map<String, String> tags = new HashMap<>(tagsList.size(), 1);
     if (ctx.property(0) != null) {
       for (PropertyContext property : tagsList) {
-        tags.put(property.ID().getText().toLowerCase(),
-            property.propertyValue().getText().toLowerCase());
+        if(property.propertyValue().STRING_LITERAL() != null) {
+          value = removeStringQuote(property.propertyValue().getText().toLowerCase());
+        }
+        tags.put(property.ID().getText().toLowerCase(), value);
       }
     }
     createTimeSeriesOperator.setTags(tags);
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
index 04b1fc3..8206025 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/PhysicalGenerator.java
@@ -77,7 +77,8 @@ public class PhysicalGenerator {
       case CREATE_TIMESERIES:
         CreateTimeSeriesOperator addPath = (CreateTimeSeriesOperator) operator;
         return new CreateTimeSeriesPlan(addPath.getPath(), addPath.getDataType(),
-            addPath.getEncoding(), addPath.getCompressor(), addPath.getAttributes());
+            addPath.getEncoding(), addPath.getCompressor(), addPath.getAttributes(),
+            addPath.getTags(), addPath.getAlias());
       case DELETE_TIMESERIES:
         DeleteTimeSeriesOperator deletePath = (DeleteTimeSeriesOperator) operator;
         return new DeleteTimeSeriesPlan(deletePath.getDeletePathList());