You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2021/11/17 02:53:28 UTC

[iotdb] branch master updated: [IOTDB-1233] Support SQL of aligned timeseries and schema template (#4310)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 96df186  [IOTDB-1233] Support SQL of aligned timeseries and schema template (#4310)
96df186 is described below

commit 96df1861643aa7f8f72d1bb276569d0eb68ee901
Author: liuminghui233 <36...@users.noreply.github.com>
AuthorDate: Wed Nov 17 10:52:55 2021 +0800

    [IOTDB-1233] Support SQL of aligned timeseries and schema template (#4310)
---
 .../org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4    |   8 +
 .../org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4   |  70 +++++--
 .../iotdb/cluster/coordinator/Coordinator.java     |   8 +-
 .../apache/iotdb/cluster/metadata/CMManager.java   |  21 +-
 .../apache/iotdb/cluster/utils/PartitionUtils.java |  10 +-
 .../log/snapshot/MetaSimpleSnapshotTest.java       |   2 +-
 .../cluster/server/member/MetaGroupMemberTest.java |   2 +-
 .../cluster/utils/CreateTemplatePlanUtil.java      |   2 +-
 docs/UserGuide/Appendix/SQL-Reference.md           |  89 +++++++--
 .../Data-Concept/Data-Model-and-Terminology.md     |  32 +--
 ...{Measurement-Template.md => Schema-Template.md} |  20 +-
 .../DDL-Data-Definition-Language.md                |  75 +++++--
 docs/zh/UserGuide/Appendix/SQL-Reference.md        |  87 ++++++--
 .../Data-Concept/Data-Model-and-Terminology.md     |  30 ++-
 ...{Measurement-Template.md => Schema-Template.md} |   2 +-
 .../DDL-Data-Definition-Language.md                |  72 +++++--
 .../iotdb/AlignedTimeseriesSessionExample.java     |   9 +-
 .../org/apache/iotdb/db/metadata/MManager.java     |  56 +++---
 .../iotdb/db/metadata/logfile/MLogTxtWriter.java   |  19 +-
 .../iotdb/db/metadata/logfile/MLogWriter.java      |  18 +-
 .../org/apache/iotdb/db/metadata/mtree/MTree.java  |   6 +-
 .../iotdb/db/metadata/template/Template.java       |   2 +-
 .../db/metadata/template/TemplateManager.java      |   6 +-
 .../apache/iotdb/db/qp/constant/SQLConstant.java   |  10 +
 .../apache/iotdb/db/qp/executor/PlanExecutor.java  |  51 +++--
 .../org/apache/iotdb/db/qp/logical/Operator.java   |   6 +-
 .../iotdb/db/qp/logical/crud/InsertOperator.java   |  21 +-
 .../qp/logical/sys/ActivateTemplateOperator.java   |  51 +++++
 .../sys/CreateAlignedTimeSeriesOperator.java       | 131 ++++++++++++
 .../db/qp/logical/sys/CreateTemplateOperator.java  | 122 ++++++++++++
 .../db/qp/logical/sys/SetTemplateOperator.java     |  60 ++++++
 .../db/qp/logical/sys/UnsetTemplateOperator.java   |  60 ++++++
 .../apache/iotdb/db/qp/physical/PhysicalPlan.java  |  24 +--
 ...TemplatePlan.java => ActivateTemplatePlan.java} |  16 +-
 .../physical/{crud => sys}/AppendTemplatePlan.java |   2 +-
 .../physical/sys/CreateAlignedTimeSeriesPlan.java  |  35 ++--
 .../physical/{crud => sys}/CreateTemplatePlan.java |   2 +-
 .../physical/{crud => sys}/PruneTemplatePlan.java  |   2 +-
 .../SetTemplatePlan.java}                          |  16 +-
 .../UnsetTemplatePlan.java}                        |  16 +-
 .../apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java    | 219 +++++++++++++++++++--
 .../org/apache/iotdb/db/service/TSServiceImpl.java |  22 ++-
 .../org/apache/iotdb/db/tools/mlog/MLogParser.java |  21 +-
 .../IoTDBCreateAlignedTimeseriesIT.java            | 106 ++++++++++
 .../db/integration/IoTDBSchemaTemplateIT.java      | 177 +++++++++++++++++
 .../iotdb/db/metadata/MManagerBasicTest.java       |  82 ++++----
 .../org/apache/iotdb/db/metadata/TemplateTest.java |   9 +-
 .../iotdb/db/metadata/mlog/MLogUpgraderTest.java   |   2 +-
 .../iotdb/db/qp/physical/InsertRowPlanTest.java    |   6 +-
 .../db/qp/physical/PhysicalPlanSerializeTest.java  |   2 +-
 .../org/apache/iotdb/db/tools/MLogParserTest.java  |  17 +-
 .../java/org/apache/iotdb/session/Session.java     |   9 +-
 .../apache/iotdb/session/IoTDBSessionSimpleIT.java |   2 +-
 .../session/IoTDBSessionVectorABDeviceIT.java      |   4 +-
 .../IoTDBSessionVectorAggregationWithUnSeqIT.java  |   4 +-
 .../apache/iotdb/session/template/TemplateUT.java  |   2 +-
 thrift/rpc-changelist.md                           |   4 +-
 thrift/src/main/thrift/rpc.thrift                  |   2 +-
 58 files changed, 1560 insertions(+), 401 deletions(-)

diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4
index 06d70dc..fdcd67f 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlLexer.g4
@@ -51,6 +51,10 @@ ALIGN
     : A L I G N
     ;
 
+ALIGNED
+    : A L I G N E D
+    ;
+
 ALL
     : A L L
     ;
@@ -468,6 +472,10 @@ TASK
     : T A S K
     ;
 
+TEMPLATE
+    : T E M P L A T E
+    ;
+
 TIME
     : T I M E
     ;
diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
index 3324759..e3d9449 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
@@ -36,10 +36,11 @@ statement
 
 ddlStatement
     : setStorageGroup | createStorageGroup | createTimeseries
+    | createSchemaTemplate | createTimeseriesOfSchemaTemplate
     | createFunction | createTrigger | createContinuousQuery | createSnapshot
     | alterTimeseries | deleteStorageGroup | deleteTimeseries | deletePartition
-    | dropFunction | dropTrigger | dropContinuousQuery
-    | setTTL | unsetTTL | startTrigger | stopTrigger
+    | dropFunction | dropTrigger | dropContinuousQuery | setTTL | unsetTTL
+    | setSchemaTemplate | unsetSchemaTemplate | startTrigger | stopTrigger
     | showStorageGroup | showDevices | showTimeseries | showChildPaths | showChildNodes
     | showFunctions | showTriggers | showContinuousQueries | showTTL | showAllTTL
     | countStorageGroup | countDevices | countTimeseries | countNodes
@@ -77,20 +78,30 @@ createStorageGroup
 
 // Create Timeseries
 createTimeseries
-    : CREATE TIMESERIES fullPath alias? WITH attributeClauses
+    : CREATE ALIGNED TIMESERIES fullPath alignedMeasurements? #createAlignedTimeseries
+    | CREATE TIMESERIES fullPath attributeClauses  #createNonAlignedTimeseries
     ;
 
-alias
-    : LR_BRACKET ID RR_BRACKET
+alignedMeasurements
+    : LR_BRACKET nodeNameWithoutWildcard attributeClauses
+    (COMMA nodeNameWithoutWildcard attributeClauses)+ RR_BRACKET
     ;
 
-attributeClauses
-    : DATATYPE OPERATOR_EQ dataType=DATATYPE_VALUE
-    (COMMA ENCODING OPERATOR_EQ encoding=ENCODING_VALUE)?
-    (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ compressor=COMPRESSOR_VALUE)?
-    (COMMA propertyClause)*
-    tagClause?
-    attributeClause?
+// Create Schema Template
+createSchemaTemplate
+    : CREATE SCHEMA TEMPLATE templateName=ID
+    LR_BRACKET templateMeasurementClause (COMMA templateMeasurementClause)* RR_BRACKET
+    ;
+
+templateMeasurementClause
+    : nodeNameWithoutWildcard attributeClauses #nonAlignedTemplateMeasurement
+    | alignedDevice=nodeNameWithoutWildcard LR_BRACKET nodeNameWithoutWildcard attributeClauses
+    (COMMA nodeNameWithoutWildcard attributeClauses)+ RR_BRACKET  #alignedTemplateMeasurement
+    ;
+
+// Create Timeseries Of Schema Template
+createTimeseriesOfSchemaTemplate
+    : CREATE TIMESERIES OF SCHEMA TEMPLATE ON prefixPath
     ;
 
 // Create Function
@@ -195,6 +206,16 @@ unsetTTL
     : UNSET TTL TO path=prefixPath
     ;
 
+// Set Schema Template
+setSchemaTemplate
+    : SET SCHEMA TEMPLATE templateName=ID TO prefixPath
+    ;
+
+// Unset Schema Template
+unsetSchemaTemplate
+    : UNSET SCHEMA TEMPLATE templateName=ID FROM prefixPath
+    ;
+
 // Start Trigger
 startTrigger
     : START TRIGGER triggerName=ID
@@ -391,7 +412,7 @@ timeValue
 
 // Insert Statement
 insertStatement
-    : INSERT INTO prefixPath insertColumnsSpec VALUES insertValuesSpec
+    : INSERT INTO prefixPath insertColumnsSpec ALIGNED? VALUES insertValuesSpec
     ;
 
 insertColumnsSpec
@@ -795,7 +816,27 @@ fromClause
     ;
 
 
-// Tag & Property Clause
+// Attribute Clause
+
+attributeClauses
+    : alias? WITH DATATYPE OPERATOR_EQ dataType=DATATYPE_VALUE
+    (COMMA ENCODING OPERATOR_EQ encoding=ENCODING_VALUE)?
+    (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ compressor=COMPRESSOR_VALUE)?
+    (COMMA propertyClause)*
+    tagClause?
+    attributeClause?
+    // Simplified version (supported since v0.13)
+    | alias? dataType=DATATYPE_VALUE
+    (ENCODING OPERATOR_EQ encoding=ENCODING_VALUE)?
+    ((COMPRESSOR | COMPRESSION) OPERATOR_EQ compressor=COMPRESSOR_VALUE)?
+    propertyClause*
+    tagClause?
+    attributeClause?
+    ;
+
+alias
+    : LR_BRACKET ID RR_BRACKET
+    ;
 
 tagClause
     : TAGS LR_BRACKET propertyClause (COMMA propertyClause)* RR_BRACKET
@@ -816,7 +857,6 @@ attributeClause
     : ATTRIBUTES LR_BRACKET propertyClause (COMMA propertyClause)* RR_BRACKET
     ;
 
-
 // Limit & Offset Clause
 
 limitClause
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/coordinator/Coordinator.java b/cluster/src/main/java/org/apache/iotdb/cluster/coordinator/Coordinator.java
index f5c84d6..098b127 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/coordinator/Coordinator.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/coordinator/Coordinator.java
@@ -51,11 +51,11 @@ import org.apache.iotdb.db.qp.physical.crud.InsertMultiTabletPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowsPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateMultiTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteTimeSeriesPlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.utils.TestOnly;
 import org.apache.iotdb.rpc.RpcUtils;
@@ -207,10 +207,10 @@ public class Coordinator {
 
   public void createSchemaIfNecessary(PhysicalPlan plan)
       throws MetadataException, CheckConsistencyException {
-    if (plan instanceof SetSchemaTemplatePlan) {
+    if (plan instanceof SetTemplatePlan) {
       try {
         IoTDB.metaManager.getBelongedStorageGroup(
-            new PartialPath(((SetSchemaTemplatePlan) plan).getPrefixPath()));
+            new PartialPath(((SetTemplatePlan) plan).getPrefixPath()));
       } catch (IllegalPathException e) {
         // the plan has been checked
       } catch (StorageGroupNotSetException e) {
@@ -316,7 +316,7 @@ public class Coordinator {
             status);
       }
       if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()
-          && !(plan instanceof SetSchemaTemplatePlan
+          && !(plan instanceof SetTemplatePlan
               && status.getCode() == TSStatusCode.DUPLICATED_TEMPLATE.getStatusCode())
           && !(plan instanceof DeleteTimeSeriesPlan
               && status.getCode() == TSStatusCode.TIMESERIES_NOT_EXIST.getStatusCode())) {
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 c221efa..70f6ff2 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
@@ -62,11 +62,11 @@ import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowsOfOneDevicePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowsPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateMultiTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowDevicesPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowTimeSeriesPlan;
 import org.apache.iotdb.db.query.context.QueryContext;
@@ -503,11 +503,11 @@ public class CMManager extends MManager {
       storageGroups.addAll(
           getStorageGroups(
               Collections.singletonList(((CreateAlignedTimeSeriesPlan) plan).getPrefixPath())));
-    } else if (plan instanceof SetSchemaTemplatePlan) {
+    } else if (plan instanceof SetTemplatePlan) {
       storageGroups.addAll(
           getStorageGroups(
               Collections.singletonList(
-                  new PartialPath(((SetSchemaTemplatePlan) plan).getPrefixPath()))));
+                  new PartialPath(((SetTemplatePlan) plan).getPrefixPath()))));
     } else {
       storageGroups.addAll(getStorageGroups(plan.getPaths()));
     }
@@ -712,6 +712,7 @@ public class CMManager extends MManager {
 
     List<TSDataType> dataTypes = new ArrayList<>(measurements.size());
     List<TSEncoding> encodings = new ArrayList<>(measurements.size());
+    List<CompressionType> compressors = new ArrayList<>(measurements.size());
     for (int index = 0; index < measurements.size(); index++) {
       TSDataType dataType;
       if (insertPlan.getDataTypes() != null && insertPlan.getDataTypes()[index] != null) {
@@ -726,16 +727,12 @@ public class CMManager extends MManager {
       }
       dataTypes.add(dataType);
       encodings.add(getDefaultEncoding(dataType));
+      compressors.add(TSFileDescriptor.getInstance().getConfig().getCompressor());
     }
 
     CreateAlignedTimeSeriesPlan plan =
         new CreateAlignedTimeSeriesPlan(
-            insertPlan.getDeviceId(),
-            measurements,
-            dataTypes,
-            encodings,
-            TSFileDescriptor.getInstance().getConfig().getCompressor(),
-            null);
+            insertPlan.getDeviceId(), measurements, dataTypes, encodings, compressors, null);
     TSStatus result;
     try {
       result = coordinator.processPartitionedPlan(plan);
@@ -770,7 +767,7 @@ public class CMManager extends MManager {
     List<PartialPath> paths = new ArrayList<>();
     List<TSDataType> dataTypes = new ArrayList<>();
     List<TSEncoding> encodings = new ArrayList<>();
-    List<CompressionType> compressionTypes = new ArrayList<>();
+    List<CompressionType> compressors = new ArrayList<>();
     for (String seriesPath : unregisteredSeriesList) {
       paths.add(new PartialPath(seriesPath));
       int index = seriesList.indexOf(seriesPath);
@@ -789,13 +786,13 @@ public class CMManager extends MManager {
       dataTypes.add(dataType);
       // use default encoding and compression from the config
       encodings.add(getDefaultEncoding(dataType));
-      compressionTypes.add(TSFileDescriptor.getInstance().getConfig().getCompressor());
+      compressors.add(TSFileDescriptor.getInstance().getConfig().getCompressor());
     }
     CreateMultiTimeSeriesPlan plan = new CreateMultiTimeSeriesPlan();
     plan.setPaths(paths);
     plan.setDataTypes(dataTypes);
     plan.setEncodings(encodings);
-    plan.setCompressors(compressionTypes);
+    plan.setCompressors(compressors);
 
     TSStatus result;
     try {
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/utils/PartitionUtils.java b/cluster/src/main/java/org/apache/iotdb/cluster/utils/PartitionUtils.java
index 8b79624..5638ae0 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/utils/PartitionUtils.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/utils/PartitionUtils.java
@@ -23,16 +23,14 @@ import org.apache.iotdb.cluster.partition.PartitionTable;
 import org.apache.iotdb.cluster.rpc.thrift.RaftNode;
 import org.apache.iotdb.db.engine.StorageEngine;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
-import org.apache.iotdb.db.qp.physical.crud.AppendTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
-import org.apache.iotdb.db.qp.physical.crud.PruneTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.AppendTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.AuthorPlan;
 import org.apache.iotdb.db.qp.physical.sys.ClearCachePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateFunctionPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateSnapshotPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.DataAuthPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteTimeSeriesPlan;
@@ -43,9 +41,11 @@ import org.apache.iotdb.db.qp.physical.sys.LoadConfigurationPlan.LoadConfigurati
 import org.apache.iotdb.db.qp.physical.sys.LoadDataPlan;
 import org.apache.iotdb.db.qp.physical.sys.MergePlan;
 import org.apache.iotdb.db.qp.physical.sys.OperateFilePlan;
+import org.apache.iotdb.db.qp.physical.sys.PruneTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetSystemModePlan;
 import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowTTLPlan;
 import org.apache.iotdb.service.rpc.thrift.TSStatus;
 import org.apache.iotdb.tsfile.utils.BitMap;
@@ -117,7 +117,7 @@ public class PartitionUtils {
         || plan instanceof DeleteTimeSeriesPlan
         || plan instanceof MergePlan
         || plan instanceof FlushPlan
-        || plan instanceof SetSchemaTemplatePlan
+        || plan instanceof SetTemplatePlan
         || plan instanceof ClearCachePlan;
   }
 
diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/log/snapshot/MetaSimpleSnapshotTest.java b/cluster/src/test/java/org/apache/iotdb/cluster/log/snapshot/MetaSimpleSnapshotTest.java
index 487a1a6..1c9956f 100644
--- a/cluster/src/test/java/org/apache/iotdb/cluster/log/snapshot/MetaSimpleSnapshotTest.java
+++ b/cluster/src/test/java/org/apache/iotdb/cluster/log/snapshot/MetaSimpleSnapshotTest.java
@@ -36,7 +36,7 @@ import org.apache.iotdb.db.exception.metadata.UndefinedTemplateException;
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.metadata.template.Template;
 import org.apache.iotdb.db.metadata.template.TemplateManager;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.service.IoTDB;
 
 import org.junit.After;
diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/server/member/MetaGroupMemberTest.java b/cluster/src/test/java/org/apache/iotdb/cluster/server/member/MetaGroupMemberTest.java
index 172b200..ecdc609 100644
--- a/cluster/src/test/java/org/apache/iotdb/cluster/server/member/MetaGroupMemberTest.java
+++ b/cluster/src/test/java/org/apache/iotdb/cluster/server/member/MetaGroupMemberTest.java
@@ -97,8 +97,8 @@ import org.apache.iotdb.db.metadata.template.Template;
 import org.apache.iotdb.db.metadata.template.TemplateManager;
 import org.apache.iotdb.db.qp.executor.PlanExecutor;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
 import org.apache.iotdb.db.query.context.QueryContext;
diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/utils/CreateTemplatePlanUtil.java b/cluster/src/test/java/org/apache/iotdb/cluster/utils/CreateTemplatePlanUtil.java
index 3723ffe..d75c2f2 100644
--- a/cluster/src/test/java/org/apache/iotdb/cluster/utils/CreateTemplatePlanUtil.java
+++ b/cluster/src/test/java/org/apache/iotdb/cluster/utils/CreateTemplatePlanUtil.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.cluster.utils;
 
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
diff --git a/docs/UserGuide/Appendix/SQL-Reference.md b/docs/UserGuide/Appendix/SQL-Reference.md
index 5eb35a2..853f952 100644
--- a/docs/UserGuide/Appendix/SQL-Reference.md
+++ b/docs/UserGuide/Appendix/SQL-Reference.md
@@ -67,33 +67,37 @@ Eg: IoTDB > DELETE STORAGE GROUP root.**
 ```
 
 * Create Timeseries Statement
-
 ```
 CREATE TIMESERIES <FullPath> WITH <AttributeClauses>
 alias
     : LR_BRACKET ID RR_BRACKET
     ;
 attributeClauses
-    : DATATYPE OPERATOR_EQ dataType COMMA ENCODING OPERATOR_EQ encoding
-    (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ compressor=propertyValue)?
+    : DATATYPE OPERATOR_EQ <DataTypeValue> 
+    COMMA ENCODING OPERATOR_EQ <EncodingValue>
+    (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ <CompressorValue>)?
     (COMMA property)*
     tagClause
     attributeClause
     ;
 attributeClause
-    : (ATTRIBUTES LR_BRACKET property (COMMA property)* RR_BRACKET)?
+    : ATTRIBUTES LR_BRACKET propertyClause (COMMA propertyClause)* RR_BRACKET
     ;
 tagClause
-    : (TAGS LR_BRACKET property (COMMA property)* RR_BRACKET)?
+    : TAGS LR_BRACKET propertyClause (COMMA propertyClause)* RR_BRACKET
+    ;
+propertyClause
+    : name=ID OPERATOR_EQ propertyValue
     ;
 DataTypeValue: BOOLEAN | DOUBLE | FLOAT | INT32 | INT64 | TEXT
 EncodingValue: GORILLA | PLAIN | RLE | TS_2DIFF | REGULAR
 CompressorValue: UNCOMPRESSED | SNAPPY
-propertyValue: SDT | COMPDEV | COMPMINTIME | COMPMAXTIME
+AttributesType: SDT | COMPDEV | COMPMINTIME | COMPMAXTIME
+PropertyValue: ID | constant
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE, COMPRESSOR=SNAPPY, MAX_POINT_NUMBER=3
-Eg: create timeseries root.turbine.d0.s0(temperature) with datatype=FLOAT, encoding=RLE, compression=SNAPPY tags(unit=f, description='turbine this is a test1') attributes(H_Alarm=100, M_Alarm=50)
+Eg: CREATE TIMESERIES root.turbine.d0.s0(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE, COMPRESSOR=SNAPPY tags(unit=f, description='turbine this is a test1') attributes(H_Alarm=100, M_Alarm=50)
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE, LOSS=SDT, COMPDEV=0.01
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMINTIME=3
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15
@@ -104,25 +108,70 @@ Note: For SDT, it is optional to set compression minimum COMPMINTIME, which is t
 Note: For SDT, it is optional to set compression maximum COMPMAXTIME, which is the maximum time difference between stored values regardless of COMPDEV.
 ```
 
-* Create schema template
+* Create Timeseries Statement (Simplified version, from v0.13)
 ```
-CREATE schema template <TemplateName> WITH <AttributeClauses>
-attributeClauses
-    : (MEASUREMENT_NAME DATATYPE OPERATOR_EQ dataType COMMA ENCODING OPERATOR_EQ encoding
-    (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ compressor=propertyValue)?
-    (COMMA property)*)
+CREATE TIMESERIES <FullPath> <SimplifiedAttributeClauses>
+SimplifiedAttributeClauses
+    : <DataTypeValue> 
+    ENCODING OPERATOR_EQ <EncodingValue>
+    ((COMPRESSOR | COMPRESSION) OPERATOR_EQ <CompressorValue>)?
+    (COMMA property)*
+    tagClause
     attributeClause
     ;
-Eg: create schema template temp1(
-        (s1 INT32 with encoding=Gorilla, compression=SNAPPY),
-        (s2 FLOAT with encoding=RLE, compression=SNAPPY)
-       )  
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.status BOOLEAN ENCODING=PLAIN
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT ENCODING=RLE
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT ENCODING=RLE COMPRESSOR=SNAPPY MAX_POINT_NUMBER=3
+Eg: CREATE TIMESERIES root.turbine.d0.s0(temperature) FLOAT ENCODING=RLE COMPRESSOR=SNAPPY tags(unit=f, description='turbine this is a test1') attributes(H_Alarm=100, M_Alarm=50)
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT ENCODING=RLE LOSS=SDT COMPDEV=0.01
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT ENCODING=RLE LOSS=SDT COMPDEV=0.01 COMPMINTIME=3
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT ENCODING=RLE LOSS=SDT COMPDEV=0.01 COMPMINTIME=2 COMPMAXTIME=15
+```
+
+* Create Aligned Timeseries Statement
+```
+CREATE ALIGNED TIMESERIES <FullPath> alignedMeasurements
+alignedMeasurements
+    : LR_BRACKET nodeNameWithoutWildcard attributeClauses
+    (COMMA nodeNameWithoutWildcard attributeClauses)+ RR_BRACKET
+    ;
+Eg: CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(lat FLOAT ENCODING=GORILLA, lon FLOAT ENCODING=GORILLA COMPRESSOR=SNAPPY)
+Note: It is not supported to set different compression for a group of aligned timeseries.
+Note: It is not currently supported to set an alias, tag, and attribute for aligned timeseries.
+```
+
+* Create Schema Template Statement
+```
+CREATE SCHEMA TEMPLATE <TemplateName> LR_BRACKET <TemplateMeasurementClause> (COMMA plateMeasurementClause>)* RR_BRACKET
+templateMeasurementClause
+    : nodeNameWithoutWildcard attributeClauses #nonAlignedTemplateMeasurement
+    | alignedDevice=nodeNameWithoutWildcard LR_BRACKET nodeNameWithoutWildcard attributeClauses 
+    (COMMA nodeNameWithoutWildcard attributeClauses)+ RR_BRACKET #alignedTemplateMeasurement
+    ;
+Eg: CREATE SCHEMA TEMPLATE temp1(
+        s1 INT32 encoding=Gorilla, compression=SNAPPY,
+        vector1(
+            s1 INT32 encoding=Gorilla,
+            s2 FLOAT encoding=RLE, compression=SNAPPY)
+    )
+```
+
+* Set Schema Template Statement
+```
+SET SCHEMA TEMPLATE <TemplateName> TO <STORAGE_GROUP_NAME>
+Eg: SET SCHEMA TEMPLATE temp1 TO root.beijing
+```
+
+* Create Timeseries Of Schema Template Statement
+```
+CREATE TIMESERIES OF SCHEMA TEMPLATE ON <STORAGE_GROUP_NAME>
+Eg: CREATE TIMESERIES OF SCHEMA TEMPLATE ON root.beijing
 ```
 
-* Set schema template
+* Unset Schema Template Statement
 ```
-set schema template <TemplateName> to <STORAGE_GROUP_NAME>
-Eg: set schema template temp1 to root.beijing
+UNSET SCHEMA TEMPLATE <TemplateName> FROM <STORAGE_GROUP_NAME>
+Eg: UNSET SCHEMA TEMPLATE temp1 FROM root.beijing
 ```
 
 * Delete Timeseries Statement
diff --git a/docs/UserGuide/Data-Concept/Data-Model-and-Terminology.md b/docs/UserGuide/Data-Concept/Data-Model-and-Terminology.md
index 8fb3a6f..1f4cf94 100644
--- a/docs/UserGuide/Data-Concept/Data-Model-and-Terminology.md
+++ b/docs/UserGuide/Data-Concept/Data-Model-and-Terminology.md
@@ -35,13 +35,7 @@ Here are the basic concepts of the model involved in IoTDB.
 
 #### Measurement (Also called field)
 
-**Univariable or multi-variable measurement**. It is information measured by a detection equipment in an actual scene, and can transform the sensed information into an electrical signal or other desired form of information output and send it to IoTDB.  In IoTDB, all data and paths stored are organized in units of measuements.
-
-#### Sub-measurement
-
-In multi-variable measurements, there are many sub-measurement. For example, GPS is a multi-variable measurements, including three sub-measurement: longitude, dimension and altitude. Multi-variable measurements are usually collected at the same time and share time series.
-
-The univariable measurement overlaps the sub-measurement name with the measurement name. For example, temperature is a univariable measurement.
+It is information measured by detection equipment in an actual scene and can transform the sensed information into an electrical signal or other desired form of information output and send it to IoTDB.  In IoTDB, all data and paths stored are organized in units of measurements.
 
 #### Entity (Also called device)
 
@@ -125,17 +119,23 @@ In order to make it easier and faster to express multiple timeseries paths, IoTD
 
 For example, if entity wt01 in power plant wf01 of power group ln has a measurement named status, its timeseries  can be expressed as: `root.ln.wf01.wt01.status`.
 
-#### Multi-variable timeseries (Also called aligned timeseries, from v0.13)
+#### Aligned timeseries (From v0.13)
+
+There is a situation that multiple measurements of an entity are sampled simultaneously in practical applications, forming multiple timeseries aligned on a time column.
+
+By using aligned timeseries, the timestamp columns of a group of aligned timeseries need to be stored only once in memory and disk when inserting data, instead of once per timeseries.
+
+It would be best if you created a group of aligned timeseries at the same time.
 
-A multi-variable measurements of an entity corresponds to a multi-variable timeseries. These timeseries are called **multi-variable timeseries**, also called **aligned timeseries**.
+You cannot create non-aligned timeseries under the entity to which the aligned timeseries belong, nor can you create aligned timeseries under the entity to which the non-aligned timeseries belong.
 
-Multi-variable timeseries need to be created, inserted and deleted at the same time. However, when querying, you can query each sub-measurement separately.
+When querying, you can query each timeseries separately.
 
-By using multi-variable timeseries, the timestamp columns of a group of multi-variable timeseries need to be stored only once in memory and disk when inserting data, instead of once per timeseries:
+When inserting data, it is allowed to insert null value in the aligned timeseries.
 
 <img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/19167280/114125919-f4850800-9929-11eb-8211-81d4c04af1ec.png">
 
-In the following chapters of data definition language, data operation language and Java Native Interface, various operations related to multi-variable timeseries will be introduced one by one.
+In the following chapters of data definition language, data operation language and Java Native Interface, various operations related to aligned timeseries will be introduced one by one.
 
 #### Timestamp
 
@@ -143,10 +143,10 @@ The timestamp is the time point at which data is produced. It includes absolute
 
 
 
-### Measurement Template
+### Schema Template
 
-#### Measurement template (From v0.13)
+#### Schema template (From v0.13)
 
-In the actual scenario, many entities collect the same measurements, that is, they have the same measurements name and type. A **measurement template** can be declared to define the collectable measurements set. Measurement template helps save memory by implementing schema sharing. For detailed description, please refer to Measurement Template doc.
+In the actual scenario, many entities collect the same measurements, that is, they have the same measurements name and type. A **schema template** can be declared to define the collectable measurements set. Schema template helps save memory by implementing schema sharing. For detailed description, please refer to Schema Template doc.
 
-In the following chapters of, data definition language, data operation language and Java Native Interface, various operations related to measurement template will be introduced one by one.
+In the following chapters of, data definition language, data operation language and Java Native Interface, various operations related to schema template will be introduced one by one.
diff --git a/docs/UserGuide/Data-Concept/Measurement-Template.md b/docs/UserGuide/Data-Concept/Schema-Template.md
similarity index 71%
rename from docs/UserGuide/Data-Concept/Measurement-Template.md
rename to docs/UserGuide/Data-Concept/Schema-Template.md
index 78a1902..bee5c17 100644
--- a/docs/UserGuide/Data-Concept/Measurement-Template.md
+++ b/docs/UserGuide/Data-Concept/Schema-Template.md
@@ -19,13 +19,13 @@
 
 -->
 
-## Measurement Template
+## Schema Template
 
 ### Problem scenario
 
 When faced with a large number of entities of the same type and the measurements of these entities are the same, registering time series for each measurent will result in the following problems. On the one hand, the metadata of time series will occupy a lot of memory resources; on the other hand, the maintenance of a large number of time series will be very complex.
 
-In order to enable different entities of the same type to share metadata, reduce the memory usage of metadata, and simplify the management of numerous entities and measurements, IoTDB introduces the measurement template function.
+In order to enable different entities of the same type to share metadata, reduce the memory usage of metadata, and simplify the management of numerous entities and measurements, IoTDB introduces the schema template function.
 
 The following picture illustrates the data model of petrol vehicle scenario. The velocity, fuel amount, acceleration, and angular velocity of each petrol vehicle spread over cities will be collected. Obviously, the measurements of single petrol vehicle are the same as those of another.
 
@@ -35,21 +35,21 @@ The following picture illustrates the data model of petrol vehicle scenario. The
 
 Supported from v0.13
 
-In the actual scenario, many entities collect the same measurements, that is, they have the same measurements name and type. A measurement template can be declared to define the collectable measurements set. Measurement template is hung on any node of the tree data pattern, which means that all entities under the node have the same measurements set.
+In the actual scenario, many entities collect the same measurements, that is, they have the same measurements name and type. A schema template can be declared to define the collectable measurements set. Schema template is hung on any node of the tree data pattern, which means that all entities under the node have the same measurements set.
 
-Currently you can only set one measurement template on a specific path. If there's one measurement template on one node, it will be forbidden to set any measurement template on the ancestors or descendants of this node. An entity will use it's own measurement template or ancestor's measurement template.
+Currently you can only set one schema template on a specific path. If there's one schema template on one node, it will be forbidden to set any schema template on the ancestors or descendants of this node. An entity will use it's own schema template or ancestor's schema template.
 
-In the following chapters of data definition language, data operation language and Java Native Interface, various operations related to measurement template will be introduced one by one.
+In the following chapters of data definition language, data operation language and Java Native Interface, various operations related to schema template will be introduced one by one.
 
-After applying measurement template, the following picture illustrates the new data model of petrol vehicle scenario. All petrol vehicles share the schemas defined in template. There are no redundancy storage of measurement schemas.
+After applying schema template, the following picture illustrates the new data model of petrol vehicle scenario. All petrol vehicles share the schemas defined in template. There are no redundancy storage of measurement schemas.
 
 <img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://github.com/apache/iotdb-bin-resources/blob/main/docs/UserGuide/Data%20Concept/Measurement%20Template/example_with_template.png?raw=true" alt="example with template">
 
 ### Usage
 
-Currently, only Session API supports Measurement Template usage.
+Currently, only Session API supports Schema Template usage.
 
-* Create a measurement template
+* Create a schema template
 ```
 
 * name: template name
@@ -79,6 +79,6 @@ void setSchemaTemplate(String templateName, String prefixPath)
 
 ```
 
-After setting measurement template,data could be inserted directly to the according timeseries. For example, suppose there's storage group root.sg and template t1(s1,s2) has been set to root.sg.car,then timeseries like root.sg.car.d1.s1 and root.sg.car.d1.s2 are available and data can be inserted。
+After setting schema template,data could be inserted directly to the according timeseries. For example, suppose there's storage group root.sg and template t1(s1,s2) has been set to root.sg.car,then timeseries like root.sg.car.d1.s1 and root.sg.car.d1.s2 are available and data can be inserted。
 
-For examples of measurement template, you can refer to example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java
\ No newline at end of file
+For examples of schema template, you can refer to example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java
\ No newline at end of file
diff --git a/docs/UserGuide/IoTDB-SQL-Language/DDL-Data-Definition-Language.md b/docs/UserGuide/IoTDB-SQL-Language/DDL-Data-Definition-Language.md
index c8fe797..c62a1bc 100644
--- a/docs/UserGuide/IoTDB-SQL-Language/DDL-Data-Definition-Language.md
+++ b/docs/UserGuide/IoTDB-SQL-Language/DDL-Data-Definition-Language.md
@@ -78,6 +78,7 @@ IoTDB > DELETE STORAGE GROUP root.sgcc
 IoTDB > DELETE STORAGE GROUP root.**
 ```
 ## Timeseries Management
+
 ### Create Timeseries
 
 According to the storage model selected before, we can create corresponding timeseries in the two storage groups respectively. The SQL statements for creating timeseries are as follows:
@@ -91,6 +92,17 @@ IoTDB > create timeseries root.sgcc.wf03.wt01.status with datatype=BOOLEAN,encod
 IoTDB > create timeseries root.sgcc.wf03.wt01.temperature with datatype=FLOAT,encoding=RLE
 ```
 
+From v0.13, you can use a simplified version of the SQL statements to create timeseries:
+
+```
+IoTDB > create timeseries root.ln.wf01.wt01.status BOOLEAN encoding=PLAIN
+IoTDB > create timeseries root.ln.wf01.wt01.temperature FLOAT encoding=RLE
+IoTDB > create timeseries root.ln.wf02.wt02.hardware TEXT encoding=PLAIN
+IoTDB > create timeseries root.ln.wf02.wt02.status BOOLEAN encoding=PLAIN
+IoTDB > create timeseries root.sgcc.wf03.wt01.status BOOLEAN encoding=PLAIN
+IoTDB > create timeseries root.sgcc.wf03.wt01.temperature FLOAT encoding=RLE
+```
+
 Notice that when in the CREATE TIMESERIES statement the encoding method conflicts with the data type, the system gives the corresponding error prompt as shown below:
 
 ```
@@ -100,6 +112,18 @@ error: encoding TS_2DIFF does not support BOOLEAN
 
 Please refer to [Encoding](../Data-Concept/Encoding.md) for correspondence between data type and encoding.
 
+### Create Aligned Timeseries (From v0.13)
+
+The SQL statement for creating a group of timeseries are as follows:
+
+```
+IoTDB> CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT encoding=PLAIN compressor=SNAPPY, longitude FLOAT encoding=PLAIN compressor=SNAPPY)
+```
+
+You can set different datatype, encoding, and compression for the timeseries in a group of aligned timeseries
+
+It is not currently supported to set an alias, tag, and attribute for aligned timeseries.
+
 ### Delete Timeseries
 
 To delete the timeseries we created before, we are able to use `DELETE TimeSeries <PathPattern>` statement.
@@ -112,19 +136,6 @@ IoTDB> delete timeseries root.ln.wf01.wt01.temperature, root.ln.wf02.wt02.hardwa
 IoTDB> delete timeseries root.ln.wf02.*
 ```
 
-As for **aligned** timeseries, we could delete them by explicit declaration with parentheses.
-
-```
-IoTDB > delete timeseries root.sg.d1.(s1,s2)
-```
-
-Attention: Deleting part of aligned timeseries is **not supported** currently.
-
-```
-IoTDB > delete timeseries root.sg.d1.s1
-error: Not support deleting part of aligned timeseies!
-```
-
 ### Show Timeseries
 
 * SHOW LATEST? TIMESERIES pathPattern? showWhereClause? limitClause?
@@ -516,6 +527,44 @@ Total line number = 2
 It costs 0.001s
 ```
 
+## Schema Template
+
+IoTDB supports the schema template function, enabling different entities of the same type to share metadata, reduce the memory usage of metadata, and simplify the management of numerous entities and measurements.
+
+### Create Schema Template
+
+The SQL Statement for creating schema template is as follow:
+
+```
+IoTDB> create schema template temp1(GPS(lat FLOAT encoding=Gorilla, lon FLOAT encoding=Gorilla) compression=SNAPPY, status BOOLEAN encoding=PLAIN compression=SNAPPY)
+```
+
+### Set Schema Template
+
+The SQL Statement for setting schema template is as follow:
+
+```
+IoTDB> set schema template temp1 to root.ln.wf01
+```
+
+After setting the schema template, you can insert data into the timeseries. For example, suppose there's a storage group root.ln and temp1 has been set to root.ln.wf01, then timeseries like root.ln.wf01.GPS.lat and root.ln.wf01.status are available and data points can be inserted.
+
+**Attention**: Before inserting data, timeseries defined by the schema template will not be created. You can use the following SQL statement to create the timeseries before inserting data:
+
+```
+IoTDB> create timeseries of schema template on root.ln.wf01
+```
+
+### Uset Schema Template
+
+The SQL Statement for unsetting schema template is as follow:
+
+```
+IoTDB> unset schema template temp1 from root.beijing
+```
+
+**Attention**: Unsetting the template from entities, which have already inserted records using the template, is not supported.
+
 ## TTL
 
 IoTDB supports storage-level TTL settings, which means it is able to delete old data automatically and periodically. The benefit of using TTL is that hopefully you can control the total disk space usage and prevent the machine from running out of disks. Moreover, the query performance may downgrade as the total number of files goes up and the memory usage also increase as there are more files. Timely removing such files helps to keep at a high query performance level and reduce memory usage.
diff --git a/docs/zh/UserGuide/Appendix/SQL-Reference.md b/docs/zh/UserGuide/Appendix/SQL-Reference.md
index c130fc5..dec05f3 100644
--- a/docs/zh/UserGuide/Appendix/SQL-Reference.md
+++ b/docs/zh/UserGuide/Appendix/SQL-Reference.md
@@ -56,33 +56,37 @@ Eg: IoTDB > DELETE STORAGE GROUP root.**
 ```
 
 * 创建时间序列语句
-
 ```
 CREATE TIMESERIES <FullPath> WITH <AttributeClauses>
 alias
     : LR_BRACKET ID RR_BRACKET
     ;
 attributeClauses
-    : DATATYPE OPERATOR_EQ dataType COMMA ENCODING OPERATOR_EQ encoding
-    (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ compressor=propertyValue)?
+    : DATATYPE OPERATOR_EQ <DataTypeValue> 
+    COMMA ENCODING OPERATOR_EQ <EncodingValue>
+    (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ <CompressorValue>)?
     (COMMA property)*
     tagClause
     attributeClause
     ;
 attributeClause
-    : (ATTRIBUTES LR_BRACKET property (COMMA property)* RR_BRACKET)?
+    : ATTRIBUTES LR_BRACKET propertyClause (COMMA propertyClause)* RR_BRACKET
     ;
 tagClause
-    : (TAGS LR_BRACKET property (COMMA property)* RR_BRACKET)?
+    : TAGS LR_BRACKET propertyClause (COMMA propertyClause)* RR_BRACKET
+    ;
+propertyClause
+    : name=ID OPERATOR_EQ propertyValue
     ;
 DataTypeValue: BOOLEAN | DOUBLE | FLOAT | INT32 | INT64 | TEXT
 EncodingValue: GORILLA | PLAIN | RLE | TS_2DIFF | REGULAR
 CompressorValue: UNCOMPRESSED | SNAPPY
-propertyValue: SDT | COMPDEV | COMPMINTIME | COMPMAXTIME
+AttributesType: SDT | COMPDEV | COMPMINTIME | COMPMAXTIME
+PropertyValue: ID | constant
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE, COMPRESSOR=SNAPPY, MAX_POINT_NUMBER=3
-Eg: create timeseries root.turbine.d0.s0(temperature) with datatype=FLOAT, encoding=RLE, compression=SNAPPY tags(unit=f, description='turbine this is a test1') attributes(H_Alarm=100, M_Alarm=50)
+Eg: CREATE TIMESERIES root.turbine.d0.s0(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE, COMPRESSOR=SNAPPY tags(unit=f, description='turbine this is a test1') attributes(H_Alarm=100, M_Alarm=50)
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE, LOSS=SDT, COMPDEV=0.01
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMINTIME=3
 Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE, LOSS=SDT, COMPDEV=0.01, COMPMINTIME=2, COMPMAXTIME=15
@@ -93,25 +97,70 @@ Note: For SDT, it is optional to set compression minimum COMPMINTIME, which is t
 Note: For SDT, it is optional to set compression maximum COMPMAXTIME, which is the maximum time difference between stored values regardless of COMPDEV.
 ```
 
-* 创建设备模板语句
+* 创建时间序列语句(简化版本,从v0.13起支持)
 ```
-CREATE schema template <TemplateName> WITH <AttributeClauses>
-attributeClauses
-    : (MEASUREMENT_NAME DATATYPE OPERATOR_EQ dataType COMMA ENCODING OPERATOR_EQ encoding
-    (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ compressor=propertyValue)?
-    (COMMA property)*)
+CREATE TIMESERIES <FullPath> <SimplifiedAttributeClauses>
+SimplifiedAttributeClauses
+    : <DataTypeValue> 
+    ENCODING OPERATOR_EQ <EncodingValue>
+    ((COMPRESSOR | COMPRESSION) OPERATOR_EQ <CompressorValue>)?
+    (COMMA property)*
+    tagClause
     attributeClause
     ;
-Eg: create schema template temp1(
-        (s1 INT32 with encoding=Gorilla, compression=SNAPPY),
-        (s2 FLOAT with encoding=RLE, compression=SNAPPY)
-       )  
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.status BOOLEAN ENCODING=PLAIN
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT ENCODING=RLE
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT ENCODING=RLE COMPRESSOR=SNAPPY MAX_POINT_NUMBER=3
+Eg: CREATE TIMESERIES root.turbine.d0.s0(temperature) FLOAT ENCODING=RLE COMPRESSOR=SNAPPY tags(unit=f, description='turbine this is a test1') attributes(H_Alarm=100, M_Alarm=50)
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT ENCODING=RLE LOSS=SDT COMPDEV=0.01
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT ENCODING=RLE LOSS=SDT COMPDEV=0.01 COMPMINTIME=3
+Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT ENCODING=RLE LOSS=SDT COMPDEV=0.01 COMPMINTIME=2 COMPMAXTIME=15
+```
+
+* 创建对齐时间序列语句
+```
+CREATE ALIGNED TIMESERIES <FullPath> alignedMeasurements
+alignedMeasurements
+    : LR_BRACKET nodeNameWithoutWildcard attributeClauses
+    (COMMA nodeNameWithoutWildcard attributeClauses)+ RR_BRACKET
+    ;
+Eg: CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(lat FLOAT ENCODING=GORILLA, lon FLOAT ENCODING=GORILLA COMPRESSOR=SNAPPY)
+Note: It is not supported to set different compression for a group of aligned timeseries.
+Note: It is not currently supported to set an alias, tag, and attribute for aligned timeseries.
+```
+
+* 创建设备模板语句
+```
+CREATE SCHEMA TEMPLATE <TemplateName> LR_BRACKET <TemplateMeasurementClause> (COMMA plateMeasurementClause>)* RR_BRACKET
+templateMeasurementClause
+    : nodeNameWithoutWildcard attributeClauses #nonAlignedTemplateMeasurement
+    | alignedDevice=nodeNameWithoutWildcard LR_BRACKET nodeNameWithoutWildcard attributeClauses 
+    (COMMA nodeNameWithoutWildcard attributeClauses)+ RR_BRACKET #alignedTemplateMeasurement
+    ;
+Eg: CREATE SCHEMA TEMPLATE temp1(
+        s1 INT32 encoding=Gorilla, compression=SNAPPY,
+        vector1(
+            s1 INT32 encoding=Gorilla,
+            s2 FLOAT encoding=RLE, compression=SNAPPY)
+    )
 ```
 
 * 挂载设备模板语句
 ```
-set schema template <TemplateName> to <STORAGE_GROUP_NAME>
-Eg: set schema template temp1 to root.beijing
+SET SCHEMA TEMPLATE <TemplateName> TO <STORAGE_GROUP_NAME>
+Eg: SET SCHEMA TEMPLATE temp1 TO root.beijing
+```
+
+* 创建模板时间序列语句
+```
+CREATE TIMESERIES OF SCHEMA TEMPLATE ON <STORAGE_GROUP_NAME>
+Eg: CREATE TIMESERIES OF SCHEMA TEMPLATE ON root.beijing
+```
+
+* 卸载设备模板语句
+```
+UNSET SCHEMA TEMPLATE <TemplateName> FROM <STORAGE_GROUP_NAME>
+Eg: UNSET SCHEMA TEMPLATE temp1 FROM root.beijing
 ```
 
 * 删除时间序列语句
diff --git a/docs/zh/UserGuide/Data-Concept/Data-Model-and-Terminology.md b/docs/zh/UserGuide/Data-Concept/Data-Model-and-Terminology.md
index d82ed06..30679f8 100644
--- a/docs/zh/UserGuide/Data-Concept/Data-Model-and-Terminology.md
+++ b/docs/zh/UserGuide/Data-Concept/Data-Model-and-Terminology.md
@@ -35,13 +35,7 @@ IoTDB 模型结构涉及的基本概念在下文将做详细叙述。
 
 #### 物理量(Measurement,也称工况、字段 field)
 
-**一元或多元物理量**,是在实际场景中检测装置所记录的测量信息,且可以按一定规律变换成为电信号或其他所需形式的信息输出并发送给 IoTDB。在 IoTDB 当中,存储的所有数据及路径,都是以物理量为单位进行组织。
-
-#### 物理分量(SubMeasurement、分量)
-
-在多元物理量中,包括多个分量。如 GPS 是一个多元物理量,包含 3 个分量:经度、维度、海拔。多元物理量通常被同时采集,共享时间列。
-
-一元物理量则将分量名和物理量名字重合。如温度是一个一元物理量。
+**物理量**,是在实际场景中检测装置所记录的测量信息,且可以按一定规律变换成为电信号或其他所需形式的信息输出并发送给 IoTDB。在 IoTDB 当中,存储的所有数据及路径,都是以物理量为单位进行组织。
 
 #### 实体(Entity,也称设备,device)
 
@@ -113,7 +107,7 @@ wildcard
 > 注意:`*`和`**`不能放在路径开头。
 
 
-### 一元、多元时间序列
+### 时间序列
 
 #### 数据点(Data point)
 
@@ -121,23 +115,25 @@ wildcard
 
 #### 时间序列(一个实体的某个物理量对应一个时间序列,Timeseries,也称测点 meter、时间线 timeline,实时数据库中常被称作标签 tag、参数 parameter)
 
-**一个物理实体的某个物理量在时间轴上的记录**,是数据点的序列。
+**一个物理实体的某个物理量在时间轴上的记录**,是数据点的序列。一个实体的一个物理量对应一个时间序列,即实体+物理量=时间序列。
 
 例如,ln 电力集团、wf01 风电场的实体 wt01 有名为 status 的物理量,则它的时间序列可以表示为:`root.ln.wf01.wt01.status`。 
 
-#### 一元时间序列(single-variable timeseries 或 timeseries,v0.1 起支持)
+#### 对齐时间序列(Aligned timeseries,v0.13 起支持)
+
+在实际应用中,存在某些实体的多个物理量**同时采样**,形成在时间列上对齐的多条时间序列。
 
-一个实体的一个一元物理量对应一个一元时间序列。实体+物理量=时间序列
+通过使用对齐的时间序列,在插入数据时,一组对齐序列的时间戳列在内存和磁盘中仅需存储一次,而不是每个时间序列存储一次。
 
-#### 多元时间序列(Multi-variable timeseries 或 Aligned timeseries,v0.13 起支持)
+对齐的一组时间序列最好同时创建。
 
-一个实体的一个多元物理量对应一个多元时间序列。这些时间序列称为**多元时间序列**,也叫**对齐时间序列**。
+不可以在对齐序列所属的实体下创建非对齐的序列,不可以在非对齐序列所属的实体下创建对齐序列。
 
-多元时间序列需要被同时创建、同时插入值,删除时也必须同时删除。不过在查询的时候,可以对于每一个分量单独查询。
+查询数据时,可以对于每一条时间序列单独查询。
 
-通过使用对齐的时间序列,在插入数据时,一组对齐序列的时间戳列在内存和磁盘中仅需存储一次,而不是每个时间序列存储一次:
+插入数据时,对齐的时间序列中某列的某些行允许有空值。
 
-<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/19167280/123542458-62e4a400-d77c-11eb-8c45-ca516f1b7eba.png">
+<img style="width:100%; max-width:800px; max-height:600px; margin-left:auto; margin-right:auto; display:block;" src="https://user-images.githubusercontent.com/19167280/114125919-f4850800-9929-11eb-8211-81d4c04af1ec.png">
 
 在后续数据定义语言、数据操作语言和 Java 原生接口章节,将对涉及到对齐时间序列的各种操作进行逐一介绍。
 
@@ -148,6 +144,6 @@ wildcard
 
 ### 物理量模板
 
-#### 物理量模板(Measurement template,v0.13 起支持)
+#### 物理量模板(Schema template,v0.13 起支持)
 
 实际应用中有许多实体所采集的物理量相同,即具有相同的工况名称和类型,可以声明一个**物理量模板**来定义可采集的物理量集合。在实践中,物理量模板的使用可帮助减少元数据的资源占用,详细内容参见物理量模板文档。
\ No newline at end of file
diff --git a/docs/zh/UserGuide/Data-Concept/Measurement-Template.md b/docs/zh/UserGuide/Data-Concept/Schema-Template.md
similarity index 98%
rename from docs/zh/UserGuide/Data-Concept/Measurement-Template.md
rename to docs/zh/UserGuide/Data-Concept/Schema-Template.md
index 9bc8f98..83e4f55 100644
--- a/docs/zh/UserGuide/Data-Concept/Measurement-Template.md
+++ b/docs/zh/UserGuide/Data-Concept/Schema-Template.md
@@ -33,7 +33,7 @@
 
 ### 概念定义
 
-物理量模板(Measurement template,v0.13 起支持)
+物理量模板(Schema template,v0.13 起支持)
 
 实际应用中有许多实体所采集的物理量相同,即具有相同的工况名称和类型,可以声明一个**物理量模板**来定义可采集的物理量集合。
 
diff --git a/docs/zh/UserGuide/IoTDB-SQL-Language/DDL-Data-Definition-Language.md b/docs/zh/UserGuide/IoTDB-SQL-Language/DDL-Data-Definition-Language.md
index aa23819..e4e6bc9 100644
--- a/docs/zh/UserGuide/IoTDB-SQL-Language/DDL-Data-Definition-Language.md
+++ b/docs/zh/UserGuide/IoTDB-SQL-Language/DDL-Data-Definition-Language.md
@@ -94,6 +94,17 @@ IoTDB > create timeseries root.sgcc.wf03.wt01.status with datatype=BOOLEAN,encod
 IoTDB > create timeseries root.sgcc.wf03.wt01.temperature with datatype=FLOAT,encoding=RLE
 ```
 
+从 v0.13 起,可以使用简化版的 SQL 语句创建时间序列:
+
+```
+IoTDB > create timeseries root.ln.wf01.wt01.status BOOLEAN encoding=PLAIN
+IoTDB > create timeseries root.ln.wf01.wt01.temperature FLOAT encoding=RLE
+IoTDB > create timeseries root.ln.wf02.wt02.hardware TEXT encoding=PLAIN
+IoTDB > create timeseries root.ln.wf02.wt02.status BOOLEAN encoding=PLAIN
+IoTDB > create timeseries root.sgcc.wf03.wt01.status BOOLEAN encoding=PLAIN
+IoTDB > create timeseries root.sgcc.wf03.wt01.temperature FLOAT encoding=RLE
+```
+
 需要注意的是,当创建时间序列时指定的编码方式与数据类型不对应时,系统会给出相应的错误提示,如下所示:
 ```
 IoTDB> create timeseries root.ln.wf02.wt02.status WITH DATATYPE=BOOLEAN, ENCODING=TS_2DIFF
@@ -102,27 +113,26 @@ error: encoding TS_2DIFF does not support BOOLEAN
 
 详细的数据类型与编码方式的对应列表请参见 [编码方式](../Data-Concept/Encoding.md)。
 
-### 删除时间序列
+### 创建对齐时间序列 (v0.13 起支持)
 
-我们可以使用`DELETE TimeSeries <PathPattern>`语句来删除我们之前创建的时间序列。SQL 语句如下所示:
+创建一组对齐时间序列的SQL语句如下所示:
 
 ```
-IoTDB> delete timeseries root.ln.wf01.wt01.status
-IoTDB> delete timeseries root.ln.wf01.wt01.temperature, root.ln.wf02.wt02.hardware
-IoTDB> delete timeseries root.ln.wf02.*
+IoTDB> CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT encoding=PLAIN compressor=SNAPPY, longitude FLOAT encoding=PLAIN compressor=SNAPPY) 
 ```
 
-对于**对齐**时间序列,我们可以通过括号来显式地删除整组序列:
+一组对齐序列中的序列可以有不同的数据类型、编码方式以及压缩方式。
 
-```
-IoTDB > delete timeseries root.sg.d1.(s1,s2)
-```
+对齐的时间序列暂不支持设置别名、标签、属性。
 
-注意:目前暂不支持删除部分对齐时间序列。
+### 删除时间序列
+
+我们可以使用`DELETE TimeSeries <PathPattern>`语句来删除我们之前创建的时间序列。SQL 语句如下所示:
 
 ```
-IoTDB > delete timeseries root.sg.d1.s1
-error: Not support deleting part of aligned timeseies!
+IoTDB> delete timeseries root.ln.wf01.wt01.status
+IoTDB> delete timeseries root.ln.wf01.wt01.temperature, root.ln.wf02.wt02.hardware
+IoTDB> delete timeseries root.ln.wf02.*
 ```
 
 ### 查看时间序列
@@ -525,6 +535,44 @@ Total line number = 2
 It costs 0.001s
 ```
 
+## 物理量模板
+
+IoTDB 支持物理量模板功能,实现同类型不同实体的物理量元数据共享,减少元数据内存占用,同时简化同类型实体的管理。
+
+### 创建物理量模板
+
+创建物理量模板的 SQL 语句如下所示:
+
+```
+IoTDB> create schema template temp1(GPS(lat FLOAT encoding=Gorilla, lon FLOAT encoding=Gorilla) compression=SNAPPY, status BOOLEAN encoding=PLAIN compression=SNAPPY)
+```
+
+### 挂载物理量模板
+
+挂载物理量模板的 SQL 语句如下所示:
+
+```
+IoTDB> set schema template temp1 to root.ln.wf01
+```
+
+挂载好物理量模板后,即可进行数据的写入。例如存储组为root.ln,模板temp1被挂载到了节点root.ln.wf01,那么可直接向时间序列(如root.ln.wf01.GPS.lat和root.ln.wf01.status)写入时间序列数据,该时间序列已可被当作正常创建的序列使用。
+
+**注意**:在插入数据之前,模板定义的时间序列不会被创建。可以使用如下SQL语句在插入数据前创建时间序列:
+
+```
+IoTDB> create timeseries of schema template on root.ln.wf01
+```
+
+### 卸载物理量模板
+
+卸载物理量模板的 SQL 语句如下所示:
+
+```
+IoTDB> unset schema template temp1 from root.beijing
+```
+
+**注意**:目前不支持从曾经使用模板插入数据后(即使数据已被删除)的实体中卸载模板。
+
 ## 数据存活时间(TTL)
 
 IoTDB 支持对存储组级别设置数据存活时间(TTL),这使得 IoTDB 可以定期、自动地删除一定时间之前的数据。合理使用 TTL
diff --git a/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java b/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java
index 2c6d035..a953363 100644
--- a/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java
+++ b/example/session/src/main/java/org/apache/iotdb/AlignedTimeseriesSessionExample.java
@@ -263,16 +263,13 @@ public class AlignedTimeseriesSessionExample {
     dataTypes.add(TSDataType.INT64);
     dataTypes.add(TSDataType.INT32);
     List<TSEncoding> encodings = new ArrayList<>();
+    List<CompressionType> compressors = new ArrayList<>();
     for (int i = 1; i <= 2; i++) {
       encodings.add(TSEncoding.RLE);
+      compressors.add(CompressionType.SNAPPY);
     }
     session.createAlignedTimeseries(
-        ROOT_SG1_D1,
-        multiMeasurementComponents,
-        dataTypes,
-        encodings,
-        CompressionType.SNAPPY,
-        null);
+        ROOT_SG1_D1, multiMeasurementComponents, dataTypes, encodings, compressors, null);
   }
 
   // be sure template is coordinate with tablet
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 6900b6d..6c6bf4f 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
@@ -55,28 +55,28 @@ import org.apache.iotdb.db.metadata.utils.MetaUtils;
 import org.apache.iotdb.db.monitor.MonitorConstants;
 import org.apache.iotdb.db.qp.constant.SQLConstant;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
-import org.apache.iotdb.db.qp.physical.crud.AppendTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
-import org.apache.iotdb.db.qp.physical.crud.PruneTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.UnsetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.ActivateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.AppendTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.AutoCreateDeviceMNodePlan;
 import org.apache.iotdb.db.qp.physical.sys.ChangeAliasPlan;
 import org.apache.iotdb.db.qp.physical.sys.ChangeTagOffsetPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateContinuousQueryPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DropContinuousQueryPlan;
+import org.apache.iotdb.db.qp.physical.sys.PruneTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
-import org.apache.iotdb.db.qp.physical.sys.SetUsingSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowDevicesPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowTimeSeriesPlan;
+import org.apache.iotdb.db.qp.physical.sys.UnsetTemplatePlan;
 import org.apache.iotdb.db.query.context.QueryContext;
 import org.apache.iotdb.db.query.dataset.ShowDevicesResult;
 import org.apache.iotdb.db.query.dataset.ShowTimeSeriesResult;
@@ -419,21 +419,21 @@ public class MManager {
         CreateTemplatePlan createTemplatePlan = (CreateTemplatePlan) plan;
         createSchemaTemplate(createTemplatePlan);
         break;
-      case SET_SCHEMA_TEMPLATE:
-        SetSchemaTemplatePlan setSchemaTemplatePlan = (SetSchemaTemplatePlan) plan;
-        setSchemaTemplate(setSchemaTemplatePlan);
+      case SET_TEMPLATE:
+        SetTemplatePlan setTemplatePlan = (SetTemplatePlan) plan;
+        setSchemaTemplate(setTemplatePlan);
         break;
-      case SET_USING_SCHEMA_TEMPLATE:
-        SetUsingSchemaTemplatePlan setUsingSchemaTemplatePlan = (SetUsingSchemaTemplatePlan) plan;
-        setUsingSchemaTemplate(setUsingSchemaTemplatePlan);
+      case ACTIVATE_TEMPLATE:
+        ActivateTemplatePlan activateTemplatePlan = (ActivateTemplatePlan) plan;
+        setUsingSchemaTemplate(activateTemplatePlan);
         break;
       case AUTO_CREATE_DEVICE_MNODE:
         AutoCreateDeviceMNodePlan autoCreateDeviceMNodePlan = (AutoCreateDeviceMNodePlan) plan;
         autoCreateDeviceMNode(autoCreateDeviceMNodePlan);
         break;
-      case UNSET_SCHEMA_TEMPLATE:
-        UnsetSchemaTemplatePlan unsetSchemaTemplatePlan = (UnsetSchemaTemplatePlan) plan;
-        unsetSchemaTemplate(unsetSchemaTemplatePlan);
+      case UNSET_TEMPLATE:
+        UnsetTemplatePlan unsetTemplatePlan = (UnsetTemplatePlan) plan;
+        unsetSchemaTemplate(unsetTemplatePlan);
       default:
         logger.error("Unrecognizable command {}", plan.getOperatorType());
     }
@@ -552,11 +552,11 @@ public class MManager {
       List<String> measurements,
       List<TSDataType> dataTypes,
       List<TSEncoding> encodings,
-      CompressionType compressor)
+      List<CompressionType> compressors)
       throws MetadataException {
     createAlignedTimeSeries(
         new CreateAlignedTimeSeriesPlan(
-            prefixPath, measurements, dataTypes, encodings, compressor, null));
+            prefixPath, measurements, dataTypes, encodings, compressors, null));
   }
 
   /**
@@ -584,7 +584,11 @@ public class MManager {
 
       // create time series in MTree
       mtree.createAlignedTimeseries(
-          prefixPath, measurements, plan.getDataTypes(), plan.getEncodings(), plan.getCompressor());
+          prefixPath,
+          measurements,
+          plan.getDataTypes(),
+          plan.getEncodings(),
+          plan.getCompressors());
 
       // the cached mNode may be replaced by new entityMNode in mtree
       mNodeCache.removeObject(prefixPath);
@@ -1907,15 +1911,12 @@ public class MManager {
       PartialPath prefixPath, List<String> measurements, List<TSDataType> dataTypes)
       throws MetadataException {
     List<TSEncoding> encodings = new ArrayList<>();
+    List<CompressionType> compressors = new ArrayList<>();
     for (TSDataType dataType : dataTypes) {
       encodings.add(getDefaultEncoding(dataType));
+      compressors.add(TSFileDescriptor.getInstance().getConfig().getCompressor());
     }
-    createAlignedTimeSeries(
-        prefixPath,
-        measurements,
-        dataTypes,
-        encodings,
-        TSFileDescriptor.getInstance().getConfig().getCompressor());
+    createAlignedTimeSeries(prefixPath, measurements, dataTypes, encodings, compressors);
   }
   // endregion
 
@@ -1984,7 +1985,7 @@ public class MManager {
     return templateManager.getTemplate(templateName).getMeasurementsUnderPath(path);
   }
 
-  public synchronized void setSchemaTemplate(SetSchemaTemplatePlan plan) throws MetadataException {
+  public synchronized void setSchemaTemplate(SetTemplatePlan plan) throws MetadataException {
     // get mnode and update template should be atomic
     Template template = templateManager.getTemplate(plan.getTemplateName());
 
@@ -2008,8 +2009,7 @@ public class MManager {
     }
   }
 
-  public synchronized void unsetSchemaTemplate(UnsetSchemaTemplatePlan plan)
-      throws MetadataException {
+  public synchronized void unsetSchemaTemplate(UnsetTemplatePlan plan) throws MetadataException {
     // get mnode should be atomic
     try {
       PartialPath path = new PartialPath(plan.getPrefixPath());
@@ -2032,7 +2032,7 @@ public class MManager {
     }
   }
 
-  public void setUsingSchemaTemplate(SetUsingSchemaTemplatePlan plan) throws MetadataException {
+  public void setUsingSchemaTemplate(ActivateTemplatePlan plan) throws MetadataException {
     try {
       setUsingSchemaTemplate(getDeviceNode(plan.getPrefixPath()));
     } catch (PathNotExistException e) {
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogTxtWriter.java b/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogTxtWriter.java
index 1b55278..a6a6ecc 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogTxtWriter.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogTxtWriter.java
@@ -20,18 +20,19 @@ package org.apache.iotdb.db.metadata.logfile;
 
 import org.apache.iotdb.db.engine.fileSystem.SystemFileFactory;
 import org.apache.iotdb.db.metadata.MetadataConstant;
-import org.apache.iotdb.db.qp.physical.crud.AppendTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.PruneTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.ActivateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.AppendTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateContinuousQueryPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DropContinuousQueryPlan;
 import org.apache.iotdb.db.qp.physical.sys.MNodePlan;
 import org.apache.iotdb.db.qp.physical.sys.MeasurementMNodePlan;
-import org.apache.iotdb.db.qp.physical.sys.SetUsingSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.PruneTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.StorageGroupMNodePlan;
+import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
 import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
@@ -142,7 +143,7 @@ public class MLogTxtWriter implements AutoCloseable {
             plan.getMeasurements(),
             plan.getDataTypes().stream().map(TSDataType::serialize),
             plan.getEncodings().stream().map(TSEncoding::serialize),
-            plan.getCompressor().serialize()));
+            plan.getCompressors().stream().map(CompressionType::serialize)));
 
     buf.append(",[");
     if (plan.getAliasList() != null) {
@@ -319,7 +320,7 @@ public class MLogTxtWriter implements AutoCloseable {
     lineNumber.incrementAndGet();
   }
 
-  public void setTemplate(SetSchemaTemplatePlan plan) throws IOException {
+  public void setTemplate(SetTemplatePlan plan) throws IOException {
     StringBuilder buf = new StringBuilder(String.valueOf(MetadataOperationType.SET_TEMPLATE));
     buf.append(",");
     buf.append(plan.getTemplateName());
@@ -331,7 +332,7 @@ public class MLogTxtWriter implements AutoCloseable {
     lineNumber.incrementAndGet();
   }
 
-  public void setUsingTemplate(SetUsingSchemaTemplatePlan plan) throws IOException {
+  public void setUsingTemplate(ActivateTemplatePlan plan) throws IOException {
     StringBuilder buf = new StringBuilder(String.valueOf(MetadataOperationType.SET_USING_TEMPLATE));
     buf.append(",");
     buf.append(plan.getPrefixPath());
@@ -341,7 +342,7 @@ public class MLogTxtWriter implements AutoCloseable {
     lineNumber.incrementAndGet();
   }
 
-  public void createTemplate(CreateTemplatePlan plan) throws IOException {
+  public void createSchemaTemplate(CreateTemplatePlan plan) throws IOException {
     // CreateTemplatePlan txt Log be like:
     // OperationType,templateName[,measurementPath,isAlign,dataType,encoding,compressor]
     StringBuilder buf = new StringBuilder();
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogWriter.java b/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogWriter.java
index c19a58e..7ec9fba 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogWriter.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/logfile/MLogWriter.java
@@ -25,26 +25,26 @@ import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
 import org.apache.iotdb.db.metadata.mnode.IStorageGroupMNode;
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
-import org.apache.iotdb.db.qp.physical.crud.AppendTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.PruneTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.UnsetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.ActivateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.AppendTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.AutoCreateDeviceMNodePlan;
 import org.apache.iotdb.db.qp.physical.sys.ChangeAliasPlan;
 import org.apache.iotdb.db.qp.physical.sys.ChangeTagOffsetPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateContinuousQueryPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DropContinuousQueryPlan;
 import org.apache.iotdb.db.qp.physical.sys.MNodePlan;
 import org.apache.iotdb.db.qp.physical.sys.MeasurementMNodePlan;
+import org.apache.iotdb.db.qp.physical.sys.PruneTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
-import org.apache.iotdb.db.qp.physical.sys.SetUsingSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.StorageGroupMNodePlan;
+import org.apache.iotdb.db.qp.physical.sys.UnsetTemplatePlan;
 import org.apache.iotdb.db.writelog.io.LogWriter;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -179,11 +179,11 @@ public class MLogWriter implements AutoCloseable {
     putLog(plan);
   }
 
-  public void setSchemaTemplate(SetSchemaTemplatePlan plan) throws IOException {
+  public void setSchemaTemplate(SetTemplatePlan plan) throws IOException {
     putLog(plan);
   }
 
-  public void unsetSchemaTemplate(UnsetSchemaTemplatePlan plan) throws IOException {
+  public void unsetSchemaTemplate(UnsetTemplatePlan plan) throws IOException {
     putLog(plan);
   }
 
@@ -222,7 +222,7 @@ public class MLogWriter implements AutoCloseable {
   }
 
   public void setUsingSchemaTemplate(PartialPath path) throws IOException {
-    SetUsingSchemaTemplatePlan plan = new SetUsingSchemaTemplatePlan(path);
+    ActivateTemplatePlan plan = new ActivateTemplatePlan(path);
     putLog(plan);
   }
 
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTree.java b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTree.java
index b8f83cd..8f8bf77 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTree.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTree.java
@@ -431,14 +431,14 @@ public class MTree implements Serializable {
    * @param measurements measurements list
    * @param dataTypes data types list
    * @param encodings encodings list
-   * @param compressor compressor
+   * @param compressors compressor
    */
   public void createAlignedTimeseries(
       PartialPath devicePath,
       List<String> measurements,
       List<TSDataType> dataTypes,
       List<TSEncoding> encodings,
-      CompressionType compressor)
+      List<CompressionType> compressors)
       throws MetadataException {
     MetaFormatUtils.checkSchemaMeasurementNames(measurements);
     Pair<IMNode, Template> pair = checkAndAutoCreateInternalPath(devicePath);
@@ -479,7 +479,7 @@ public class MTree implements Serializable {
                 entityMNode,
                 measurements.get(i),
                 new UnaryMeasurementSchema(
-                    measurements.get(i), dataTypes.get(i), encodings.get(i), compressor),
+                    measurements.get(i), dataTypes.get(i), encodings.get(i), compressors.get(i)),
                 null);
         entityMNode.addChild(measurements.get(i), measurementMNode);
       }
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/template/Template.java b/server/src/main/java/org/apache/iotdb/db/metadata/template/Template.java
index 93aa53b..0c9fd97 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/template/Template.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/template/Template.java
@@ -27,7 +27,7 @@ import org.apache.iotdb.db.metadata.mnode.IMNode;
 import org.apache.iotdb.db.metadata.mnode.IMeasurementMNode;
 import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
 import org.apache.iotdb.db.metadata.utils.MetaUtils;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.utils.SerializeUtils;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/template/TemplateManager.java b/server/src/main/java/org/apache/iotdb/db/metadata/template/TemplateManager.java
index ab84930..22b3f3a 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/template/TemplateManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/template/TemplateManager.java
@@ -25,9 +25,9 @@ import org.apache.iotdb.db.metadata.mnode.IMNode;
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.metadata.utils.MetaFormatUtils;
 import org.apache.iotdb.db.metadata.utils.MetaUtils;
-import org.apache.iotdb.db.qp.physical.crud.AppendTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.PruneTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.AppendTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.PruneTemplatePlan;
 import org.apache.iotdb.db.utils.TestOnly;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java b/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
index 2596623..ce111ab 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
@@ -185,6 +185,11 @@ public class SQLConstant {
 
   public static final int TOK_SETTLE = 111;
 
+  public static final int TOK_SCHEMA_TEMPLATE_CREATE = 112;
+  public static final int TOK_SCHEMA_TEMPLATE_SET = 113;
+  public static final int TOK_SCHEMA_TEMPLATE_ACTIVATE = 114;
+  public static final int TOK_SCHEMA_TEMPLATE_UNSET = 115;
+
   public static final Map<Integer, String> tokenNames = new HashMap<>();
 
   public static String[] getSingleRootArray() {
@@ -257,6 +262,11 @@ public class SQLConstant {
     tokenNames.put(TOK_SELECT_INTO, "TOK_SELECT_INTO");
 
     tokenNames.put(TOK_SETTLE, "TOK_SETTLE");
+
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_CREATE, "TOK_SCHEMA_TEMPLATE_CREATE");
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_SET, "TOK_SCHEMA_TEMPLATE_SET");
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_ACTIVATE, "TOK_SCHEMA_TEMPLATE_ACTIVATE");
+    tokenNames.put(TOK_SCHEMA_TEMPLATE_UNSET, "TOK_SCHEMA_TEMPLATE_UNSET");
   }
 
   public static boolean isReservedPath(PartialPath pathStr) {
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 2aa47ed..a7052fa 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
@@ -65,8 +65,6 @@ import org.apache.iotdb.db.qp.logical.sys.AuthorOperator.AuthorType;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
 import org.apache.iotdb.db.qp.physical.crud.AggregationPlan;
 import org.apache.iotdb.db.qp.physical.crud.AlignByDevicePlan;
-import org.apache.iotdb.db.qp.physical.crud.AppendTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.DeletePartitionPlan;
 import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
 import org.apache.iotdb.db.qp.physical.crud.FillQueryPlan;
@@ -79,20 +77,20 @@ import org.apache.iotdb.db.qp.physical.crud.InsertRowsOfOneDevicePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowsPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
 import org.apache.iotdb.db.qp.physical.crud.LastQueryPlan;
-import org.apache.iotdb.db.qp.physical.crud.PruneTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.QueryIndexPlan;
 import org.apache.iotdb.db.qp.physical.crud.QueryPlan;
 import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.UDTFPlan;
-import org.apache.iotdb.db.qp.physical.crud.UnsetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.ActivateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.AlterTimeSeriesPlan;
+import org.apache.iotdb.db.qp.physical.sys.AppendTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.AuthorPlan;
 import org.apache.iotdb.db.qp.physical.sys.CountPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateContinuousQueryPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateFunctionPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateMultiTimeSeriesPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTriggerPlan;
 import org.apache.iotdb.db.qp.physical.sys.DataAuthPlan;
@@ -106,9 +104,11 @@ import org.apache.iotdb.db.qp.physical.sys.KillQueryPlan;
 import org.apache.iotdb.db.qp.physical.sys.LoadConfigurationPlan;
 import org.apache.iotdb.db.qp.physical.sys.MergePlan;
 import org.apache.iotdb.db.qp.physical.sys.OperateFilePlan;
+import org.apache.iotdb.db.qp.physical.sys.PruneTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetSystemModePlan;
 import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.SettlePlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowChildNodesPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowChildPathsPlan;
@@ -121,6 +121,7 @@ import org.apache.iotdb.db.qp.physical.sys.ShowTTLPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.StartTriggerPlan;
 import org.apache.iotdb.db.qp.physical.sys.StopTriggerPlan;
+import org.apache.iotdb.db.qp.physical.sys.UnsetTemplatePlan;
 import org.apache.iotdb.db.query.context.QueryContext;
 import org.apache.iotdb.db.query.control.QueryTimeManager;
 import org.apache.iotdb.db.query.dataset.AlignByDeviceDataSet;
@@ -364,15 +365,17 @@ public class PlanExecutor implements IPlanExecutor {
         }
         return true;
       case CREATE_TEMPLATE:
-        return createSchemaTemplate((CreateTemplatePlan) plan);
+        return createTemplate((CreateTemplatePlan) plan);
       case APPEND_TEMPLATE:
-        return appendSchemaTemplate((AppendTemplatePlan) plan);
+        return appendTemplate((AppendTemplatePlan) plan);
       case PRUNE_TEMPLATE:
-        return pruneSchemaTemplate((PruneTemplatePlan) plan);
-      case SET_SCHEMA_TEMPLATE:
-        return setSchemaTemplate((SetSchemaTemplatePlan) plan);
-      case UNSET_SCHEMA_TEMPLATE:
-        return unsetSchemaTemplate((UnsetSchemaTemplatePlan) plan);
+        return pruneTemplate((PruneTemplatePlan) plan);
+      case SET_TEMPLATE:
+        return setTemplate((SetTemplatePlan) plan);
+      case ACTIVATE_TEMPLATE:
+        return activateTemplate((ActivateTemplatePlan) plan);
+      case UNSET_TEMPLATE:
+        return unsetTemplate((UnsetTemplatePlan) plan);
       case CREATE_CONTINUOUS_QUERY:
         return operateCreateContinuousQuery((CreateContinuousQueryPlan) plan);
       case DROP_CONTINUOUS_QUERY:
@@ -386,7 +389,7 @@ public class PlanExecutor implements IPlanExecutor {
     }
   }
 
-  private boolean createSchemaTemplate(CreateTemplatePlan createTemplatePlan)
+  private boolean createTemplate(CreateTemplatePlan createTemplatePlan)
       throws QueryProcessException {
     try {
       IoTDB.metaManager.createSchemaTemplate(createTemplatePlan);
@@ -396,7 +399,7 @@ public class PlanExecutor implements IPlanExecutor {
     return true;
   }
 
-  private boolean appendSchemaTemplate(AppendTemplatePlan plan) throws QueryProcessException {
+  private boolean appendTemplate(AppendTemplatePlan plan) throws QueryProcessException {
     try {
       IoTDB.metaManager.appendSchemaTemplate(plan);
     } catch (MetadataException e) {
@@ -405,7 +408,7 @@ public class PlanExecutor implements IPlanExecutor {
     return true;
   }
 
-  private boolean pruneSchemaTemplate(PruneTemplatePlan plan) throws QueryProcessException {
+  private boolean pruneTemplate(PruneTemplatePlan plan) throws QueryProcessException {
     try {
       IoTDB.metaManager.pruneSchemaTemplate(plan);
     } catch (MetadataException e) {
@@ -414,20 +417,28 @@ public class PlanExecutor implements IPlanExecutor {
     return true;
   }
 
-  private boolean setSchemaTemplate(SetSchemaTemplatePlan setSchemaTemplatePlan)
-      throws QueryProcessException {
+  private boolean setTemplate(SetTemplatePlan setTemplatePlan) throws QueryProcessException {
     try {
-      IoTDB.metaManager.setSchemaTemplate(setSchemaTemplatePlan);
+      IoTDB.metaManager.setSchemaTemplate(setTemplatePlan);
     } catch (MetadataException e) {
       throw new QueryProcessException(e);
     }
     return true;
   }
 
-  private boolean unsetSchemaTemplate(UnsetSchemaTemplatePlan unsetSchemaTemplatePlan)
+  private boolean activateTemplate(ActivateTemplatePlan activateTemplatePlan)
       throws QueryProcessException {
     try {
-      IoTDB.metaManager.unsetSchemaTemplate(unsetSchemaTemplatePlan);
+      IoTDB.metaManager.setUsingSchemaTemplate(activateTemplatePlan);
+    } catch (MetadataException e) {
+      throw new QueryProcessException(e);
+    }
+    return true;
+  }
+
+  private boolean unsetTemplate(UnsetTemplatePlan unsetTemplatePlan) throws QueryProcessException {
+    try {
+      IoTDB.metaManager.unsetSchemaTemplate(unsetTemplatePlan);
     } catch (MetadataException e) {
       throw new QueryProcessException(e);
     }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
index 03591e0..86c7227 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
@@ -148,8 +148,8 @@ public abstract class Operator {
     STOP_TRIGGER,
 
     CREATE_TEMPLATE,
-    SET_SCHEMA_TEMPLATE,
-    SET_USING_SCHEMA_TEMPLATE,
+    SET_TEMPLATE,
+    ACTIVATE_TEMPLATE,
 
     MERGE,
     FULL_MERGE,
@@ -175,7 +175,7 @@ public abstract class Operator {
 
     SETTLE,
 
-    UNSET_SCHEMA_TEMPLATE,
+    UNSET_TEMPLATE,
     PRUNE_TEMPLATE,
     APPEND_TEMPLATE
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/InsertOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/InsertOperator.java
index ceae6d2..2beb48f 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/InsertOperator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/InsertOperator.java
@@ -38,6 +38,8 @@ public class InsertOperator extends Operator {
   private String[] measurementList;
   private String[] valueList;
 
+  private boolean isAligned;
+
   public InsertOperator(int tokenIntType) {
     super(tokenIntType);
     operatorType = OperatorType.INSERT;
@@ -75,6 +77,14 @@ public class InsertOperator extends Operator {
     this.times = times;
   }
 
+  public boolean isAligned() {
+    return isAligned;
+  }
+
+  public void setAligned(boolean aligned) {
+    isAligned = aligned;
+  }
+
   @Override
   public PhysicalPlan generatePhysicalPlan(PhysicalGenerator generator)
       throws QueryProcessException {
@@ -93,17 +103,20 @@ public class InsertOperator extends Operator {
               measurementsNum, valueList.length));
     }
     if (measurementsNum == valueList.length) {
-      return new InsertRowPlan(device, times[0], measurementList, valueList);
+      InsertRowPlan insertRowPlan = new InsertRowPlan(device, times[0], measurementList, valueList);
+      insertRowPlan.setAligned(isAligned);
+      return insertRowPlan;
     }
     InsertRowsPlan insertRowsPlan = new InsertRowsPlan();
     for (int i = 0; i < times.length; i++) {
-      insertRowsPlan.addOneInsertRowPlan(
+      InsertRowPlan insertRowPlan =
           new InsertRowPlan(
               device,
               times[i],
               measurementList,
-              Arrays.copyOfRange(valueList, i * measurementsNum, (i + 1) * measurementsNum)),
-          i);
+              Arrays.copyOfRange(valueList, i * measurementsNum, (i + 1) * measurementsNum));
+      insertRowPlan.setAligned(isAligned);
+      insertRowsPlan.addOneInsertRowPlan(insertRowPlan, i);
     }
     return insertRowsPlan;
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ActivateTemplateOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ActivateTemplateOperator.java
new file mode 100644
index 0000000..682e832
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/ActivateTemplateOperator.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.iotdb.db.qp.logical.sys;
+
+import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.path.PartialPath;
+import org.apache.iotdb.db.qp.logical.Operator;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.db.qp.physical.sys.ActivateTemplatePlan;
+import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+
+public class ActivateTemplateOperator extends Operator {
+
+  private PartialPath prefixPath;
+
+  public ActivateTemplateOperator(int tokenIntType) {
+    super(tokenIntType);
+    operatorType = OperatorType.ACTIVATE_TEMPLATE;
+  }
+
+  public PartialPath getPrefixPath() {
+    return prefixPath;
+  }
+
+  public void setPrefixPath(PartialPath prefixPath) {
+    this.prefixPath = prefixPath;
+  }
+
+  @Override
+  public PhysicalPlan generatePhysicalPlan(PhysicalGenerator generator)
+      throws QueryProcessException {
+    return new ActivateTemplatePlan(prefixPath);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/CreateAlignedTimeSeriesOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/CreateAlignedTimeSeriesOperator.java
new file mode 100644
index 0000000..bc0b077
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/CreateAlignedTimeSeriesOperator.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.qp.logical.sys;
+
+import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.exception.runtime.SQLParserException;
+import org.apache.iotdb.db.metadata.path.PartialPath;
+import org.apache.iotdb.db.qp.logical.Operator;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
+import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class CreateAlignedTimeSeriesOperator extends Operator {
+
+  private PartialPath prefixPath;
+  private List<String> measurements = new ArrayList<>();
+  private List<TSDataType> dataTypes = new ArrayList<>();
+  private List<TSEncoding> encodings = new ArrayList<>();
+  private List<CompressionType> compressors = new ArrayList<>();
+  private List<String> aliasList = null;
+
+  public CreateAlignedTimeSeriesOperator(int tokenIntType) {
+    super(tokenIntType);
+    operatorType = OperatorType.CREATE_ALIGNED_TIMESERIES;
+  }
+
+  public PartialPath getPrefixPath() {
+    return prefixPath;
+  }
+
+  public void setPrefixPath(PartialPath prefixPath) {
+    this.prefixPath = prefixPath;
+  }
+
+  public List<String> getMeasurements() {
+    return measurements;
+  }
+
+  public void setMeasurements(List<String> measurements) {
+    this.measurements = measurements;
+  }
+
+  public void addMeasurement(String measurement) {
+    this.measurements.add(measurement);
+  }
+
+  public List<TSDataType> getDataTypes() {
+    return dataTypes;
+  }
+
+  public void setDataTypes(List<TSDataType> dataTypes) {
+    this.dataTypes = dataTypes;
+  }
+
+  public void addDataType(TSDataType dataType) {
+    this.dataTypes.add(dataType);
+  }
+
+  public List<TSEncoding> getEncodings() {
+    return encodings;
+  }
+
+  public void setEncodings(List<TSEncoding> encodings) {
+    this.encodings = encodings;
+  }
+
+  public void addEncoding(TSEncoding encoding) {
+    this.encodings.add(encoding);
+  }
+
+  public List<CompressionType> getCompressors() {
+    return compressors;
+  }
+
+  public void setCompressors(List<CompressionType> compressors) {
+    this.compressors = compressors;
+  }
+
+  public void addCompressor(CompressionType compression) {
+    this.compressors.add(compression);
+  }
+
+  public List<String> getAliasList() {
+    return aliasList;
+  }
+
+  public void setAliasList(List<String> aliasList) {
+    this.aliasList = aliasList;
+  }
+
+  public void addAliasList(String alias) {
+    this.aliasList.add(alias);
+  }
+
+  @Override
+  public PhysicalPlan generatePhysicalPlan(PhysicalGenerator generator)
+      throws QueryProcessException {
+    Set<String> measurementSet = new HashSet<>(measurements);
+    if (measurementSet.size() < measurements.size()) {
+      throw new SQLParserException(
+          "the measurement under an aligned device is not allowed to have the same measurement name");
+    }
+
+    return new CreateAlignedTimeSeriesPlan(
+        prefixPath, measurements, dataTypes, encodings, compressors, aliasList);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/CreateTemplateOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/CreateTemplateOperator.java
new file mode 100644
index 0000000..45df5bb
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/CreateTemplateOperator.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.qp.logical.sys;
+
+import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.qp.logical.Operator;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
+import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CreateTemplateOperator extends Operator {
+
+  String name;
+  List<String> schemaNames = new ArrayList<>();
+  List<List<String>> measurements = new ArrayList<>();
+  List<List<TSDataType>> dataTypes = new ArrayList<>();
+  List<List<TSEncoding>> encodings = new ArrayList<>();
+  List<List<CompressionType>> compressors = new ArrayList<>();
+
+  public CreateTemplateOperator(int tokenIntType) {
+    super(tokenIntType);
+    operatorType = OperatorType.CREATE_TEMPLATE;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public List<String> getSchemaNames() {
+    return schemaNames;
+  }
+
+  public void setSchemaNames(List<String> schemaNames) {
+    this.schemaNames = schemaNames;
+  }
+
+  public void addSchemaName(String schemaName) {
+    this.schemaNames.add(schemaName);
+  }
+
+  public List<List<String>> getMeasurements() {
+    return measurements;
+  }
+
+  public void setMeasurements(List<List<String>> measurements) {
+    this.measurements = measurements;
+  }
+
+  public void addMeasurements(List<String> measurements) {
+    this.measurements.add(measurements);
+  }
+
+  public List<List<TSDataType>> getDataTypes() {
+    return dataTypes;
+  }
+
+  public void setDataTypes(List<List<TSDataType>> dataTypes) {
+    this.dataTypes = dataTypes;
+  }
+
+  public void addDataTypes(List<TSDataType> dataTypes) {
+    this.dataTypes.add(dataTypes);
+  }
+
+  public List<List<TSEncoding>> getEncodings() {
+    return encodings;
+  }
+
+  public void setEncodings(List<List<TSEncoding>> encodings) {
+    this.encodings = encodings;
+  }
+
+  public void addEncodings(List<TSEncoding> encodings) {
+    this.encodings.add(encodings);
+  }
+
+  public List<List<CompressionType>> getCompressors() {
+    return compressors;
+  }
+
+  public void setCompressors(List<List<CompressionType>> compressors) {
+    this.compressors = compressors;
+  }
+
+  public void addCompressor(List<CompressionType> compressors) {
+    this.compressors.add(compressors);
+  }
+
+  @Override
+  public PhysicalPlan generatePhysicalPlan(PhysicalGenerator generator)
+      throws QueryProcessException {
+    return new CreateTemplatePlan(
+        name, schemaNames, measurements, dataTypes, encodings, compressors);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/SetTemplateOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/SetTemplateOperator.java
new file mode 100644
index 0000000..a768207
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/SetTemplateOperator.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.qp.logical.sys;
+
+import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.path.PartialPath;
+import org.apache.iotdb.db.qp.logical.Operator;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
+import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+
+public class SetTemplateOperator extends Operator {
+
+  String templateName;
+  PartialPath prefixPath;
+
+  public SetTemplateOperator(int tokenIntType) {
+    super(tokenIntType);
+    operatorType = OperatorType.SET_TEMPLATE;
+  }
+
+  public String getTemplateName() {
+    return templateName;
+  }
+
+  public void setTemplateName(String templateName) {
+    this.templateName = templateName;
+  }
+
+  public PartialPath getPrefixPath() {
+    return prefixPath;
+  }
+
+  public void setPrefixPath(PartialPath prefixPath) {
+    this.prefixPath = prefixPath;
+  }
+
+  @Override
+  public PhysicalPlan generatePhysicalPlan(PhysicalGenerator generator)
+      throws QueryProcessException {
+    return new SetTemplatePlan(templateName, prefixPath.toString());
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/UnsetTemplateOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/UnsetTemplateOperator.java
new file mode 100644
index 0000000..45df9b7
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/sys/UnsetTemplateOperator.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.qp.logical.sys;
+
+import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.metadata.path.PartialPath;
+import org.apache.iotdb.db.qp.logical.Operator;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.db.qp.physical.sys.UnsetTemplatePlan;
+import org.apache.iotdb.db.qp.strategy.PhysicalGenerator;
+
+public class UnsetTemplateOperator extends Operator {
+
+  PartialPath prefixPath;
+  String templateName;
+
+  public UnsetTemplateOperator(int tokenIntType) {
+    super(tokenIntType);
+    operatorType = OperatorType.UNSET_TEMPLATE;
+  }
+
+  public PartialPath getPrefixPath() {
+    return prefixPath;
+  }
+
+  public void setPrefixPath(PartialPath prefixPath) {
+    this.prefixPath = prefixPath;
+  }
+
+  public String getTemplateName() {
+    return templateName;
+  }
+
+  public void setTemplateName(String templateName) {
+    this.templateName = templateName;
+  }
+
+  @Override
+  public PhysicalPlan generatePhysicalPlan(PhysicalGenerator generator)
+      throws QueryProcessException {
+    return new UnsetTemplatePlan(prefixPath.toString(), templateName);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/PhysicalPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/PhysicalPlan.java
index b1bdbba..777bbfe 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/PhysicalPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/PhysicalPlan.java
@@ -23,18 +23,16 @@ import org.apache.iotdb.db.exception.query.QueryProcessException;
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.qp.logical.Operator;
 import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
-import org.apache.iotdb.db.qp.physical.crud.AppendTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertMultiTabletPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowsOfOneDevicePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowsPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
-import org.apache.iotdb.db.qp.physical.crud.PruneTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.SelectIntoPlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.ActivateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.AlterTimeSeriesPlan;
+import org.apache.iotdb.db.qp.physical.sys.AppendTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.AuthorPlan;
 import org.apache.iotdb.db.qp.physical.sys.AutoCreateDeviceMNodePlan;
 import org.apache.iotdb.db.qp.physical.sys.ChangeAliasPlan;
@@ -46,6 +44,7 @@ import org.apache.iotdb.db.qp.physical.sys.CreateFunctionPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateIndexPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateMultiTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateSnapshotPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTriggerPlan;
 import org.apache.iotdb.db.qp.physical.sys.DataAuthPlan;
@@ -61,10 +60,11 @@ import org.apache.iotdb.db.qp.physical.sys.LogPlan;
 import org.apache.iotdb.db.qp.physical.sys.MNodePlan;
 import org.apache.iotdb.db.qp.physical.sys.MeasurementMNodePlan;
 import org.apache.iotdb.db.qp.physical.sys.MergePlan;
+import org.apache.iotdb.db.qp.physical.sys.PruneTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetSystemModePlan;
 import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
-import org.apache.iotdb.db.qp.physical.sys.SetUsingSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowDevicesPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.StartTriggerPlan;
@@ -412,11 +412,11 @@ public abstract class PhysicalPlan {
         case PRUNE_TEMPLATE:
           plan = new PruneTemplatePlan();
           break;
-        case SET_SCHEMA_TEMPLATE:
-          plan = new SetSchemaTemplatePlan();
+        case SET_TEMPLATE:
+          plan = new SetTemplatePlan();
           break;
-        case SET_USING_SCHEMA_TEMPLATE:
-          plan = new SetUsingSchemaTemplatePlan();
+        case ACTIVATE_TEMPLATE:
+          plan = new ActivateTemplatePlan();
           break;
         case AUTO_CREATE_DEVICE_MNODE:
           plan = new AutoCreateDeviceMNodePlan();
@@ -496,8 +496,8 @@ public abstract class PhysicalPlan {
     BATCH_INSERT_ROWS,
     SHOW_DEVICES,
     CREATE_TEMPLATE,
-    SET_SCHEMA_TEMPLATE,
-    SET_USING_SCHEMA_TEMPLATE,
+    SET_TEMPLATE,
+    ACTIVATE_TEMPLATE,
     AUTO_CREATE_DEVICE_MNODE,
     CREATE_ALIGNED_TIMESERIES,
     CLUSTER_LOG,
@@ -515,7 +515,7 @@ public abstract class PhysicalPlan {
     DROP_FUNCTION,
     SELECT_INTO,
     SET_SYSTEM_MODE,
-    UNSET_SCHEMA_TEMPLATE,
+    UNSET_TEMPLATE,
     APPEND_TEMPLATE,
     PRUNE_TEMPLATE
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/SetUsingSchemaTemplatePlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ActivateTemplatePlan.java
similarity index 80%
rename from server/src/main/java/org/apache/iotdb/db/qp/physical/sys/SetUsingSchemaTemplatePlan.java
rename to server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ActivateTemplatePlan.java
index aac9be0..9f1b27c 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/SetUsingSchemaTemplatePlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ActivateTemplatePlan.java
@@ -33,17 +33,17 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.List;
 
-public class SetUsingSchemaTemplatePlan extends PhysicalPlan {
+public class ActivateTemplatePlan extends PhysicalPlan {
 
-  private static final Logger logger = LoggerFactory.getLogger(SetUsingSchemaTemplatePlan.class);
+  private static final Logger logger = LoggerFactory.getLogger(ActivateTemplatePlan.class);
   PartialPath prefixPath;
 
-  public SetUsingSchemaTemplatePlan() {
-    super(false, OperatorType.SET_USING_SCHEMA_TEMPLATE);
+  public ActivateTemplatePlan() {
+    super(false, OperatorType.ACTIVATE_TEMPLATE);
   }
 
-  public SetUsingSchemaTemplatePlan(PartialPath prefixPath) {
-    super(false, OperatorType.SET_USING_SCHEMA_TEMPLATE);
+  public ActivateTemplatePlan(PartialPath prefixPath) {
+    super(false, OperatorType.ACTIVATE_TEMPLATE);
     this.prefixPath = prefixPath;
   }
 
@@ -58,7 +58,7 @@ public class SetUsingSchemaTemplatePlan extends PhysicalPlan {
 
   @Override
   public void serialize(ByteBuffer buffer) {
-    buffer.put((byte) PhysicalPlanType.SET_USING_SCHEMA_TEMPLATE.ordinal());
+    buffer.put((byte) PhysicalPlanType.ACTIVATE_TEMPLATE.ordinal());
     ReadWriteIOUtils.write(prefixPath.getFullPath(), buffer);
     buffer.putLong(index);
   }
@@ -76,7 +76,7 @@ public class SetUsingSchemaTemplatePlan extends PhysicalPlan {
 
   @Override
   public void serialize(DataOutputStream stream) throws IOException {
-    stream.writeByte((byte) PhysicalPlanType.SET_USING_SCHEMA_TEMPLATE.ordinal());
+    stream.writeByte((byte) PhysicalPlanType.ACTIVATE_TEMPLATE.ordinal());
     ReadWriteIOUtils.write(prefixPath.getFullPath(), stream);
     stream.writeLong(index);
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/AppendTemplatePlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/AppendTemplatePlan.java
similarity index 99%
rename from server/src/main/java/org/apache/iotdb/db/qp/physical/crud/AppendTemplatePlan.java
rename to server/src/main/java/org/apache/iotdb/db/qp/physical/sys/AppendTemplatePlan.java
index 4adb985..0c8632a 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/AppendTemplatePlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/AppendTemplatePlan.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.iotdb.db.qp.physical.crud;
+package org.apache.iotdb.db.qp.physical.sys;
 
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateAlignedTimeSeriesPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateAlignedTimeSeriesPlan.java
index c77c600..76e4369 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateAlignedTimeSeriesPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateAlignedTimeSeriesPlan.java
@@ -46,7 +46,7 @@ public class CreateAlignedTimeSeriesPlan extends PhysicalPlan {
   private List<String> measurements;
   private List<TSDataType> dataTypes;
   private List<TSEncoding> encodings;
-  private CompressionType compressor;
+  private List<CompressionType> compressors;
   private List<String> aliasList;
 
   public CreateAlignedTimeSeriesPlan() {
@@ -59,14 +59,14 @@ public class CreateAlignedTimeSeriesPlan extends PhysicalPlan {
       List<String> measurements,
       List<TSDataType> dataTypes,
       List<TSEncoding> encodings,
-      CompressionType compressor,
+      List<CompressionType> compressors,
       List<String> aliasList) {
     super(false, Operator.OperatorType.CREATE_ALIGNED_TIMESERIES);
     this.prefixPath = prefixPath;
     this.measurements = measurements;
     this.dataTypes = dataTypes;
     this.encodings = encodings;
-    this.compressor = compressor;
+    this.compressors = compressors;
     this.aliasList = aliasList;
     this.canBeSplit = false;
   }
@@ -103,12 +103,12 @@ public class CreateAlignedTimeSeriesPlan extends PhysicalPlan {
     this.encodings = encodings;
   }
 
-  public CompressionType getCompressor() {
-    return compressor;
+  public List<CompressionType> getCompressors() {
+    return compressors;
   }
 
-  public void setCompressor(CompressionType compressor) {
-    this.compressor = compressor;
+  public void setCompressors(List<CompressionType> compressor) {
+    this.compressors = compressors;
   }
 
   public List<String> getAliasList() {
@@ -122,8 +122,8 @@ public class CreateAlignedTimeSeriesPlan extends PhysicalPlan {
   @Override
   public String toString() {
     return String.format(
-        "devicePath: %s, measurements: %s, dataTypes: %s, encodings: %s, compression: %s",
-        prefixPath, measurements, dataTypes, encodings, compressor);
+        "devicePath: %s, measurements: %s, dataTypes: %s, encodings: %s, compressions: %s",
+        prefixPath, measurements, dataTypes, encodings, compressors);
   }
 
   @Override
@@ -156,7 +156,9 @@ public class CreateAlignedTimeSeriesPlan extends PhysicalPlan {
     for (TSEncoding encoding : encodings) {
       stream.write(encoding.ordinal());
     }
-    stream.write(compressor.ordinal());
+    for (CompressionType compressor : compressors) {
+      stream.write(compressor.ordinal());
+    }
 
     // alias
     if (aliasList != null) {
@@ -187,7 +189,9 @@ public class CreateAlignedTimeSeriesPlan extends PhysicalPlan {
     for (TSEncoding encoding : encodings) {
       buffer.put((byte) encoding.ordinal());
     }
-    buffer.put((byte) compressor.ordinal());
+    for (CompressionType compressor : compressors) {
+      buffer.put((byte) compressor.ordinal());
+    }
 
     // alias
     if (aliasList != null) {
@@ -222,7 +226,10 @@ public class CreateAlignedTimeSeriesPlan extends PhysicalPlan {
     for (int i = 0; i < size; i++) {
       encodings.add(TSEncoding.values()[buffer.get()]);
     }
-    compressor = CompressionType.values()[buffer.get()];
+    compressors = new ArrayList<>();
+    for (int i = 0; i < size; i++) {
+      compressors.add(CompressionType.values()[buffer.get()]);
+    }
 
     // alias
     if (buffer.get() == 1) {
@@ -249,11 +256,11 @@ public class CreateAlignedTimeSeriesPlan extends PhysicalPlan {
         && Objects.equals(measurements, that.measurements)
         && Objects.equals(dataTypes, that.dataTypes)
         && Objects.equals(encodings, that.encodings)
-        && compressor == that.compressor;
+        && Objects.equals(compressors, that.compressors);
   }
 
   @Override
   public int hashCode() {
-    return Objects.hash(prefixPath, measurements, dataTypes, encodings, compressor);
+    return Objects.hash(prefixPath, measurements, dataTypes, encodings, compressors);
   }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/CreateTemplatePlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateTemplatePlan.java
similarity index 99%
rename from server/src/main/java/org/apache/iotdb/db/qp/physical/crud/CreateTemplatePlan.java
rename to server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateTemplatePlan.java
index c51a60c..59f1a93 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/CreateTemplatePlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/CreateTemplatePlan.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.iotdb.db.qp.physical.crud;
+package org.apache.iotdb.db.qp.physical.sys;
 
 import org.apache.iotdb.db.exception.metadata.MetadataException;
 import org.apache.iotdb.db.metadata.path.PartialPath;
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/PruneTemplatePlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/PruneTemplatePlan.java
similarity index 98%
rename from server/src/main/java/org/apache/iotdb/db/qp/physical/crud/PruneTemplatePlan.java
rename to server/src/main/java/org/apache/iotdb/db/qp/physical/sys/PruneTemplatePlan.java
index c6d18af..5750b63 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/PruneTemplatePlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/PruneTemplatePlan.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.iotdb.db.qp.physical.crud;
+package org.apache.iotdb.db.qp.physical.sys;
 
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/SetSchemaTemplatePlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/SetTemplatePlan.java
similarity index 83%
rename from server/src/main/java/org/apache/iotdb/db/qp/physical/crud/SetSchemaTemplatePlan.java
rename to server/src/main/java/org/apache/iotdb/db/qp/physical/sys/SetTemplatePlan.java
index e700c65..76b1f64 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/SetSchemaTemplatePlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/SetTemplatePlan.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.iotdb.db.qp.physical.crud;
+package org.apache.iotdb.db.qp.physical.sys;
 
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
@@ -29,16 +29,16 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.List;
 
-public class SetSchemaTemplatePlan extends PhysicalPlan {
+public class SetTemplatePlan extends PhysicalPlan {
   String templateName;
   String prefixPath;
 
-  public SetSchemaTemplatePlan() {
-    super(false, OperatorType.SET_SCHEMA_TEMPLATE);
+  public SetTemplatePlan() {
+    super(false, OperatorType.SET_TEMPLATE);
   }
 
-  public SetSchemaTemplatePlan(String templateName, String prefixPath) {
-    super(false, OperatorType.SET_SCHEMA_TEMPLATE);
+  public SetTemplatePlan(String templateName, String prefixPath) {
+    super(false, OperatorType.SET_TEMPLATE);
     this.templateName = templateName;
     this.prefixPath = prefixPath;
   }
@@ -66,7 +66,7 @@ public class SetSchemaTemplatePlan extends PhysicalPlan {
 
   @Override
   public void serialize(ByteBuffer buffer) {
-    buffer.put((byte) PhysicalPlanType.SET_SCHEMA_TEMPLATE.ordinal());
+    buffer.put((byte) PhysicalPlanType.SET_TEMPLATE.ordinal());
 
     ReadWriteIOUtils.write(templateName, buffer);
     ReadWriteIOUtils.write(prefixPath, buffer);
@@ -84,7 +84,7 @@ public class SetSchemaTemplatePlan extends PhysicalPlan {
 
   @Override
   public void serialize(DataOutputStream stream) throws IOException {
-    stream.writeByte((byte) PhysicalPlanType.SET_SCHEMA_TEMPLATE.ordinal());
+    stream.writeByte((byte) PhysicalPlanType.SET_TEMPLATE.ordinal());
 
     ReadWriteIOUtils.write(templateName, stream);
     ReadWriteIOUtils.write(prefixPath, stream);
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UnsetSchemaTemplatePlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/UnsetTemplatePlan.java
similarity index 82%
rename from server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UnsetSchemaTemplatePlan.java
rename to server/src/main/java/org/apache/iotdb/db/qp/physical/sys/UnsetTemplatePlan.java
index 7522748..2d18d66 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/UnsetSchemaTemplatePlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/UnsetTemplatePlan.java
@@ -18,7 +18,7 @@
  *
  */
 
-package org.apache.iotdb.db.qp.physical.crud;
+package org.apache.iotdb.db.qp.physical.sys;
 
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.qp.logical.Operator;
@@ -30,17 +30,17 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.List;
 
-public class UnsetSchemaTemplatePlan extends PhysicalPlan {
+public class UnsetTemplatePlan extends PhysicalPlan {
 
   String prefixPath;
   String templateName;
 
-  public UnsetSchemaTemplatePlan() {
-    super(false, Operator.OperatorType.UNSET_SCHEMA_TEMPLATE);
+  public UnsetTemplatePlan() {
+    super(false, Operator.OperatorType.UNSET_TEMPLATE);
   }
 
-  public UnsetSchemaTemplatePlan(String prefixPath, String templateName) {
-    super(false, Operator.OperatorType.UNSET_SCHEMA_TEMPLATE);
+  public UnsetTemplatePlan(String prefixPath, String templateName) {
+    super(false, Operator.OperatorType.UNSET_TEMPLATE);
     this.prefixPath = prefixPath;
     this.templateName = templateName;
   }
@@ -68,7 +68,7 @@ public class UnsetSchemaTemplatePlan extends PhysicalPlan {
 
   @Override
   public void serialize(ByteBuffer buffer) {
-    buffer.put((byte) PhysicalPlanType.UNSET_SCHEMA_TEMPLATE.ordinal());
+    buffer.put((byte) PhysicalPlanType.UNSET_TEMPLATE.ordinal());
 
     ReadWriteIOUtils.write(prefixPath, buffer);
     ReadWriteIOUtils.write(templateName, buffer);
@@ -86,7 +86,7 @@ public class UnsetSchemaTemplatePlan extends PhysicalPlan {
 
   @Override
   public void serialize(DataOutputStream stream) throws IOException {
-    stream.writeByte((byte) PhysicalPlanType.UNSET_SCHEMA_TEMPLATE.ordinal());
+    stream.writeByte((byte) PhysicalPlanType.UNSET_TEMPLATE.ordinal());
 
     ReadWriteIOUtils.write(prefixPath, stream);
     ReadWriteIOUtils.write(templateName, stream);
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java b/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
index 5f672da..efbf534 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/sql/IoTDBSqlVisitor.java
@@ -51,15 +51,18 @@ import org.apache.iotdb.db.qp.logical.crud.SelectIntoOperator;
 import org.apache.iotdb.db.qp.logical.crud.SpecialClauseComponent;
 import org.apache.iotdb.db.qp.logical.crud.UDFQueryOperator;
 import org.apache.iotdb.db.qp.logical.crud.WhereComponent;
+import org.apache.iotdb.db.qp.logical.sys.ActivateTemplateOperator;
 import org.apache.iotdb.db.qp.logical.sys.AlterTimeSeriesOperator;
 import org.apache.iotdb.db.qp.logical.sys.AlterTimeSeriesOperator.AlterType;
 import org.apache.iotdb.db.qp.logical.sys.AuthorOperator;
 import org.apache.iotdb.db.qp.logical.sys.AuthorOperator.AuthorType;
 import org.apache.iotdb.db.qp.logical.sys.ClearCacheOperator;
 import org.apache.iotdb.db.qp.logical.sys.CountOperator;
+import org.apache.iotdb.db.qp.logical.sys.CreateAlignedTimeSeriesOperator;
 import org.apache.iotdb.db.qp.logical.sys.CreateContinuousQueryOperator;
 import org.apache.iotdb.db.qp.logical.sys.CreateFunctionOperator;
 import org.apache.iotdb.db.qp.logical.sys.CreateSnapshotOperator;
+import org.apache.iotdb.db.qp.logical.sys.CreateTemplateOperator;
 import org.apache.iotdb.db.qp.logical.sys.CreateTimeSeriesOperator;
 import org.apache.iotdb.db.qp.logical.sys.CreateTriggerOperator;
 import org.apache.iotdb.db.qp.logical.sys.DataAuthOperator;
@@ -80,6 +83,7 @@ import org.apache.iotdb.db.qp.logical.sys.RemoveFileOperator;
 import org.apache.iotdb.db.qp.logical.sys.SetStorageGroupOperator;
 import org.apache.iotdb.db.qp.logical.sys.SetSystemModeOperator;
 import org.apache.iotdb.db.qp.logical.sys.SetTTLOperator;
+import org.apache.iotdb.db.qp.logical.sys.SetTemplateOperator;
 import org.apache.iotdb.db.qp.logical.sys.SettleOperator;
 import org.apache.iotdb.db.qp.logical.sys.ShowChildNodesOperator;
 import org.apache.iotdb.db.qp.logical.sys.ShowChildPathsOperator;
@@ -97,6 +101,7 @@ import org.apache.iotdb.db.qp.logical.sys.StartTriggerOperator;
 import org.apache.iotdb.db.qp.logical.sys.StopTriggerOperator;
 import org.apache.iotdb.db.qp.logical.sys.UnSetTTLOperator;
 import org.apache.iotdb.db.qp.logical.sys.UnloadFileOperator;
+import org.apache.iotdb.db.qp.logical.sys.UnsetTemplateOperator;
 import org.apache.iotdb.db.qp.sql.IoTDBSqlParser.ConstantContext;
 import org.apache.iotdb.db.qp.utils.DatetimeUtils;
 import org.apache.iotdb.db.query.executor.fill.IFill;
@@ -126,15 +131,7 @@ import org.antlr.v4.runtime.tree.TerminalNode;
 
 import java.io.File;
 import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -200,22 +197,41 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   // Create Timeseries
 
   @Override
-  public Operator visitCreateTimeseries(IoTDBSqlParser.CreateTimeseriesContext ctx) {
+  public Operator visitCreateNonAlignedTimeseries(
+      IoTDBSqlParser.CreateNonAlignedTimeseriesContext ctx) {
     CreateTimeSeriesOperator createTimeSeriesOperator =
         new CreateTimeSeriesOperator(SQLConstant.TOK_METADATA_CREATE);
     createTimeSeriesOperator.setPath(parseFullPath(ctx.fullPath()));
-    if (ctx.alias() != null) {
-      createTimeSeriesOperator.setAlias(parseStringWithQuotes(ctx.alias().ID().getText()));
-    }
     if (ctx.attributeClauses() != null) {
       parseAttributeClauses(ctx.attributeClauses(), createTimeSeriesOperator);
     }
     return createTimeSeriesOperator;
   }
 
+  @Override
+  public Operator visitCreateAlignedTimeseries(IoTDBSqlParser.CreateAlignedTimeseriesContext ctx) {
+    CreateAlignedTimeSeriesOperator createAlignedTimeSeriesOperator =
+        new CreateAlignedTimeSeriesOperator(SQLConstant.TOK_METADATA_CREATE);
+    createAlignedTimeSeriesOperator.setPrefixPath(parseFullPath(ctx.fullPath()));
+    parseAlignedMeasurements(ctx.alignedMeasurements(), createAlignedTimeSeriesOperator);
+    return createAlignedTimeSeriesOperator;
+  }
+
+  public void parseAlignedMeasurements(
+      IoTDBSqlParser.AlignedMeasurementsContext ctx,
+      CreateAlignedTimeSeriesOperator createAlignedTimeSeriesOperator) {
+    for (int i = 0; i < ctx.nodeNameWithoutWildcard().size(); i++) {
+      createAlignedTimeSeriesOperator.addMeasurement(ctx.nodeNameWithoutWildcard(i).getText());
+      parseAttributeClauses(ctx.attributeClauses(i), createAlignedTimeSeriesOperator);
+    }
+  }
+
   public void parseAttributeClauses(
       IoTDBSqlParser.AttributeClausesContext ctx,
       CreateTimeSeriesOperator createTimeSeriesOperator) {
+    if (ctx.alias() != null) {
+      createTimeSeriesOperator.setAlias(parseStringWithQuotes(ctx.alias().ID().getText()));
+    }
     final String dataType = ctx.dataType.getText().toUpperCase();
     final TSDataType tsDataType = TSDataType.valueOf(dataType);
     createTimeSeriesOperator.setDataType(tsDataType);
@@ -254,13 +270,145 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     }
   }
 
-  public void parseAttributeClause(IoTDBSqlParser.AttributeClauseContext ctx, Operator operator) {
-    Map<String, String> attributes = extractMap(ctx.propertyClause(), ctx.propertyClause(0));
-    if (operator instanceof CreateTimeSeriesOperator) {
-      ((CreateTimeSeriesOperator) operator).setAttributes(attributes);
-    } else if (operator instanceof AlterTimeSeriesOperator) {
-      ((AlterTimeSeriesOperator) operator).setAttributesMap(attributes);
+  public void parseAttributeClauses(
+      IoTDBSqlParser.AttributeClausesContext ctx,
+      CreateAlignedTimeSeriesOperator createAlignedTimeSeriesOperator) {
+    if (ctx.alias() != null) {
+      throw new SQLParserException("create aligned timeseries: alias is not supported yet.");
+    }
+
+    String dataTypeString = ctx.dataType.getText().toUpperCase();
+    TSDataType dataType = TSDataType.valueOf(dataTypeString);
+    createAlignedTimeSeriesOperator.addDataType(dataType);
+
+    TSEncoding encoding = IoTDBDescriptor.getInstance().getDefaultEncodingByType(dataType);
+    if (Objects.nonNull(ctx.encoding)) {
+      String encodingString = ctx.encoding.getText().toUpperCase();
+      encoding = TSEncoding.valueOf(encodingString);
+    }
+    createAlignedTimeSeriesOperator.addEncoding(encoding);
+
+    CompressionType compressor = TSFileDescriptor.getInstance().getConfig().getCompressor();
+    if (ctx.compressor != null) {
+      String compressorString = ctx.compressor.getText().toUpperCase();
+      compressor = CompressionType.valueOf(compressorString);
+    }
+    createAlignedTimeSeriesOperator.addCompressor(compressor);
+
+    if (ctx.propertyClause(0) != null) {
+      throw new SQLParserException("create aligned timeseries: property is not supported yet.");
+    }
+
+    if (ctx.tagClause() != null) {
+      throw new SQLParserException("create aligned timeseries: tag is not supported yet.");
+    }
+
+    if (ctx.attributeClause() != null) {
+      throw new SQLParserException("create aligned timeseries: attribute is not supported yet.");
+    }
+  }
+
+  // Create Schema Template
+  @Override
+  public Operator visitCreateSchemaTemplate(IoTDBSqlParser.CreateSchemaTemplateContext ctx) {
+    CreateTemplateOperator createTemplateOperator =
+        new CreateTemplateOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_CREATE);
+    createTemplateOperator.setName(ctx.templateName.getText());
+    for (IoTDBSqlParser.TemplateMeasurementClauseContext templateClauseContext :
+        ctx.templateMeasurementClause()) {
+      parseTemplateMeasurementClause(templateClauseContext, createTemplateOperator);
+    }
+    return createTemplateOperator;
+  }
+
+  private void parseTemplateMeasurementClause(
+      IoTDBSqlParser.TemplateMeasurementClauseContext ctx,
+      CreateTemplateOperator createTemplateOperator) {
+    String schemaName;
+    List<String> measurements = new ArrayList<>();
+    List<TSDataType> dataTypes = new ArrayList<>();
+    List<TSEncoding> encodings = new ArrayList<>();
+    List<CompressionType> compressors = new ArrayList<>();
+    if (ctx instanceof IoTDBSqlParser.AlignedTemplateMeasurementContext) {
+      // aligned measurement
+      List<IoTDBSqlParser.NodeNameWithoutWildcardContext> measurementList =
+          ((IoTDBSqlParser.AlignedTemplateMeasurementContext) ctx).nodeNameWithoutWildcard();
+      List<IoTDBSqlParser.AttributeClausesContext> attributeList =
+          ((IoTDBSqlParser.AlignedTemplateMeasurementContext) ctx).attributeClauses();
+      schemaName = measurementList.get(0).getText();
+      for (int i = 0; i < attributeList.size(); i++) {
+        measurements.add(measurementList.get(i + 1).getText());
+        parseAttributeClause(attributeList.get(i), dataTypes, encodings, compressors);
+      }
+    } else {
+      // non-aligned template measurement
+      schemaName =
+          ((IoTDBSqlParser.NonAlignedTemplateMeasurementContext) ctx)
+              .nodeNameWithoutWildcard()
+              .getText();
+      measurements.add(schemaName);
+      parseAttributeClause(
+          ((IoTDBSqlParser.NonAlignedTemplateMeasurementContext) ctx).attributeClauses(),
+          dataTypes,
+          encodings,
+          compressors);
+    }
+    createTemplateOperator.addSchemaName(schemaName);
+    createTemplateOperator.addMeasurements(measurements);
+    createTemplateOperator.addDataTypes(dataTypes);
+    createTemplateOperator.addEncodings(encodings);
+    createTemplateOperator.addCompressor(compressors);
+  }
+
+  void parseAttributeClause(
+      IoTDBSqlParser.AttributeClausesContext ctx,
+      List<TSDataType> dataTypes,
+      List<TSEncoding> encodings,
+      List<CompressionType> compressors) {
+    if (ctx.alias() != null) {
+      throw new SQLParserException("schema template: alias is not supported yet.");
     }
+
+    String dataTypeString = ctx.dataType.getText().toUpperCase();
+    TSDataType dataType = TSDataType.valueOf(dataTypeString);
+    dataTypes.add(dataType);
+
+    TSEncoding encoding = IoTDBDescriptor.getInstance().getDefaultEncodingByType(dataType);
+    if (Objects.nonNull(ctx.encoding)) {
+      String encodingString = ctx.encoding.getText().toUpperCase();
+      encoding = TSEncoding.valueOf(encodingString);
+    }
+    encodings.add(encoding);
+
+    CompressionType compressor = TSFileDescriptor.getInstance().getConfig().getCompressor();
+    if (ctx.compressor != null) {
+      String compressorString = ctx.compressor.getText().toUpperCase();
+      compressor = CompressionType.valueOf(compressorString);
+    }
+    compressors.add(compressor);
+
+    if (ctx.propertyClause(0) != null) {
+      throw new SQLParserException("schema template: property is not supported yet.");
+    }
+
+    if (ctx.tagClause() != null) {
+      throw new SQLParserException("schema template: tag is not supported yet.");
+    }
+
+    if (ctx.attributeClause() != null) {
+      throw new SQLParserException("schema template: attribute is not supported yet.");
+    }
+  }
+
+  // Create Timeseries Of Schema Template
+
+  @Override
+  public Operator visitCreateTimeseriesOfSchemaTemplate(
+      IoTDBSqlParser.CreateTimeseriesOfSchemaTemplateContext ctx) {
+    ActivateTemplateOperator operator =
+        new ActivateTemplateOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_ACTIVATE);
+    operator.setPrefixPath(parsePrefixPath(ctx.prefixPath()));
+    return operator;
   }
 
   // Create Function
@@ -598,6 +746,26 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     return operator;
   }
 
+  // Set Schema Template
+  @Override
+  public Operator visitSetSchemaTemplate(IoTDBSqlParser.SetSchemaTemplateContext ctx) {
+    SetTemplateOperator operator = new SetTemplateOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_SET);
+    operator.setPrefixPath(parsePrefixPath(ctx.prefixPath()));
+    operator.setTemplateName(ctx.templateName.getText());
+    return operator;
+  }
+
+  // Unset Schema Template
+
+  @Override
+  public Operator visitUnsetSchemaTemplate(IoTDBSqlParser.UnsetSchemaTemplateContext ctx) {
+    UnsetTemplateOperator operator =
+        new UnsetTemplateOperator(SQLConstant.TOK_SCHEMA_TEMPLATE_UNSET);
+    operator.setPrefixPath(parsePrefixPath(ctx.prefixPath()));
+    operator.setTemplateName(ctx.templateName.getText());
+    return operator;
+  }
+
   // Start Trigger
 
   @Override
@@ -1333,6 +1501,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     insertOp.setDevice(parsePrefixPath(ctx.prefixPath()));
     parseInsertColumnSpec(ctx.insertColumnsSpec(), insertOp);
     parseInsertValuesSpec(ctx.insertValuesSpec(), insertOp);
+    insertOp.setAligned(ctx.ALIGNED() != null);
     return insertOp;
   }
 
@@ -2327,6 +2496,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
   }
 
   // From Clause
+
   public void parseFromClause(IoTDBSqlParser.FromClauseContext ctx) {
     FromComponent fromComponent = new FromComponent();
     List<IoTDBSqlParser.PrefixPathContext> prefixFromPaths = ctx.prefixPath();
@@ -2349,7 +2519,7 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     return new WhereComponent(whereOp.getChildren().get(0));
   }
 
-  // Tag & Property Clause
+  // Tag & Property & Attribute
 
   public void parseTagClause(IoTDBSqlParser.TagClauseContext ctx, Operator operator) {
     Map<String, String> tags = extractMap(ctx.propertyClause(), ctx.propertyClause(0));
@@ -2360,6 +2530,15 @@ public class IoTDBSqlVisitor extends IoTDBSqlParserBaseVisitor<Operator> {
     }
   }
 
+  public void parseAttributeClause(IoTDBSqlParser.AttributeClauseContext ctx, Operator operator) {
+    Map<String, String> attributes = extractMap(ctx.propertyClause(), ctx.propertyClause(0));
+    if (operator instanceof CreateTimeSeriesOperator) {
+      ((CreateTimeSeriesOperator) operator).setAttributes(attributes);
+    } else if (operator instanceof AlterTimeSeriesOperator) {
+      ((AlterTimeSeriesOperator) operator).setAttributesMap(attributes);
+    }
+  }
+
   // Limit & Offset Clause
 
   private void parseLimitClause(IoTDBSqlParser.LimitClauseContext ctx, Operator operator) {
diff --git a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 7d09ed3..505c5a9 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -43,8 +43,6 @@ import org.apache.iotdb.db.qp.logical.Operator.OperatorType;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
 import org.apache.iotdb.db.qp.physical.crud.AggregationPlan;
 import org.apache.iotdb.db.qp.physical.crud.AlignByDevicePlan;
-import org.apache.iotdb.db.qp.physical.crud.AppendTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertMultiTabletPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
@@ -53,21 +51,23 @@ import org.apache.iotdb.db.qp.physical.crud.InsertRowsPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
 import org.apache.iotdb.db.qp.physical.crud.LastQueryPlan;
 import org.apache.iotdb.db.qp.physical.crud.MeasurementInfo;
-import org.apache.iotdb.db.qp.physical.crud.PruneTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.QueryPlan;
 import org.apache.iotdb.db.qp.physical.crud.SelectIntoPlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.UDFPlan;
-import org.apache.iotdb.db.qp.physical.crud.UnsetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.AppendTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.AuthorPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateMultiTimeSeriesPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.DeleteTimeSeriesPlan;
+import org.apache.iotdb.db.qp.physical.sys.PruneTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowQueryProcesslistPlan;
+import org.apache.iotdb.db.qp.physical.sys.UnsetTemplatePlan;
 import org.apache.iotdb.db.query.aggregation.AggregateResult;
 import org.apache.iotdb.db.query.context.QueryContext;
 import org.apache.iotdb.db.query.control.tracing.TracingConstant;
@@ -1717,7 +1717,7 @@ public class TSServiceImpl extends BasicServiceProvider implements TSIService.If
                 req.prefixPath + "." + req.measurements.get(0),
                 req.dataTypes.get(0),
                 req.encodings.get(0),
-                req.compressor));
+                req.compressors.get(0)));
       }
 
       if (AUDIT_LOGGER.isDebugEnabled()) {
@@ -1736,6 +1736,10 @@ public class TSServiceImpl extends BasicServiceProvider implements TSIService.If
       for (int encoding : req.encodings) {
         encodings.add(TSEncoding.values()[encoding]);
       }
+      List<CompressionType> compressors = new ArrayList<>();
+      for (int compressor : req.compressors) {
+        compressors.add(CompressionType.values()[compressor]);
+      }
 
       CreateAlignedTimeSeriesPlan plan =
           new CreateAlignedTimeSeriesPlan(
@@ -1743,7 +1747,7 @@ public class TSServiceImpl extends BasicServiceProvider implements TSIService.If
               req.measurements,
               dataTypes,
               encodings,
-              CompressionType.values()[req.compressor],
+              compressors,
               req.measurementAlias);
       TSStatus status = checkAuthority(plan, req.getSessionId());
       return status != null ? status : executeNonQueryPlan(plan);
@@ -2005,7 +2009,7 @@ public class TSServiceImpl extends BasicServiceProvider implements TSIService.If
           req.getPrefixPath());
     }
 
-    SetSchemaTemplatePlan plan = new SetSchemaTemplatePlan(req.templateName, req.prefixPath);
+    SetTemplatePlan plan = new SetTemplatePlan(req.templateName, req.prefixPath);
     TSStatus status = checkAuthority(plan, req.getSessionId());
     return status != null ? status : executeNonQueryPlan(plan);
   }
@@ -2024,7 +2028,7 @@ public class TSServiceImpl extends BasicServiceProvider implements TSIService.If
           req.getTemplateName());
     }
 
-    UnsetSchemaTemplatePlan plan = new UnsetSchemaTemplatePlan(req.prefixPath, req.templateName);
+    UnsetTemplatePlan plan = new UnsetTemplatePlan(req.prefixPath, req.templateName);
     TSStatus status = checkAuthority(plan, req.getSessionId());
     return status != null ? status : executeNonQueryPlan(plan);
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/tools/mlog/MLogParser.java b/server/src/main/java/org/apache/iotdb/db/tools/mlog/MLogParser.java
index e3f7a33..672defa 100644
--- a/server/src/main/java/org/apache/iotdb/db/tools/mlog/MLogParser.java
+++ b/server/src/main/java/org/apache/iotdb/db/tools/mlog/MLogParser.java
@@ -22,22 +22,22 @@ import org.apache.iotdb.db.metadata.logfile.MLogReader;
 import org.apache.iotdb.db.metadata.logfile.MLogTxtWriter;
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
-import org.apache.iotdb.db.qp.physical.crud.AppendTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.PruneTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.ActivateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.AppendTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.AutoCreateDeviceMNodePlan;
 import org.apache.iotdb.db.qp.physical.sys.ChangeAliasPlan;
 import org.apache.iotdb.db.qp.physical.sys.ChangeTagOffsetPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateContinuousQueryPlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.DropContinuousQueryPlan;
 import org.apache.iotdb.db.qp.physical.sys.MNodePlan;
 import org.apache.iotdb.db.qp.physical.sys.MeasurementMNodePlan;
+import org.apache.iotdb.db.qp.physical.sys.PruneTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.SetStorageGroupPlan;
 import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
-import org.apache.iotdb.db.qp.physical.sys.SetUsingSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.StorageGroupMNodePlan;
 
 import org.apache.commons.cli.CommandLine;
@@ -217,19 +217,18 @@ public class MLogParser {
             mLogTxtWriter.dropContinuousQuery((DropContinuousQueryPlan) plan);
             break;
           case CREATE_TEMPLATE:
-            mLogTxtWriter.createTemplate((CreateTemplatePlan) plan);
+            mLogTxtWriter.createSchemaTemplate((CreateTemplatePlan) plan);
             break;
           case APPEND_TEMPLATE:
             mLogTxtWriter.appendTemplate((AppendTemplatePlan) plan);
             break;
           case PRUNE_TEMPLATE:
             mLogTxtWriter.pruneTemplate((PruneTemplatePlan) plan);
+          case SET_TEMPLATE:
+            mLogTxtWriter.setTemplate((SetTemplatePlan) plan);
             break;
-          case SET_SCHEMA_TEMPLATE:
-            mLogTxtWriter.setTemplate((SetSchemaTemplatePlan) plan);
-            break;
-          case SET_USING_SCHEMA_TEMPLATE:
-            mLogTxtWriter.setUsingTemplate((SetUsingSchemaTemplatePlan) plan);
+          case ACTIVATE_TEMPLATE:
+            mLogTxtWriter.setUsingTemplate((ActivateTemplatePlan) plan);
             break;
           case AUTO_CREATE_DEVICE_MNODE:
             mLogTxtWriter.autoCreateDeviceNode(
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateAlignedTimeseriesIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateAlignedTimeseriesIT.java
new file mode 100644
index 0000000..8b21ee4
--- /dev/null
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBCreateAlignedTimeseriesIT.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+import org.apache.iotdb.jdbc.IoTDBSQLException;
+
+import org.junit.*;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+/**
+ * Notice that, all test begins with "IoTDB" is integration test. All test which will start the
+ * IoTDB server should be defined as integration test.
+ */
+public class IoTDBCreateAlignedTimeseriesIT {
+
+  private Statement statement;
+  private Connection connection;
+
+  @Before
+  public void setUp() throws Exception {
+    EnvironmentUtils.envSetUp();
+
+    Class.forName(Config.JDBC_DRIVER_NAME);
+    connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
+    statement = connection.createStatement();
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    statement.close();
+    connection.close();
+    EnvironmentUtils.cleanEnv();
+  }
+
+  @Test
+  public void testCreateAlignedTimeseries() throws Exception {
+    String[] timeSeriesArray =
+        new String[] {
+          "root.sg1.d1.vector1.s1,FLOAT,PLAIN,UNCOMPRESSED",
+          "root.sg1.d1.vector1.s2,INT64,RLE,SNAPPY"
+        };
+
+    statement.execute("SET STORAGE GROUP TO root.sg1");
+    try {
+      statement.execute(
+          "CREATE ALIGNED TIMESERIES root.sg1.d1.vector1(s1 FLOAT encoding=PLAIN compressor=UNCOMPRESSED,s2 INT64 encoding=RLE)");
+    } catch (IoTDBSQLException ignored) {
+    }
+
+    // ensure that current storage group in cache is right.
+    assertTimeseriesEquals(timeSeriesArray);
+
+    statement.close();
+    connection.close();
+    EnvironmentUtils.stopDaemon();
+    setUp();
+
+    // ensure storage group in cache is right after recovering.
+    assertTimeseriesEquals(timeSeriesArray);
+  }
+
+  private void assertTimeseriesEquals(String[] timeSeriesArray) throws SQLException {
+    boolean hasResult = statement.execute("SHOW TIMESERIES");
+    Assert.assertTrue(hasResult);
+
+    int count = 0;
+    try (ResultSet resultSet = statement.getResultSet()) {
+      while (resultSet.next()) {
+        String ActualResult =
+            resultSet.getString("timeseries")
+                + ","
+                + resultSet.getString("dataType")
+                + ","
+                + resultSet.getString("encoding")
+                + ","
+                + resultSet.getString("compression");
+        Assert.assertEquals(timeSeriesArray[count], ActualResult);
+        count++;
+      }
+    }
+    Assert.assertEquals(timeSeriesArray.length, count);
+  }
+}
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSchemaTemplateIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSchemaTemplateIT.java
new file mode 100644
index 0000000..e369280
--- /dev/null
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBSchemaTemplateIT.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.integration;
+
+import org.apache.iotdb.db.utils.EnvironmentUtils;
+import org.apache.iotdb.jdbc.Config;
+import org.apache.iotdb.jdbc.IoTDBSQLException;
+
+import org.junit.*;
+
+import java.sql.*;
+
+/**
+ * Notice that, all test begins with "IoTDB" is integration test. All test which will start the
+ * IoTDB server should be defined as integration test.
+ */
+public class IoTDBSchemaTemplateIT {
+
+  private Statement statement;
+  private Connection connection;
+
+  @Before
+  public void setUp() throws Exception {
+    EnvironmentUtils.envSetUp();
+
+    Class.forName(Config.JDBC_DRIVER_NAME);
+    connection = DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
+    statement = connection.createStatement();
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    statement.close();
+    connection.close();
+    EnvironmentUtils.cleanEnv();
+  }
+
+  @Test
+  @Ignore
+  public void testCreateTemplateAndCreateTimeseries() throws SQLException {
+    statement.execute("CREATE STORAGE GROUP root.sg1");
+
+    // create schema template
+    statement.execute(
+        "CREATE SCHEMA TEMPLATE temp1 (s1 INT64 encoding=RLE compressor=SNAPPY, vector1(s1 FLOAT, s2 INT64))");
+
+    // test create schema template repeatedly
+    try {
+      statement.execute(
+          "CREATE SCHEMA TEMPLATE temp1 (s1 INT64 encoding=RLE compressor=SNAPPY, vector1(s1 FLOAT, s2 INT64))");
+    } catch (IoTDBSQLException e) {
+      Assert.assertEquals("303: Duplicated template name: temp1", e.getMessage());
+    }
+
+    // set schema template
+    statement.execute("SET SCHEMA TEMPLATE temp1 TO root.sg1");
+
+    statement.execute("SHOW TIMESERIES root.sg1.**");
+    try (ResultSet resultSet = statement.getResultSet()) {
+      Assert.assertFalse(resultSet.next());
+    }
+
+    // create timeseries of schema template
+    statement.execute("CREATE TIMESERIES OF SCHEMA TEMPLATE ON root.sg1");
+
+    boolean hasResult = statement.execute("SHOW TIMESERIES root.sg1.**");
+    Assert.assertTrue(hasResult);
+
+    String[] expectedResult =
+        new String[] {
+          "root.sg1.vector1.s1,FLOAT,GORILLA,SNAPPY",
+          "root.sg1.vector1.s2,INT64,RLE,SNAPPY",
+          "root.sg1.s1,INT64,RLE,SNAPPY"
+        };
+
+    int count = 0;
+    try (ResultSet resultSet = statement.getResultSet()) {
+      while (resultSet.next()) {
+        String ActualResult =
+            resultSet.getString("timeseries")
+                + ","
+                + resultSet.getString("dataType")
+                + ","
+                + resultSet.getString("encoding")
+                + ","
+                + resultSet.getString("compression");
+        Assert.assertEquals(expectedResult[count], ActualResult);
+        count++;
+      }
+    }
+    Assert.assertEquals(3, count);
+
+    try {
+      statement.execute("UNSET SCHEMA TEMPLATE temp1 FROM root.sg1");
+    } catch (IoTDBSQLException e) {
+      Assert.assertEquals("326: Template is in use on root.sg1", e.getMessage());
+    }
+  }
+
+  @Test
+  @Ignore
+  public void testCreateAndSetSchemaTemplate() throws SQLException {
+    statement.execute("CREATE STORAGE GROUP root.sg1");
+
+    // create schema template
+    statement.execute(
+        "CREATE SCHEMA TEMPLATE temp1 (s1 INT64 encoding=RLE compressor=SNAPPY, vector1(s1 FLOAT, s2 INT64))");
+
+    // test create schema template repeatedly
+    try {
+      statement.execute(
+          "CREATE SCHEMA TEMPLATE temp1 (s1 INT64 encoding=RLE compressor=SNAPPY, vector1(s1 FLOAT, s2 INT64))");
+    } catch (IoTDBSQLException e) {
+      Assert.assertEquals("303: Duplicated template name: temp1", e.getMessage());
+    }
+
+    // set schema template
+    statement.execute("SET SCHEMA TEMPLATE temp1 TO root.sg1");
+
+    statement.execute("SHOW TIMESERIES root.sg1.**");
+    try (ResultSet resultSet = statement.getResultSet()) {
+      Assert.assertFalse(resultSet.next());
+    }
+
+    // set using schema template
+    statement.execute("INSERT INTO root.sg1.d1(time,s1) VALUES (1,1)");
+
+    boolean hasResult = statement.execute("SHOW TIMESERIES root.sg1.**");
+    Assert.assertTrue(hasResult);
+
+    String[] expectedResult =
+        new String[] {
+          "root.sg1.d1.vector1.s1,FLOAT,GORILLA,SNAPPY",
+          "root.sg1.d1.vector1.s2,INT64,RLE,SNAPPY",
+          "root.sg1.d1.s1,INT64,RLE,SNAPPY"
+        };
+
+    int count = 0;
+    try (ResultSet resultSet = statement.getResultSet()) {
+      while (resultSet.next()) {
+        String ActualResult =
+            resultSet.getString("timeseries")
+                + ","
+                + resultSet.getString("dataType")
+                + ","
+                + resultSet.getString("encoding")
+                + ","
+                + resultSet.getString("compression");
+        Assert.assertEquals(expectedResult[count], ActualResult);
+        count++;
+      }
+    }
+    Assert.assertEquals(3, count);
+
+    try {
+      statement.execute("UNSET SCHEMA TEMPLATE temp1 FROM root.sg1");
+    } catch (IoTDBSQLException e) {
+      Assert.assertEquals("326: Template is in use on root.sg1.d1", e.getMessage());
+    }
+  }
+}
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
index e4257c3..434e803 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
@@ -29,13 +29,13 @@ import org.apache.iotdb.db.metadata.path.MeasurementPath;
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.metadata.template.Template;
 import org.apache.iotdb.db.metadata.utils.MetaUtils;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.UnsetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowTimeSeriesPlan;
+import org.apache.iotdb.db.qp.physical.sys.UnsetTemplatePlan;
 import org.apache.iotdb.db.query.dataset.ShowTimeSeriesResult;
 import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
@@ -276,7 +276,7 @@ public class MManagerBasicTest {
               TSDataType.valueOf("INT32")),
           Arrays.asList(
               TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-          compressionType);
+          Arrays.asList(compressionType, compressionType, compressionType));
     } catch (MetadataException e) {
       e.printStackTrace();
       fail(e.getMessage());
@@ -317,7 +317,7 @@ public class MManagerBasicTest {
               TSDataType.valueOf("INT32")),
           Arrays.asList(
               TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-          compressionType);
+          Arrays.asList(compressionType, compressionType, compressionType));
     } catch (MetadataException e) {
       e.printStackTrace();
       fail(e.getMessage());
@@ -857,10 +857,9 @@ public class MManagerBasicTest {
     manager.createSchemaTemplate(plan);
 
     // set device template
-    SetSchemaTemplatePlan setSchemaTemplatePlan =
-        new SetSchemaTemplatePlan("template1", "root.sg1.d1");
+    SetTemplatePlan setTemplatePlan = new SetTemplatePlan("template1", "root.sg1.d1");
 
-    manager.setSchemaTemplate(setSchemaTemplatePlan);
+    manager.setSchemaTemplate(setTemplatePlan);
 
     IMNode node = manager.getDeviceNode(new PartialPath("root.sg1.d1"));
     node = manager.setUsingSchemaTemplate(node);
@@ -1053,31 +1052,29 @@ public class MManagerBasicTest {
             dataTypeList,
             encodingList,
             compressionTypes);
-    SetSchemaTemplatePlan setSchemaTemplatePlan =
-        new SetSchemaTemplatePlan("template1", "root.sg.1");
-    UnsetSchemaTemplatePlan unsetSchemaTemplatePlan =
-        new UnsetSchemaTemplatePlan("root.sg.1", "template1");
+    SetTemplatePlan setTemplatePlan = new SetTemplatePlan("template1", "root.sg.1");
+    UnsetTemplatePlan unsetTemplatePlan = new UnsetTemplatePlan("root.sg.1", "template1");
     MManager manager = IoTDB.metaManager;
     manager.createSchemaTemplate(createTemplatePlan);
 
     // path does not exist test
     try {
-      manager.unsetSchemaTemplate(unsetSchemaTemplatePlan);
+      manager.unsetSchemaTemplate(unsetTemplatePlan);
       fail("No exception thrown.");
     } catch (Exception e) {
       assertEquals("Path [root.sg.1] does not exist", e.getMessage());
     }
 
-    manager.setSchemaTemplate(setSchemaTemplatePlan);
+    manager.setSchemaTemplate(setTemplatePlan);
 
     // template unset test
-    manager.unsetSchemaTemplate(unsetSchemaTemplatePlan);
-    manager.setSchemaTemplate(setSchemaTemplatePlan);
+    manager.unsetSchemaTemplate(unsetTemplatePlan);
+    manager.setSchemaTemplate(setTemplatePlan);
 
     // no template on path test
-    manager.unsetSchemaTemplate(unsetSchemaTemplatePlan);
+    manager.unsetSchemaTemplate(unsetTemplatePlan);
     try {
-      manager.unsetSchemaTemplate(unsetSchemaTemplatePlan);
+      manager.unsetSchemaTemplate(unsetTemplatePlan);
       fail("No exception thrown.");
     } catch (Exception e) {
       assertEquals("NO template on root.sg.1", e.getMessage());
@@ -1091,10 +1088,9 @@ public class MManagerBasicTest {
     manager.createSchemaTemplate(plan);
 
     // set device template
-    SetSchemaTemplatePlan setSchemaTemplatePlan =
-        new SetSchemaTemplatePlan("template1", "root.sg1.d1");
+    SetTemplatePlan setTemplatePlan = new SetTemplatePlan("template1", "root.sg1.d1");
 
-    manager.setSchemaTemplate(setSchemaTemplatePlan);
+    manager.setSchemaTemplate(setTemplatePlan);
 
     CreateTimeSeriesPlan createTimeSeriesPlan =
         new CreateTimeSeriesPlan(
@@ -1137,8 +1133,7 @@ public class MManagerBasicTest {
     manager.createSchemaTemplate(plan);
 
     // set device template
-    SetSchemaTemplatePlan setSchemaTemplatePlan =
-        new SetSchemaTemplatePlan("template1", "root.sg1.d1");
+    SetTemplatePlan setTemplatePlan = new SetTemplatePlan("template1", "root.sg1.d1");
 
     CreateTimeSeriesPlan createTimeSeriesPlan =
         new CreateTimeSeriesPlan(
@@ -1154,7 +1149,7 @@ public class MManagerBasicTest {
     manager.createTimeseries(createTimeSeriesPlan);
 
     try {
-      manager.setSchemaTemplate(setSchemaTemplatePlan);
+      manager.setSchemaTemplate(setTemplatePlan);
       fail();
     } catch (MetadataException e) {
       assertEquals(
@@ -1232,13 +1227,13 @@ public class MManagerBasicTest {
     encodingList.get(1).add(TSEncoding.RLE);
     compressionTypes.get(1).add(CompressionType.SNAPPY);
 
-    SetSchemaTemplatePlan setPlan1 = new SetSchemaTemplatePlan("template1", "root.sg1");
-    SetSchemaTemplatePlan setPlan2 = new SetSchemaTemplatePlan("template2", "root.sg2.d1");
+    SetTemplatePlan setPlan1 = new SetTemplatePlan("template1", "root.sg1");
+    SetTemplatePlan setPlan2 = new SetTemplatePlan("template2", "root.sg2.d1");
 
-    SetSchemaTemplatePlan setPlan3 = new SetSchemaTemplatePlan("template1", "root.sg1.d1");
-    SetSchemaTemplatePlan setPlan4 = new SetSchemaTemplatePlan("template2", "root.sg2");
+    SetTemplatePlan setPlan3 = new SetTemplatePlan("template1", "root.sg1.d1");
+    SetTemplatePlan setPlan4 = new SetTemplatePlan("template2", "root.sg2");
 
-    SetSchemaTemplatePlan setPlan5 = new SetSchemaTemplatePlan("template2", "root.sg1.d1");
+    SetTemplatePlan setPlan5 = new SetTemplatePlan("template2", "root.sg1.d1");
 
     MManager manager = IoTDB.metaManager;
 
@@ -1339,9 +1334,8 @@ public class MManagerBasicTest {
       manager.createSchemaTemplate(plan);
 
       // set device template
-      SetSchemaTemplatePlan setSchemaTemplatePlan =
-          new SetSchemaTemplatePlan("template1", "root.laptop.d1");
-      manager.setSchemaTemplate(setSchemaTemplatePlan);
+      SetTemplatePlan setTemplatePlan = new SetTemplatePlan("template1", "root.laptop.d1");
+      manager.setSchemaTemplate(setTemplatePlan);
       manager.setUsingSchemaTemplate(manager.getDeviceNode(new PartialPath("root.laptop.d1")));
 
       // show timeseries root.laptop.d1.s0
@@ -1421,9 +1415,8 @@ public class MManagerBasicTest {
       manager.createSchemaTemplate(plan);
 
       // set device template
-      SetSchemaTemplatePlan setSchemaTemplatePlan =
-          new SetSchemaTemplatePlan("template1", "root.laptop.d1");
-      manager.setSchemaTemplate(setSchemaTemplatePlan);
+      SetTemplatePlan setTemplatePlan = new SetTemplatePlan("template1", "root.laptop.d1");
+      manager.setSchemaTemplate(setTemplatePlan);
       manager.setUsingSchemaTemplate(manager.getDeviceNode(new PartialPath("root.laptop.d1")));
 
       manager.createTimeseries(
@@ -1433,8 +1426,8 @@ public class MManagerBasicTest {
           CompressionType.GZIP,
           null);
 
-      setSchemaTemplatePlan = new SetSchemaTemplatePlan("template1", "root.computer");
-      manager.setSchemaTemplate(setSchemaTemplatePlan);
+      setTemplatePlan = new SetTemplatePlan("template1", "root.computer");
+      manager.setSchemaTemplate(setTemplatePlan);
       manager.setUsingSchemaTemplate(manager.getDeviceNode(new PartialPath("root.computer.d1")));
 
       Assert.assertEquals(2, manager.getAllTimeseriesCount(new PartialPath("root.laptop.d1.**")));
@@ -1487,9 +1480,8 @@ public class MManagerBasicTest {
     try {
       manager.createSchemaTemplate(plan);
       // set device template
-      SetSchemaTemplatePlan setSchemaTemplatePlan =
-          new SetSchemaTemplatePlan("template1", "root.laptop.d1");
-      manager.setSchemaTemplate(setSchemaTemplatePlan);
+      SetTemplatePlan setTemplatePlan = new SetTemplatePlan("template1", "root.laptop.d1");
+      manager.setSchemaTemplate(setTemplatePlan);
       manager.setUsingSchemaTemplate(manager.getDeviceNode(new PartialPath("root.laptop.d1")));
 
       manager.createTimeseries(
@@ -1620,7 +1612,7 @@ public class MManagerBasicTest {
               TSDataType.valueOf("INT32")),
           Arrays.asList(
               TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-          compressionType);
+          Arrays.asList(compressionType, compressionType, compressionType));
 
       // construct an insertRowPlan with mismatched data type
       long time = 1L;
@@ -1671,7 +1663,7 @@ public class MManagerBasicTest {
               TSDataType.valueOf("INT32")),
           Arrays.asList(
               TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-          compressionType);
+          Arrays.asList(compressionType, compressionType, compressionType));
 
       // construct an insertRowPlan with mismatched data type
       long time = 1L;
@@ -1806,7 +1798,7 @@ public class MManagerBasicTest {
                 TSDataType.valueOf("INT32")),
             Arrays.asList(
                 TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-            compressionType);
+            Arrays.asList(compressionType, compressionType, compressionType));
         fail();
       } catch (Exception e) {
         Assert.assertEquals(
@@ -1829,7 +1821,7 @@ public class MManagerBasicTest {
                 TSDataType.valueOf("INT32")),
             Arrays.asList(
                 TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-            compressionType);
+            Arrays.asList(compressionType, compressionType, compressionType));
         fail();
       } catch (Exception e) {
         Assert.assertEquals(String.format("%s is an illegal name.", measurementId), e.getMessage());
@@ -1971,7 +1963,7 @@ public class MManagerBasicTest {
 
     CreateTemplatePlan plan = getCreateTemplatePlan("s1");
     manager.createSchemaTemplate(plan);
-    SetSchemaTemplatePlan setPlan = new SetSchemaTemplatePlan("template1", "root.sg.d1");
+    SetTemplatePlan setPlan = new SetTemplatePlan("template1", "root.sg.d1");
     manager.setSchemaTemplate(setPlan);
     manager.createTimeseries(
         new PartialPath("root.sg.d1.s2"),
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/TemplateTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/TemplateTest.java
index 3a89875..9d82894 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/TemplateTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/TemplateTest.java
@@ -26,8 +26,8 @@ import org.apache.iotdb.db.metadata.path.MeasurementPath;
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.metadata.template.Template;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
@@ -75,10 +75,9 @@ public class TemplateTest {
     manager.createSchemaTemplate(plan);
 
     // set device template
-    SetSchemaTemplatePlan setSchemaTemplatePlan =
-        new SetSchemaTemplatePlan("template1", "root.sg1.d1");
+    SetTemplatePlan setTemplatePlan = new SetTemplatePlan("template1", "root.sg1.d1");
 
-    manager.setSchemaTemplate(setSchemaTemplatePlan);
+    manager.setSchemaTemplate(setTemplatePlan);
 
     IMNode node = manager.getDeviceNode(new PartialPath("root.sg1.d1"));
     node = manager.setUsingSchemaTemplate(node);
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/mlog/MLogUpgraderTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/mlog/MLogUpgraderTest.java
index 456a2a9..ab03fb0 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/mlog/MLogUpgraderTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/mlog/MLogUpgraderTest.java
@@ -27,7 +27,7 @@ import org.apache.iotdb.db.metadata.logfile.MLogUpgrader;
 import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.metadata.tag.TagLogFile;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
 import org.apache.iotdb.db.qp.physical.sys.ShowTimeSeriesPlan;
 import org.apache.iotdb.db.query.dataset.ShowTimeSeriesResult;
diff --git a/server/src/test/java/org/apache/iotdb/db/qp/physical/InsertRowPlanTest.java b/server/src/test/java/org/apache/iotdb/db/qp/physical/InsertRowPlanTest.java
index 4c42ee5..158367b 100644
--- a/server/src/test/java/org/apache/iotdb/db/qp/physical/InsertRowPlanTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/qp/physical/InsertRowPlanTest.java
@@ -27,10 +27,10 @@ import org.apache.iotdb.db.metadata.path.PartialPath;
 import org.apache.iotdb.db.qp.Planner;
 import org.apache.iotdb.db.qp.executor.PlanExecutor;
 import org.apache.iotdb.db.qp.physical.PhysicalPlan.PhysicalPlanType;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
 import org.apache.iotdb.db.qp.physical.crud.QueryPlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.tsfile.exception.filter.QueryFilterOptimizationException;
@@ -148,7 +148,7 @@ public class InsertRowPlanTest {
             compressionTypes);
 
     IoTDB.metaManager.createSchemaTemplate(plan);
-    IoTDB.metaManager.setSchemaTemplate(new SetSchemaTemplatePlan("template1", "root.isp.d1"));
+    IoTDB.metaManager.setSchemaTemplate(new SetTemplatePlan("template1", "root.isp.d1"));
 
     IoTDBDescriptor.getInstance().getConfig().setAutoCreateSchemaEnabled(false);
 
diff --git a/server/src/test/java/org/apache/iotdb/db/qp/physical/PhysicalPlanSerializeTest.java b/server/src/test/java/org/apache/iotdb/db/qp/physical/PhysicalPlanSerializeTest.java
index e912c24..4244c1b 100644
--- a/server/src/test/java/org/apache/iotdb/db/qp/physical/PhysicalPlanSerializeTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/qp/physical/PhysicalPlanSerializeTest.java
@@ -198,7 +198,7 @@ public class PhysicalPlanSerializeTest {
             Arrays.asList("s1", "s2"),
             Arrays.asList(TSDataType.DOUBLE, TSDataType.INT32),
             Arrays.asList(TSEncoding.RLE, TSEncoding.RLE),
-            CompressionType.SNAPPY,
+            Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY),
             null);
 
     PhysicalPlan result = testTwoSerializeMethodAndDeserialize(createAlignedTimeSeriesPlan);
diff --git a/server/src/test/java/org/apache/iotdb/db/tools/MLogParserTest.java b/server/src/test/java/org/apache/iotdb/db/tools/MLogParserTest.java
index f765464..f7ab8ac 100644
--- a/server/src/test/java/org/apache/iotdb/db/tools/MLogParserTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/tools/MLogParserTest.java
@@ -23,10 +23,10 @@ import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.exception.metadata.MetadataException;
 import org.apache.iotdb.db.metadata.MetadataConstant;
 import org.apache.iotdb.db.metadata.path.PartialPath;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
-import org.apache.iotdb.db.qp.physical.crud.SetSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.ActivateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
-import org.apache.iotdb.db.qp.physical.sys.SetUsingSchemaTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.SetTemplatePlan;
 import org.apache.iotdb.db.service.IoTDB;
 import org.apache.iotdb.db.tools.mlog.MLogParser;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
@@ -102,18 +102,17 @@ public class MLogParserTest {
 
     try {
       IoTDB.metaManager.setStorageGroup(new PartialPath("root.sg"));
-      IoTDB.metaManager.createSchemaTemplate(genCreateTemplatePlan());
-      SetSchemaTemplatePlan setSchemaTemplatePlan =
-          new SetSchemaTemplatePlan("template1", "root.sg");
-      IoTDB.metaManager.setSchemaTemplate(setSchemaTemplatePlan);
+      IoTDB.metaManager.createSchemaTemplate(genCreateSchemaTemplatePlan());
+      SetTemplatePlan setTemplatePlan = new SetTemplatePlan("template1", "root.sg");
+      IoTDB.metaManager.setSchemaTemplate(setTemplatePlan);
       IoTDB.metaManager.setUsingSchemaTemplate(
-          new SetUsingSchemaTemplatePlan(new PartialPath("root.sg.d1")));
+          new ActivateTemplatePlan(new PartialPath("root.sg.d1")));
     } catch (MetadataException e) {
       e.printStackTrace();
     }
   }
 
-  private CreateTemplatePlan genCreateTemplatePlan() {
+  private CreateTemplatePlan genCreateSchemaTemplatePlan() {
     List<List<String>> measurementList = new ArrayList<>();
     measurementList.add(Collections.singletonList("s11"));
     measurementList.add(Collections.singletonList("s12"));
diff --git a/session/src/main/java/org/apache/iotdb/session/Session.java b/session/src/main/java/org/apache/iotdb/session/Session.java
index 27908a1..fca13f4 100644
--- a/session/src/main/java/org/apache/iotdb/session/Session.java
+++ b/session/src/main/java/org/apache/iotdb/session/Session.java
@@ -476,7 +476,7 @@ public class Session {
       List<String> multiMeasurementComponents,
       List<TSDataType> dataTypes,
       List<TSEncoding> encodings,
-      CompressionType compressor,
+      List<CompressionType> compressors,
       List<String> measurementAliasList)
       throws IoTDBConnectionException, StatementExecutionException {
     TSCreateAlignedTimeseriesReq request =
@@ -485,7 +485,7 @@ public class Session {
             multiMeasurementComponents,
             dataTypes,
             encodings,
-            compressor,
+            compressors,
             measurementAliasList);
     defaultSessionConnection.createAlignedTimeseries(request);
   }
@@ -495,14 +495,15 @@ public class Session {
       List<String> measurements,
       List<TSDataType> dataTypes,
       List<TSEncoding> encodings,
-      CompressionType compressor,
+      List<CompressionType> compressors,
       List<String> measurementAliasList) {
     TSCreateAlignedTimeseriesReq request = new TSCreateAlignedTimeseriesReq();
     request.setPrefixPath(prefixPath);
     request.setMeasurements(measurements);
     request.setDataTypes(dataTypes.stream().map(TSDataType::ordinal).collect(Collectors.toList()));
     request.setEncodings(encodings.stream().map(TSEncoding::ordinal).collect(Collectors.toList()));
-    request.setCompressor(compressor.ordinal());
+    request.setCompressors(
+        compressors.stream().map(CompressionType::ordinal).collect(Collectors.toList()));
     request.setMeasurementAlias(measurementAliasList);
     return request;
   }
diff --git a/session/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java b/session/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
index a866a15..546e2b7 100644
--- a/session/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
+++ b/session/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
@@ -985,7 +985,7 @@ public class IoTDBSessionSimpleIT {
           measurements,
           tsDataTypes,
           tsEncodings,
-          CompressionType.SNAPPY,
+          compressionTypes,
           Arrays.asList("alias1", "alias2", "alias3"));
       fail("Exception expected");
     } catch (StatementExecutionException e) {
diff --git a/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorABDeviceIT.java b/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorABDeviceIT.java
index ac63410..5271028 100644
--- a/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorABDeviceIT.java
+++ b/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorABDeviceIT.java
@@ -195,11 +195,13 @@ public class IoTDBSessionVectorABDeviceIT {
     dataTypes.add(TSDataType.INT64);
     dataTypes.add(TSDataType.INT64);
     List<TSEncoding> encodings = new ArrayList<>();
+    List<CompressionType> compressors = new ArrayList<>();
     for (int i = 1; i <= 2; i++) {
       encodings.add(TSEncoding.RLE);
+      compressors.add(CompressionType.SNAPPY);
     }
     session.createAlignedTimeseries(
-        ROOT_SG1_D1, measurements, dataTypes, encodings, CompressionType.SNAPPY, null);
+        ROOT_SG1_D1, measurements, dataTypes, encodings, compressors, null);
   }
 
   private static void prepareAlignedTimeSeriesData()
diff --git a/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorAggregationWithUnSeqIT.java b/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorAggregationWithUnSeqIT.java
index 3a65871..5785310 100644
--- a/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorAggregationWithUnSeqIT.java
+++ b/session/src/test/java/org/apache/iotdb/session/IoTDBSessionVectorAggregationWithUnSeqIT.java
@@ -150,11 +150,13 @@ public class IoTDBSessionVectorAggregationWithUnSeqIT {
     dataTypes.add(TSDataType.INT64);
     dataTypes.add(TSDataType.INT64);
     List<TSEncoding> encodings = new ArrayList<>();
+    List<CompressionType> compressors = new ArrayList<>();
     for (int i = 1; i <= 2; i++) {
       encodings.add(TSEncoding.RLE);
+      compressors.add(CompressionType.SNAPPY);
     }
     session.createAlignedTimeseries(
-        ROOT_SG1_D1_VECTOR1, measurements, dataTypes, encodings, CompressionType.SNAPPY, null);
+        ROOT_SG1_D1_VECTOR1, measurements, dataTypes, encodings, compressors, null);
   }
 
   private static void prepareAlignedTimeseriesDataWithUnSeq()
diff --git a/session/src/test/java/org/apache/iotdb/session/template/TemplateUT.java b/session/src/test/java/org/apache/iotdb/session/template/TemplateUT.java
index d62fa3e..2cf0289 100644
--- a/session/src/test/java/org/apache/iotdb/session/template/TemplateUT.java
+++ b/session/src/test/java/org/apache/iotdb/session/template/TemplateUT.java
@@ -20,7 +20,7 @@ package org.apache.iotdb.session.template;
 
 import org.apache.iotdb.db.conf.IoTDBConstant;
 import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.qp.physical.crud.CreateTemplatePlan;
+import org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.rpc.StatementExecutionException;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
diff --git a/thrift/rpc-changelist.md b/thrift/rpc-changelist.md
index 229db48..6597785 100644
--- a/thrift/rpc-changelist.md
+++ b/thrift/rpc-changelist.md
@@ -21,7 +21,7 @@
 
 # 0.12.x(version-1) -> 0.13.x(version-SNAPSHOT)
 
-Last Updated on 2021.11.8 by Xin Zhao.
+Last Updated on 2021.11.16 by Minghui Liu.
 
 ## 1. Delete Old
 
@@ -40,7 +40,7 @@ Last Updated on 2021.11.8 by Xin Zhao.
 | Latest Changes                                               | Related Committers |
 | ------------------------------------------------------------ | ------------------ |
 | Change schemaNames from required to optional in TSCreateSchemaTemplateReq | Xin Zhao           |
-
+| Change TSCreateAlignedTimeseriesReq, from `i32 compressor` to `List<i32> compressors`  | Minghui Liu|
 
 # 0.11.x(version-2) -> 0.12.x(version-1)
 
diff --git a/thrift/src/main/thrift/rpc.thrift b/thrift/src/main/thrift/rpc.thrift
index ec82439..7a30ad8 100644
--- a/thrift/src/main/thrift/rpc.thrift
+++ b/thrift/src/main/thrift/rpc.thrift
@@ -303,7 +303,7 @@ struct TSCreateAlignedTimeseriesReq {
   3: required list<string> measurements
   4: required list<i32> dataTypes
   5: required list<i32> encodings
-  6: required i32 compressor
+  6: required list<i32> compressors
   7: optional list<string> measurementAlias
 }