You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ju...@apache.org on 2025/10/23 10:01:21 UTC

(iotdb) branch master updated: Revert "Refactored IoTDB codes (#16644)" (#16645)

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

justinchen 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 8867ab60185 Revert "Refactored IoTDB codes (#16644)" (#16645)
8867ab60185 is described below

commit 8867ab601856c3f8b22e1e736a9449fb949503d9
Author: Caideyipi <87...@users.noreply.github.com>
AuthorDate: Thu Oct 23 18:01:15 2025 +0800

    Revert "Refactored IoTDB codes (#16644)" (#16645)
    
    This reverts commit e15fb6aa22760040a289d65d77539de47239195a.
---
 .../db/it/aligned/IoTDBInsertAlignedValuesIT.java  |  86 +--
 .../apache/iotdb/db/it/query/IoTDBResultSetIT.java |   4 +-
 .../iotdb/db/it/selectinto/IoTDBSelectIntoIT.java  |  60 +-
 .../client-py/tests/integration/test_dataframe.py  |   2 +-
 .../org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4   |  42 +-
 .../antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4  |   8 +-
 .../schema/mnode/factory/ConfigMNodeFactory.java   |   8 +-
 .../impl/schema/DeleteLogicalViewProcedure.java    |   4 +-
 .../schemaregion/SchemaExecutionVisitor.java       |  28 +-
 .../metadata/DuplicateInsertException.java         |  70 +--
 .../metadata/view/BrokenViewException.java         |  64 +--
 .../view/InsertNonWritableViewException.java       |  66 +--
 .../metadata/view/UnsupportedViewException.java    |  80 +--
 .../view/ViewContainsAggregationException.java     |  58 +-
 .../metadata/view/ViewNotExistException.java       |  90 +--
 .../common/schematree/ClusterSchemaTree.java       | 100 ++--
 .../common/schematree/DeviceSchemaInfo.java        |   6 +-
 .../common/schematree/IMeasurementSchemaInfo.java  |  16 +-
 .../queryengine/common/schematree/ISchemaTree.java |  12 +-
 .../common/schematree/MeasurementSchemaInfo.java   |  50 +-
 .../schematree/node/SchemaMeasurementNode.java     |  82 +--
 .../execution/executor/RegionWriteExecutor.java    |  48 +-
 .../schema/source/LogicalViewSchemaSource.java     |   2 +-
 .../schema/source/TimeSeriesSchemaSource.java      |   4 +-
 .../db/queryengine/plan/analyze/Analysis.java      |  44 +-
 .../queryengine/plan/analyze/AnalyzeVisitor.java   | 279 +++++----
 .../plan/analyze/ExpressionAnalyzer.java           |  40 +-
 .../analyze/schema/ClusterSchemaFetchExecutor.java |  32 +-
 .../plan/analyze/schema/ISchemaComputation.java    |  74 +--
 .../plan/analyze/schema/ISchemaValidation.java     |  30 +-
 .../plan/analyze/schema/NormalSchemaFetcher.java   | 403 ++++++-------
 .../config/executor/ClusterConfigTaskExecutor.java |   2 +-
 .../db/queryengine/plan/expression/Expression.java |   2 +-
 .../plan/expression/binary/BinaryExpression.java   |  38 +-
 .../plan/expression/binary/WhenThenExpression.java |   8 +-
 .../plan/expression/leaf/LeafOperand.java          |   8 +-
 .../plan/expression/multi/FunctionExpression.java  |  36 +-
 .../expression/other/CaseWhenThenExpression.java   |  22 +-
 .../plan/expression/ternary/BetweenExpression.java |   8 +-
 .../plan/expression/ternary/TernaryExpression.java |  30 +-
 .../plan/expression/unary/InExpression.java        |  34 +-
 .../plan/expression/unary/IsNullExpression.java    |   6 +-
 .../plan/expression/unary/LikeExpression.java      |   6 +-
 .../plan/expression/unary/LogicNotExpression.java  |  12 +-
 .../plan/expression/unary/NegationExpression.java  |  16 +-
 .../plan/expression/unary/RegularExpression.java   |   6 +-
 .../plan/expression/unary/UnaryExpression.java     |  10 +-
 .../visitor/CompleteMeasurementSchemaVisitor.java  | 178 +++---
 .../visitor/ReplaceLogicalViewVisitor.java         | 338 +++++------
 .../visitor/TransformToViewExpressionVisitor.java  | 550 +++++++++---------
 .../plan/planner/LogicalPlanVisitor.java           |  24 +-
 .../plan/planner/plan/node/PlanNodeType.java       |   6 +-
 .../metadata/write/view/CreateLogicalViewNode.java | 474 +++++++--------
 .../metadata/fetcher/cache/SchemaCacheEntry.java   |  54 +-
 .../queryengine/plan/statement/StatementType.java  |   4 +-
 .../plan/statement/StatementVisitor.java           |  12 +-
 .../plan/statement/crud/InsertBaseStatement.java   | 215 ++++---
 .../crud/InsertMultiTabletsStatement.java          |  34 +-
 .../plan/statement/crud/InsertRowStatement.java    | 238 ++++----
 .../crud/InsertRowsOfOneDeviceStatement.java       |  42 +-
 .../plan/statement/crud/InsertRowsStatement.java   |  34 +-
 .../plan/statement/crud/InsertTabletStatement.java | 242 ++++----
 .../metadata/view/CreateLogicalViewStatement.java  | 414 ++++++--------
 .../schemaengine/schemaregion/ISchemaRegion.java   |  52 +-
 .../schemaregion/SchemaRegionPlanType.java         |   4 +-
 .../schemaregion/SchemaRegionPlanVisitor.java      |   6 +-
 .../schemaregion/impl/SchemaRegionMemoryImpl.java  |  34 +-
 .../schemaregion/impl/SchemaRegionPBTreeImpl.java  |   6 +-
 .../visitor/SchemaRegionPlanDeserializer.java      |  32 +-
 .../visitor/SchemaRegionPlanSerializer.java        |  36 +-
 .../visitor/SchemaRegionPlanTxtSerializer.java     |  40 +-
 .../mtree/impl/mem/MTreeBelowSGMemoryImpl.java     | 148 +++--
 .../impl/mem/mnode/factory/MemMNodeFactory.java    |   8 +-
 .../impl/mem/mnode/impl/MeasurementMNode.java      |  10 +-
 .../mtree/impl/mem/mnode/info/LogicalViewInfo.java | 294 +++++-----
 .../mtree/impl/mem/mnode/info/TreeDeviceInfo.java  |   4 +-
 .../impl/mem/snapshot/MemMTreeSnapshotUtil.java    |  30 +-
 .../mtree/impl/pbtree/MTreeBelowSGCachedImpl.java  |  14 +-
 .../pbtree/mnode/factory/CacheMNodeFactory.java    |   8 +-
 .../pbtree/mnode/impl/CachedMeasurementMNode.java  |  10 +-
 .../impl/pbtree/schemafile/MockSchemaFile.java     |   4 +-
 .../traverser/collector/MeasurementCollector.java  |   2 +-
 .../read/resp/info/IDeviceSchemaInfo.java          |   2 +-
 .../read/resp/info/ITimeSeriesSchemaInfo.java      |   6 +-
 .../read/resp/info/impl/ShowDevicesResult.java     |   4 +-
 .../read/resp/info/impl/ShowTimeSeriesResult.java  |  20 +-
 .../schemaregion/view/ViewPathType.java            |  14 +-
 .../schemaengine/schemaregion/view/ViewPaths.java  |  46 +-
 .../view/visitor/GetSourcePathsVisitor.java        | 190 +++---
 .../view/visitor/TransformToExpressionVisitor.java | 566 +++++++++---------
 .../write/req/SchemaRegionWritePlanFactory.java    |   4 +-
 .../req/impl/view/CreateLogicalViewPlanImpl.java   | 148 ++---
 .../write/req/view/ICreateLogicalViewPlan.java     | 120 ++--
 .../schemaRegion/SchemaRegionBasicTest.java        | 616 ++++++++++----------
 .../schemaRegion/SchemaRegionTestUtil.java         |  60 +-
 .../metadata/view/ViewExpressionToStringTest.java  | 326 +++++------
 .../apache/iotdb/commons/path/MeasurementPath.java |  48 +-
 .../iotdb/commons/schema/SchemaConstant.java       |  12 +-
 .../schema/column/ColumnHeaderConstant.java        |  10 +-
 .../node/common/AbstractMeasurementMNode.java      |  10 +-
 .../schema/node/common/DeviceMNodeWrapper.java     |  18 +-
 .../commons/schema/node/info/IDeviceInfo.java      |   4 +-
 .../commons/schema/node/role/IDeviceMNode.java     |   6 +-
 .../schema/node/role/IMeasurementMNode.java        |   2 +-
 .../commons/schema/node/utils/IMNodeFactory.java   |   4 +-
 .../commons/schema/view/LogicalViewSchema.java     | 460 +++++++--------
 .../schema/view/viewExpression/ViewExpression.java | 636 ++++++++++-----------
 .../view/viewExpression/ViewExpressionType.java    | 152 ++---
 .../binary/BinaryViewExpression.java               | 242 ++++----
 .../binary/arithmetic/AdditionViewExpression.java  | 124 ++--
 .../arithmetic/ArithmeticBinaryViewExpression.java | 106 ++--
 .../binary/arithmetic/DivisionViewExpression.java  | 124 ++--
 .../binary/arithmetic/ModuloViewExpression.java    | 124 ++--
 .../arithmetic/MultiplicationViewExpression.java   | 126 ++--
 .../arithmetic/SubtractionViewExpression.java      | 124 ++--
 .../compare/CompareBinaryViewExpression.java       | 106 ++--
 .../binary/compare/EqualToViewExpression.java      | 114 ++--
 .../binary/compare/GreaterEqualViewExpression.java | 114 ++--
 .../binary/compare/GreaterThanViewExpression.java  | 114 ++--
 .../binary/compare/LessEqualViewExpression.java    | 114 ++--
 .../binary/compare/LessThanViewExpression.java     | 114 ++--
 .../binary/compare/NonEqualViewExpression.java     | 114 ++--
 .../binary/logic/LogicAndViewExpression.java       | 114 ++--
 .../binary/logic/LogicBinaryViewExpression.java    | 106 ++--
 .../binary/logic/LogicOrViewExpression.java        | 114 ++--
 .../viewExpression/leaf/ConstantViewOperand.java   | 191 +++----
 .../view/viewExpression/leaf/LeafViewOperand.java  |  78 +--
 .../view/viewExpression/leaf/NullViewOperand.java  | 120 ++--
 .../viewExpression/leaf/TimeSeriesViewOperand.java | 176 +++---
 .../viewExpression/leaf/TimestampViewOperand.java  | 142 ++---
 .../multi/FunctionViewExpression.java              | 366 ++++++------
 .../ternary/BetweenViewExpression.java             | 224 ++++----
 .../ternary/TernaryViewExpression.java             | 214 +++----
 .../viewExpression/unary/InViewExpression.java     | 214 +++----
 .../viewExpression/unary/IsNullViewExpression.java | 180 +++---
 .../viewExpression/unary/LikeViewExpression.java   | 172 +++---
 .../unary/LogicNotViewExpression.java              | 124 ++--
 .../unary/NegationViewExpression.java              | 124 ++--
 .../unary/RegularViewExpression.java               | 202 +++----
 .../viewExpression/unary/UnaryViewExpression.java  | 146 ++---
 .../visitor/ViewExpressionVisitor.java             | 450 +++++++--------
 141 files changed, 7171 insertions(+), 7267 deletions(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java
index f2e9d475393..1ac466653f6 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBInsertAlignedValuesIT.java
@@ -292,62 +292,62 @@ public class IoTDBInsertAlignedValuesIT {
   }
 
   @Test
-//   public void testInsertAlignedTimeseriesWithoutAligned() throws SQLException {
+  public void testInsertAlignedTimeseriesWithoutAligned() throws SQLException {
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
       statement.execute(
           "CREATE ALIGNED TIMESERIES root.lz.dev.GPS2(latitude INT32 encoding=PLAIN compressor=SNAPPY, longitude INT32 encoding=PLAIN compressor=SNAPPY) ");
-//       statement.execute("insert into root.lz.dev.GPS2(time,latitude,longitude) values(1,123,456)");
-//       // it's supported.
-//     }
-//   }
-// 
-//   @Test
-//   public void testInsertTimeseriesWithUnMatchedAlignedType() throws SQLException {
-//     try (Connection connection = EnvFactory.getEnv().getConnection();
-//         Statement statement = connection.createStatement()) {
-//       statement.execute("create ALIGNED timeseries root.db.d_aligned(s01 INT64 encoding=RLE)");
-//       statement.execute("insert into root.db.d_aligned(time, s01) aligned values (4000, 123)");
-//       statement.execute("insert into root.db.d_aligned(time, s01) values (5000, 456)");
-//       statement.execute("create timeseries root.db.d_not_aligned.s01 INT64 encoding=RLE");
-//       statement.execute("insert into root.db.d_not_aligned(time, s01) values (4000, 987)");
-//       statement.execute("insert into root.db.d_not_aligned(time, s01) aligned values (5000, 654)");
-// 
-//       try (ResultSet resultSet = statement.executeQuery("select s01 from root.db.d_aligned")) {
-//         assertTrue(resultSet.next());
-//         assertEquals(4000, resultSet.getLong(1));
-//         assertEquals(123, resultSet.getLong(2));
-// 
-//         assertTrue(resultSet.next());
-//         assertEquals(5000, resultSet.getLong(1));
-//         assertEquals(456, resultSet.getLong(2));
-// 
-//         assertFalse(resultSet.next());
-//       }
-// 
-//       try (ResultSet resultSet = statement.executeQuery("select s01 from root.db.d_not_aligned")) {
-//         assertTrue(resultSet.next());
-//         assertEquals(4000, resultSet.getLong(1));
-//         assertEquals(987, resultSet.getLong(2));
-// 
-//         assertTrue(resultSet.next());
-//         assertEquals(5000, resultSet.getLong(1));
-//         assertEquals(654, resultSet.getLong(2));
-// 
-//         assertFalse(resultSet.next());
-//       }
+      statement.execute("insert into root.lz.dev.GPS2(time,latitude,longitude) values(1,123,456)");
+      // it's supported.
     }
   }
 
   @Test
-//   public void testInsertNonAlignedTimeseriesWithAligned() throws SQLException {
+  public void testInsertTimeseriesWithUnMatchedAlignedType() throws SQLException {
+    try (Connection connection = EnvFactory.getEnv().getConnection();
+        Statement statement = connection.createStatement()) {
+      statement.execute("create ALIGNED timeseries root.db.d_aligned(s01 INT64 encoding=RLE)");
+      statement.execute("insert into root.db.d_aligned(time, s01) aligned values (4000, 123)");
+      statement.execute("insert into root.db.d_aligned(time, s01) values (5000, 456)");
+      statement.execute("create timeseries root.db.d_not_aligned.s01 INT64 encoding=RLE");
+      statement.execute("insert into root.db.d_not_aligned(time, s01) values (4000, 987)");
+      statement.execute("insert into root.db.d_not_aligned(time, s01) aligned values (5000, 654)");
+
+      try (ResultSet resultSet = statement.executeQuery("select s01 from root.db.d_aligned")) {
+        assertTrue(resultSet.next());
+        assertEquals(4000, resultSet.getLong(1));
+        assertEquals(123, resultSet.getLong(2));
+
+        assertTrue(resultSet.next());
+        assertEquals(5000, resultSet.getLong(1));
+        assertEquals(456, resultSet.getLong(2));
+
+        assertFalse(resultSet.next());
+      }
+
+      try (ResultSet resultSet = statement.executeQuery("select s01 from root.db.d_not_aligned")) {
+        assertTrue(resultSet.next());
+        assertEquals(4000, resultSet.getLong(1));
+        assertEquals(987, resultSet.getLong(2));
+
+        assertTrue(resultSet.next());
+        assertEquals(5000, resultSet.getLong(1));
+        assertEquals(654, resultSet.getLong(2));
+
+        assertFalse(resultSet.next());
+      }
+    }
+  }
+
+  @Test
+  public void testInsertNonAlignedTimeseriesWithAligned() throws SQLException {
     try (Connection connection = EnvFactory.getEnv().getConnection();
         Statement statement = connection.createStatement()) {
       statement.execute("CREATE TIMESERIES root.lz.dev.GPS3.latitude with datatype=INT32");
       statement.execute("CREATE TIMESERIES root.lz.dev.GPS3.longitude with datatype=INT32");
       statement.execute(
-//           "insert into root.lz.dev.GPS3(time,latitude,longitude) aligned values(1,123,456)");
-//       // it's supported.
+          "insert into root.lz.dev.GPS3(time,latitude,longitude) aligned values(1,123,456)");
+      // it's supported.
     }
   }
 
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java
index 70eeeffbd74..33648973284 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBResultSetIT.java
@@ -177,8 +177,8 @@ public class IoTDBResultSetIT {
             + ColumnHeaderConstant.DEADBAND
             + ","
             + ColumnHeaderConstant.DEADBAND_PARAMETERS
-//             + ","
-//             + ColumnHeaderConstant.VIEW_TYPE
+            + ","
+            + ColumnHeaderConstant.VIEW_TYPE
             + ",";
     resultSetEqualTest("show timeseries root.sg1.**", expectedHeader, emptyResultSet);
   }
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java
index c368249b6d3..620e2718b04 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/selectinto/IoTDBSelectIntoIT.java
@@ -336,36 +336,36 @@ public class IoTDBSelectIntoIT {
         "select k1, k2, k3 from root.sg_expr.d;", expectedQueryHeader, queryRetArray);
   }
 
-//   @Test
-//   public void testUsingUnMatchedAlignment() {
-//     String[] intoRetArray =
-//         new String[] {
-//           "root.sg.d1.s1,root.sg_bk1.new_aligned_d.t1,10,",
-//           "root.sg.d2.s1,root.sg_bk1.new_aligned_d.t2,7,",
-//           "root.sg.d1.s2,root.sg_bk1.new_aligned_d.t3,9,",
-//           "root.sg.d2.s2,root.sg_bk1.new_aligned_d.t4,8,",
-//         };
-//     executeNonQuery(
-//         "CREATE ALIGNED TIMESERIES root.sg_bk1.new_aligned_d(t1 INT32, t2 INT32, t3 FLOAT, t4 FLOAT);");
-//     // use matched interface (aligned == aligned)
-//     resultSetEqualTest(
-//         "select s1, s2 into aligned root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;",
-//         selectIntoHeader,
-//         intoRetArray);
-//     String expectedQueryHeader =
-//         "Time,root.sg_bk1.new_aligned_d.t1,root.sg_bk1.new_aligned_d.t3,root.sg_bk1.new_aligned_d.t2,root.sg_bk1.new_aligned_d.t4,";
-//     resultSetEqualTest(
-//         "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet);
-// 
-//     // use unmatched interface (non-aligned != aligned)
-//     resultSetEqualTest(
-//         "select s1, s2 into root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;",
-//         selectIntoHeader,
-//         intoRetArray);
-//     resultSetEqualTest(
-//         "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet);
-//   }
-// 
+  @Test
+  public void testUsingUnMatchedAlignment() {
+    String[] intoRetArray =
+        new String[] {
+          "root.sg.d1.s1,root.sg_bk1.new_aligned_d.t1,10,",
+          "root.sg.d2.s1,root.sg_bk1.new_aligned_d.t2,7,",
+          "root.sg.d1.s2,root.sg_bk1.new_aligned_d.t3,9,",
+          "root.sg.d2.s2,root.sg_bk1.new_aligned_d.t4,8,",
+        };
+    executeNonQuery(
+        "CREATE ALIGNED TIMESERIES root.sg_bk1.new_aligned_d(t1 INT32, t2 INT32, t3 FLOAT, t4 FLOAT);");
+    // use matched interface (aligned == aligned)
+    resultSetEqualTest(
+        "select s1, s2 into aligned root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;",
+        selectIntoHeader,
+        intoRetArray);
+    String expectedQueryHeader =
+        "Time,root.sg_bk1.new_aligned_d.t1,root.sg_bk1.new_aligned_d.t3,root.sg_bk1.new_aligned_d.t2,root.sg_bk1.new_aligned_d.t4,";
+    resultSetEqualTest(
+        "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet);
+
+    // use unmatched interface (non-aligned != aligned)
+    resultSetEqualTest(
+        "select s1, s2 into root.sg_bk1.new_aligned_d(t1, t2, t3, t4) from root.sg.*;",
+        selectIntoHeader,
+        intoRetArray);
+    resultSetEqualTest(
+        "select t1, t3, t2, t4 from root.sg_bk1.new_aligned_d;", expectedQueryHeader, rawDataSet);
+  }
+
   // -------------------------------------- ALIGN BY DEVICE -------------------------------------
 
   @Test
diff --git a/iotdb-client/client-py/tests/integration/test_dataframe.py b/iotdb-client/client-py/tests/integration/test_dataframe.py
index 8b6e32b3178..f314fbac184 100644
--- a/iotdb-client/client-py/tests/integration/test_dataframe.py
+++ b/iotdb-client/client-py/tests/integration/test_dataframe.py
@@ -71,7 +71,7 @@ def test_non_time_query():
         "Attributes",
         "Deadband",
         "DeadbandParameters",
-//         "ViewType",
+        "ViewType",
     ]
     assert_array_equal(
         df.values,
diff --git a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
index 2d1241aef71..58f77da6c33 100644
--- a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
+++ b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
@@ -70,7 +70,7 @@ ddlStatement
     | callInference | loadModel | unloadModel
     // Quota
     | setSpaceQuota | showSpaceQuota | setThrottleQuota | showThrottleQuota
-//     // View
+    // View
     | createLogicalView | dropLogicalView | showLogicalView | renameLogicalView | alterLogicalView
     // Table View
     | createTableView
@@ -767,11 +767,11 @@ showAIDevices
     : SHOW AI_DEVICES
     ;
 
-// // Create Logical View
-// createLogicalView
-//     : CREATE VIEW viewTargetPaths AS viewSourcePaths
-//     ;
-//
+// Create Logical View
+createLogicalView
+    : CREATE VIEW viewTargetPaths AS viewSourcePaths
+    ;
+
 showLogicalView
     : SHOW VIEW prefixPath? timeseriesWhereClause? rowPaginationClause?
     ;
@@ -789,21 +789,21 @@ alterLogicalView
     | ALTER VIEW fullPath alterClause
     ;
 
-// viewSuffixPaths
-//     : nodeNameWithoutWildcard (DOT nodeNameWithoutWildcard)*
-//     ;
-// 
-// viewTargetPaths
-//     : fullPath (COMMA fullPath)*
-//     | prefixPath LR_BRACKET viewSuffixPaths (COMMA viewSuffixPaths)* RR_BRACKET
-//     ;
-// 
-// viewSourcePaths
-//     : fullPath (COMMA fullPath)*
-//     | prefixPath LR_BRACKET viewSuffixPaths (COMMA viewSuffixPaths)* RR_BRACKET
-//     | selectClause fromClause
-//     ;
-// 
+viewSuffixPaths
+    : nodeNameWithoutWildcard (DOT nodeNameWithoutWildcard)*
+    ;
+
+viewTargetPaths
+    : fullPath (COMMA fullPath)*
+    | prefixPath LR_BRACKET viewSuffixPaths (COMMA viewSuffixPaths)* RR_BRACKET
+    ;
+
+viewSourcePaths
+    : fullPath (COMMA fullPath)*
+    | prefixPath LR_BRACKET viewSuffixPaths (COMMA viewSuffixPaths)* RR_BRACKET
+    | selectClause fromClause
+    ;
+
 // Table view
 createTableView
     : CREATE (OR REPLACE)? VIEW qualifiedName
diff --git a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4 b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
index fcc3487affc..0efaf9fac38 100644
--- a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
+++ b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/SqlLexer.g4
@@ -1022,10 +1022,10 @@ VERSION
     : V E R S I O N
     ;
 
-// VIEW
-//     : V I E W
-//     ;
-// 
+VIEW
+    : V I E W
+    ;
+
 WATERMARK_EMBEDDING
     : W A T E R M A R K '_' E M B E D D I N G
     ;
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/factory/ConfigMNodeFactory.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/factory/ConfigMNodeFactory.java
index d54c7064220..382e7c6faf5 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/factory/ConfigMNodeFactory.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/factory/ConfigMNodeFactory.java
@@ -73,10 +73,10 @@ public class ConfigMNodeFactory implements IMNodeFactory<IConfigMNode> {
   public IConfigMNode createInternalMNode(IConfigMNode parent, String name) {
     return new ConfigBasicInternalMNode(parent, name);
   }
-// 
-//   @Override
-//   public IMeasurementMNode<IConfigMNode> createLogicalViewMNode(
+
+  @Override
+  public IMeasurementMNode<IConfigMNode> createLogicalViewMNode(
       IDeviceMNode<IConfigMNode> parent, String name, IMeasurementSchema measurementSchema) {
     throw new UnsupportedOperationException("View is not supported.");
-//   }
+  }
 }
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java
index d3ab172bb50..6b448e32579 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java
@@ -37,7 +37,7 @@ import org.apache.iotdb.confignode.procedure.impl.StateMachineProcedure;
 import org.apache.iotdb.confignode.procedure.state.schema.DeleteLogicalViewState;
 import org.apache.iotdb.confignode.procedure.store.ProcedureType;
 import org.apache.iotdb.consensus.exception.ConsensusException;
-// import org.apache.iotdb.db.exception.metadata.view.ViewNotExistException;
+import org.apache.iotdb.db.exception.metadata.view.ViewNotExistException;
 import org.apache.iotdb.mpp.rpc.thrift.TConstructViewSchemaBlackListReq;
 import org.apache.iotdb.mpp.rpc.thrift.TDeleteViewSchemaReq;
 import org.apache.iotdb.mpp.rpc.thrift.TInvalidateMatchedSchemaCacheReq;
@@ -102,7 +102,7 @@ public class DeleteLogicalViewProcedure
           } else {
             setFailure(
                 new ProcedureException(
-//                     new ViewNotExistException(
+                    new ViewNotExistException(
                         patternTree.getAllPathPatterns().stream()
                             .map(PartialPath::getFullPath)
                             .collect(Collectors.toList()))));
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java
index 6ddfcffc2eb..6b9ba0a2612 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java
@@ -25,7 +25,7 @@ import org.apache.iotdb.commons.consensus.SchemaRegionId;
 import org.apache.iotdb.commons.exception.MetadataException;
 import org.apache.iotdb.commons.path.MeasurementPath;
 import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.exception.metadata.MeasurementAlreadyExistException;
 import org.apache.iotdb.db.exception.metadata.template.TemplateIsInUseException;
 import org.apache.iotdb.db.pipe.agent.PipeDataNodeAgent;
@@ -591,28 +591,28 @@ public class SchemaExecutionVisitor extends PlanVisitor<TSStatus, ISchemaRegion>
     }
   }
 
-//   @Override
+  @Override
   public TSStatus visitCreateLogicalView(
       final CreateLogicalViewNode node, final ISchemaRegion schemaRegion) {
     final Map<PartialPath, ViewExpression> viewPathToSourceMap =
         node.getViewPathToSourceExpressionMap();
     final List<TSStatus> failingStatus = new ArrayList<>();
     for (final Map.Entry<PartialPath, ViewExpression> entry : viewPathToSourceMap.entrySet()) {
-//       try {
-//         schemaRegion.createLogicalView(
+      try {
+        schemaRegion.createLogicalView(
             SchemaRegionWritePlanFactory.getCreateLogicalViewPlan(
                 entry.getKey(), entry.getValue()));
       } catch (final MetadataException e) {
-//         logger.error("{}: MetaData error: ", IoTDBConstant.GLOBAL_DB_NAME, e);
-//         failingStatus.add(RpcUtils.getStatus(e.getErrorCode(), e.getMessage()));
-//       }
-//     }
-//     if (!failingStatus.isEmpty()) {
-//       return RpcUtils.getStatus(failingStatus);
-//     }
-//     return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS, "Execute successfully");
-//   }
-// 
+        logger.error("{}: MetaData error: ", IoTDBConstant.GLOBAL_DB_NAME, e);
+        failingStatus.add(RpcUtils.getStatus(e.getErrorCode(), e.getMessage()));
+      }
+    }
+    if (!failingStatus.isEmpty()) {
+      return RpcUtils.getStatus(failingStatus);
+    }
+    return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS, "Execute successfully");
+  }
+
   @Override
   public TSStatus visitAlterLogicalView(
       final AlterLogicalViewNode node, final ISchemaRegion schemaRegion) {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/DuplicateInsertException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/DuplicateInsertException.java
index 46e5cdfea88..be55fdf810e 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/DuplicateInsertException.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/DuplicateInsertException.java
@@ -1,36 +1,36 @@
-// /*
-//  * 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.
-//  */
+/*
+ * 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.exception.metadata;
-// 
-// import org.apache.iotdb.commons.exception.MetadataException;
-// import org.apache.iotdb.rpc.TSStatusCode;
-// 
-// public class DuplicateInsertException extends MetadataException {
-// 
-//   private static final String DUPLICATE_INSERTION_WRONG_MESSAGE =
-//       "Insertion is illegal because measurement [%s] under device [%s] is duplicate.";
-// 
-//   public DuplicateInsertException(String device, String measurement) {
-//     super(
-//         String.format(DUPLICATE_INSERTION_WRONG_MESSAGE, measurement, device),
-//         TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
-//         true);
-//   }
-// }
+package org.apache.iotdb.db.exception.metadata;
+
+import org.apache.iotdb.commons.exception.MetadataException;
+import org.apache.iotdb.rpc.TSStatusCode;
+
+public class DuplicateInsertException extends MetadataException {
+
+  private static final String DUPLICATE_INSERTION_WRONG_MESSAGE =
+      "Insertion is illegal because measurement [%s] under device [%s] is duplicate.";
+
+  public DuplicateInsertException(String device, String measurement) {
+    super(
+        String.format(DUPLICATE_INSERTION_WRONG_MESSAGE, measurement, device),
+        TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
+        true);
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java
index 23f1017be29..fe7eccb8dbd 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/BrokenViewException.java
@@ -1,39 +1,39 @@
-// /*
-//  * 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.
-//  */
+/*
+ * 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.exception.metadata.view;
-// 
-// import org.apache.iotdb.commons.exception.MetadataException;
-// import org.apache.iotdb.commons.path.MeasurementPath;
-// 
-// import java.util.List;
-// 
-// public class BrokenViewException extends MetadataException {
+package org.apache.iotdb.db.exception.metadata.view;
+
+import org.apache.iotdb.commons.exception.MetadataException;
+import org.apache.iotdb.commons.path.MeasurementPath;
+
+import java.util.List;
+
+public class BrokenViewException extends MetadataException {
 
   public BrokenViewException(String sourcePath) {
     super(String.format("The source path [%s] is deleted", sourcePath));
   }
 
-//   public BrokenViewException(String sourcePath, List<MeasurementPath> matchedPaths) {
-//     super(
-//         String.format(
-//             "View is broken! The source path [%s] maps to unmatched %s path(s): %s.",
+  public BrokenViewException(String sourcePath, List<MeasurementPath> matchedPaths) {
+    super(
+        String.format(
+            "View is broken! The source path [%s] maps to unmatched %s path(s): %s.",
             sourcePath, matchedPaths.size(), matchedPaths));
-//   }
-// }
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/InsertNonWritableViewException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/InsertNonWritableViewException.java
index 17fbf2bd060..cec8d52dd9c 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/InsertNonWritableViewException.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/InsertNonWritableViewException.java
@@ -1,34 +1,34 @@
-// /*
-//  * 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.
-//  */
+/*
+ * 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.exception.metadata.view;
-// 
-// import org.apache.iotdb.commons.exception.MetadataException;
-// 
-// public class InsertNonWritableViewException extends MetadataException {
-//   public InsertNonWritableViewException(String path) {
-//     super(
-//         String.format(
-//             "Can not insert data to a view which is not alias series. (View path: %s)", path));
-//   }
-// 
-//   public InsertNonWritableViewException() {
-//     super("Can not insert data to a view which is not alias series.");
-//   }
-// }
+package org.apache.iotdb.db.exception.metadata.view;
+
+import org.apache.iotdb.commons.exception.MetadataException;
+
+public class InsertNonWritableViewException extends MetadataException {
+  public InsertNonWritableViewException(String path) {
+    super(
+        String.format(
+            "Can not insert data to a view which is not alias series. (View path: %s)", path));
+  }
+
+  public InsertNonWritableViewException() {
+    super("Can not insert data to a view which is not alias series.");
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/UnsupportedViewException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/UnsupportedViewException.java
index 658f3b28af3..4f8f333b6b6 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/UnsupportedViewException.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/UnsupportedViewException.java
@@ -1,41 +1,41 @@
-// /*
-//  * 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.
-//  */
+/*
+ * 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.exception.metadata.view;
-// 
-// import org.apache.iotdb.commons.exception.MetadataException;
-// import org.apache.iotdb.rpc.TSStatusCode;
-// 
-// public class UnsupportedViewException extends MetadataException {
-// 
-//   private static final String VIEW_IS_UNSUPPORTED = "View unsupported, because: %s";
-// 
-//   public UnsupportedViewException(String message) {
-//     super(
-//         String.format(VIEW_IS_UNSUPPORTED, message),
-//         TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode());
-//   }
-// 
-//   public UnsupportedViewException(String message, boolean isUserException) {
-//     super(
-//         String.format(VIEW_IS_UNSUPPORTED, message),
-//         TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
-//         isUserException);
-//   }
-// }
+package org.apache.iotdb.db.exception.metadata.view;
+
+import org.apache.iotdb.commons.exception.MetadataException;
+import org.apache.iotdb.rpc.TSStatusCode;
+
+public class UnsupportedViewException extends MetadataException {
+
+  private static final String VIEW_IS_UNSUPPORTED = "View unsupported, because: %s";
+
+  public UnsupportedViewException(String message) {
+    super(
+        String.format(VIEW_IS_UNSUPPORTED, message),
+        TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode());
+  }
+
+  public UnsupportedViewException(String message, boolean isUserException) {
+    super(
+        String.format(VIEW_IS_UNSUPPORTED, message),
+        TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
+        isUserException);
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewContainsAggregationException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewContainsAggregationException.java
index 87d00783884..291e9dab0ea 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewContainsAggregationException.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewContainsAggregationException.java
@@ -1,30 +1,30 @@
-// /*
-//  * 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.
-//  */
+/*
+ * 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.exception.metadata.view;
-// 
-// public class ViewContainsAggregationException extends UnsupportedViewException {
-// 
-//   private static final String VIEW_CONTAINS_AGGREGATION_FUNCTION =
-//       "This view contains aggregation function(s) named [%s]";
-// 
-//   public ViewContainsAggregationException(String namesOfAggregationFunctions) {
-//     super(String.format(VIEW_CONTAINS_AGGREGATION_FUNCTION, namesOfAggregationFunctions), true);
-//   }
-// }
+package org.apache.iotdb.db.exception.metadata.view;
+
+public class ViewContainsAggregationException extends UnsupportedViewException {
+
+  private static final String VIEW_CONTAINS_AGGREGATION_FUNCTION =
+      "This view contains aggregation function(s) named [%s]";
+
+  public ViewContainsAggregationException(String namesOfAggregationFunctions) {
+    super(String.format(VIEW_CONTAINS_AGGREGATION_FUNCTION, namesOfAggregationFunctions), true);
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewNotExistException.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewNotExistException.java
index 9c60b61aee8..dfa92696dc6 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewNotExistException.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/exception/metadata/view/ViewNotExistException.java
@@ -1,46 +1,46 @@
-// /*
-//  * 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.
-//  */
+/*
+ * 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.exception.metadata.view;
-// 
-// import org.apache.iotdb.commons.exception.MetadataException;
-// import org.apache.iotdb.rpc.TSStatusCode;
-// 
-// import java.util.List;
-// 
-// public class ViewNotExistException extends MetadataException {
-// 
-//   private static final String VIEW_NOT_EXIST_WRONG_MESSAGE = "View [%s] does not exist";
-// 
-//   public ViewNotExistException(String path) {
-//     super(
-//         String.format(VIEW_NOT_EXIST_WRONG_MESSAGE, path),
-//         TSStatusCode.PATH_NOT_EXIST.getStatusCode());
-//   }
-// 
-//   public ViewNotExistException(List<String> paths) {
-//     super(
-//         String.format(
-//             VIEW_NOT_EXIST_WRONG_MESSAGE,
-//             paths.size() == 1
-//                 ? paths.get(0)
-//                 : paths.get(0) + " ... " + paths.get(paths.size() - 1)),
-//         TSStatusCode.PATH_NOT_EXIST.getStatusCode());
-//   }
-// }
+package org.apache.iotdb.db.exception.metadata.view;
+
+import org.apache.iotdb.commons.exception.MetadataException;
+import org.apache.iotdb.rpc.TSStatusCode;
+
+import java.util.List;
+
+public class ViewNotExistException extends MetadataException {
+
+  private static final String VIEW_NOT_EXIST_WRONG_MESSAGE = "View [%s] does not exist";
+
+  public ViewNotExistException(String path) {
+    super(
+        String.format(VIEW_NOT_EXIST_WRONG_MESSAGE, path),
+        TSStatusCode.PATH_NOT_EXIST.getStatusCode());
+  }
+
+  public ViewNotExistException(List<String> paths) {
+    super(
+        String.format(
+            VIEW_NOT_EXIST_WRONG_MESSAGE,
+            paths.size() == 1
+                ? paths.get(0)
+                : paths.get(0) + " ... " + paths.get(paths.size() - 1)),
+        TSStatusCode.PATH_NOT_EXIST.getStatusCode());
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java
index 38f646fd312..05932e78b95 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ClusterSchemaTree.java
@@ -21,10 +21,10 @@ package org.apache.iotdb.db.queryengine.common.schematree;
 
 import org.apache.iotdb.commons.path.MeasurementPath;
 import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 import org.apache.iotdb.commons.utils.PathUtils;
 import org.apache.iotdb.commons.utils.TestOnly;
-// import org.apache.iotdb.db.exception.metadata.PathNotExistException;
+import org.apache.iotdb.db.exception.metadata.PathNotExistException;
 import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.queryengine.common.schematree.node.SchemaEntityNode;
 import org.apache.iotdb.db.queryengine.common.schematree.node.SchemaInternalNode;
@@ -73,14 +73,14 @@ public class ClusterSchemaTree implements ISchemaTree {
 
   private final SchemaNode root;
 
-//   /** a flag recording whether there is logical view in this schema tree. */
-//   private boolean hasLogicalMeasurementPath = false;
+  /** a flag recording whether there is logical view in this schema tree. */
+  private boolean hasLogicalMeasurementPath = false;
 
   /** used to judge schema tree type */
   private boolean hasNormalTimeSeries = false;
 
   private Map<Integer, Template> templateMap = new HashMap<>();
-// 
+
   private long ramBytesUsed;
 
   public ClusterSchemaTree() {
@@ -205,7 +205,7 @@ public class ClusterSchemaTree implements ISchemaTree {
       return indexOfTargetMeasurements;
     }
     SchemaEntityNode entityNode = cur.getAsEntityNode();
-//     boolean firstNonViewMeasurement = true;
+    boolean firstNonViewMeasurement = true;
     List<Integer> indexOfMissingMeasurements = new ArrayList<>();
     for (int index : indexOfTargetMeasurements) {
       IMeasurementSchemaInfo measurementSchemaInfo =
@@ -216,42 +216,42 @@ public class ClusterSchemaTree implements ISchemaTree {
         if (firstNonViewMeasurement && !measurementSchemaInfo.isLogicalView()) {
           schemaComputation.computeDevice(cur.getAsEntityNode().isAligned());
           firstNonViewMeasurement = false;
-//         }
+        }
         schemaComputation.computeMeasurement(index, measurementSchemaInfo);
       }
     }
     return indexOfMissingMeasurements;
   }
 
-//   /**
-//    * This function compute logical view and fill source of these views. It returns nothing ! If some
-//    * source paths are missed, throw errors.
-//    *
-//    * @param schemaComputation the statement
-//    * @param indexOfTargetLogicalView the index list of logicalViewSchemaList that you want to check
+  /**
+   * This function compute logical view and fill source of these views. It returns nothing ! If some
+   * source paths are missed, throw errors.
+   *
+   * @param schemaComputation the statement
+   * @param indexOfTargetLogicalView the index list of logicalViewSchemaList that you want to check
    * @throws SemanticException path not exist or different source path of view
-//    */
-//   public void computeSourceOfLogicalView(
+   */
+  public void computeSourceOfLogicalView(
       ISchemaComputation schemaComputation, List<Integer> indexOfTargetLogicalView)
       throws SemanticException {
-//     if (!schemaComputation.hasLogicalViewNeedProcess()) {
-//       return;
-//     }
-//     List<LogicalViewSchema> logicalViewSchemaList = schemaComputation.getLogicalViewSchemaList();
-//     for (Integer index : indexOfTargetLogicalView) {
-//       LogicalViewSchema logicalViewSchema = logicalViewSchemaList.get(index);
-//       PartialPath fullPath = logicalViewSchema.getSourcePathIfWritable();
-//       Pair<List<MeasurementPath>, Integer> searchResult = this.searchMeasurementPaths(fullPath);
-//       List<MeasurementPath> measurementPathList = searchResult.left;
+    if (!schemaComputation.hasLogicalViewNeedProcess()) {
+      return;
+    }
+    List<LogicalViewSchema> logicalViewSchemaList = schemaComputation.getLogicalViewSchemaList();
+    for (Integer index : indexOfTargetLogicalView) {
+      LogicalViewSchema logicalViewSchema = logicalViewSchemaList.get(index);
+      PartialPath fullPath = logicalViewSchema.getSourcePathIfWritable();
+      Pair<List<MeasurementPath>, Integer> searchResult = this.searchMeasurementPaths(fullPath);
+      List<MeasurementPath> measurementPathList = searchResult.left;
       if (measurementPathList.isEmpty()) {
         throw new SemanticException(
-//             new PathNotExistException(
+            new PathNotExistException(
                 fullPath.getFullPath(),
                 schemaComputation
                     .getDevicePath()
                     .concatAsMeasurementPath(logicalViewSchema.getMeasurementName())
                     .getFullPath()));
-//       } else if (measurementPathList.size() > 1) {
+      } else if (measurementPathList.size() > 1) {
         throw new SemanticException(
             String.format(
                 "The source paths [%s] of view [%s] are multiple.",
@@ -259,22 +259,22 @@ public class ClusterSchemaTree implements ISchemaTree {
                 schemaComputation
                     .getDevicePath()
                     .concatAsMeasurementPath(logicalViewSchema.getMeasurementName())));
-//       } else {
-//         Integer realIndex = schemaComputation.getIndexListOfLogicalViewPaths().get(index);
-//         MeasurementPath measurementPath = measurementPathList.get(0);
-//         schemaComputation.computeMeasurementOfView(
-//             realIndex,
-//             new MeasurementSchemaInfo(
+      } else {
+        Integer realIndex = schemaComputation.getIndexListOfLogicalViewPaths().get(index);
+        MeasurementPath measurementPath = measurementPathList.get(0);
+        schemaComputation.computeMeasurementOfView(
+            realIndex,
+            new MeasurementSchemaInfo(
                 measurementPath.getMeasurement(),
                 measurementPath.getMeasurementSchema(),
                 null,
                 measurementPath.getTagMap(),
                 null),
-//             measurementPath.isUnderAlignedEntity());
-//       }
-//     }
-//   }
-// 
+            measurementPath.isUnderAlignedEntity());
+      }
+    }
+  }
+
   /**
    * Append a template device to the schema tree.
    *
@@ -327,7 +327,7 @@ public class ClusterSchemaTree implements ISchemaTree {
   public void appendSingleMeasurementPath(MeasurementPath measurementPath) {
     appendSingleMeasurement(
         measurementPath,
-//         measurementPath.getMeasurementSchema(),
+        measurementPath.getMeasurementSchema(),
         measurementPath.getTagMap(),
         null,
         measurementPath.isMeasurementAliasExists() ? measurementPath.getMeasurementAlias() : null,
@@ -336,7 +336,7 @@ public class ClusterSchemaTree implements ISchemaTree {
 
   public void appendSingleMeasurement(
       PartialPath path,
-//       IMeasurementSchema schema,
+      IMeasurementSchema schema,
       Map<String, String> tagMap,
       Map<String, String> attributeMap,
       String alias,
@@ -380,13 +380,13 @@ public class ClusterSchemaTree implements ISchemaTree {
     hasNormalTimeSeries = true;
   }
 
-//   @Override
-//   public void mergeSchemaTree(ISchemaTree schemaTree) {
-//     if (schemaTree instanceof ClusterSchemaTree) {
-//       this.mergeSchemaTree((ClusterSchemaTree) schemaTree);
-//     }
-//   }
-// 
+  @Override
+  public void mergeSchemaTree(ISchemaTree schemaTree) {
+    if (schemaTree instanceof ClusterSchemaTree) {
+      this.mergeSchemaTree((ClusterSchemaTree) schemaTree);
+    }
+  }
+
   @Override
   public boolean hasNormalTimeSeries() {
     return hasNormalTimeSeries;
@@ -407,8 +407,8 @@ public class ClusterSchemaTree implements ISchemaTree {
   }
 
   public void mergeSchemaTree(ClusterSchemaTree schemaTree) {
-//     this.hasLogicalMeasurementPath =
-//         this.hasLogicalMeasurementPath || schemaTree.hasLogicalViewMeasurement();
+    this.hasLogicalMeasurementPath =
+        this.hasLogicalMeasurementPath || schemaTree.hasLogicalViewMeasurement();
     traverseAndMerge(this.root, null, schemaTree.root);
     this.templateMap.putAll(schemaTree.templateMap);
     this.hasNormalTimeSeries |= schemaTree.hasNormalTimeSeries;
@@ -553,7 +553,7 @@ public class ClusterSchemaTree implements ISchemaTree {
           stack.pop();
           nextNode = currentNode;
           return;
-//         }
+        }
       }
     }
   }
@@ -675,7 +675,7 @@ public class ClusterSchemaTree implements ISchemaTree {
     return databases;
   }
 
-//   @Override
+  @Override
   public void setDatabases(Set<String> databases) {
     this.databases = databases;
   }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/DeviceSchemaInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/DeviceSchemaInfo.java
index 83e7b8e4404..ead892f3e62 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/DeviceSchemaInfo.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/DeviceSchemaInfo.java
@@ -64,9 +64,9 @@ public class DeviceSchemaInfo {
     return measurementSchemaInfoList.stream()
         .map(
             measurementSchemaInfo ->
-//                 measurementSchemaInfo == null
-//                     ? null
-//                     : measurementSchemaInfo.getSchemaAsMeasurementSchema())
+                measurementSchemaInfo == null
+                    ? null
+                    : measurementSchemaInfo.getSchemaAsMeasurementSchema())
         .collect(Collectors.toList());
   }
 
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/IMeasurementSchemaInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/IMeasurementSchemaInfo.java
index 6219fe5e1c8..5636363f800 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/IMeasurementSchemaInfo.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/IMeasurementSchemaInfo.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.db.queryengine.common.schematree;
 
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 
 import org.apache.tsfile.write.schema.IMeasurementSchema;
 import org.apache.tsfile.write.schema.MeasurementSchema;
@@ -30,22 +30,22 @@ public interface IMeasurementSchemaInfo {
 
   String getName();
 
-//   IMeasurementSchema getSchema();
-// 
+  IMeasurementSchema getSchema();
+
   /**
    * If the IMeasurementSchema is MeasurementSchema, return itself; else return null.
    *
    * @return measurementSchema or null if IMeasurementSchema is not MeasurementSchema
    */
-//   MeasurementSchema getSchemaAsMeasurementSchema();
+  MeasurementSchema getSchemaAsMeasurementSchema();
+
+  LogicalViewSchema getSchemaAsLogicalViewSchema();
 
-//   LogicalViewSchema getSchemaAsLogicalViewSchema();
-// 
   Map<String, String> getTagMap();
 
   Map<String, String> getAttributeMap();
 
   String getAlias();
-// 
-//   boolean isLogicalView();
+
+  boolean isLogicalView();
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java
index 43c2eb5eaf9..543991a6ff7 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/ISchemaTree.java
@@ -75,12 +75,12 @@ public interface ISchemaTree extends Accountable {
 
   Set<String> getDatabases();
 
-//   void setDatabases(Set<String> databases);
-// 
+  void setDatabases(Set<String> databases);
+
   boolean isEmpty();
-// 
-//   void mergeSchemaTree(ISchemaTree schemaTree);
-// 
+
+  void mergeSchemaTree(ISchemaTree schemaTree);
+
   /**
    * Check whether this schema tree has normal series(not template series).
    *
@@ -108,7 +108,7 @@ public interface ISchemaTree extends Accountable {
    *
    * @return whether there's view in this schema tree
    */
-//   boolean hasLogicalViewMeasurement();
+  boolean hasLogicalViewMeasurement();
 
   void removeLogicalView();
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/MeasurementSchemaInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/MeasurementSchemaInfo.java
index 0908f8a5189..9db3ebadbfd 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/MeasurementSchemaInfo.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/MeasurementSchemaInfo.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.db.queryengine.common.schematree;
 
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 
 import org.apache.tsfile.write.schema.IMeasurementSchema;
 import org.apache.tsfile.write.schema.MeasurementSchema;
@@ -32,13 +32,13 @@ import java.util.Map;
  * measurement name, alias and MeasurementSchema, which are necessary to construct schemaTree for
  * Query and Insertion.
  */
-// public class MeasurementSchemaInfo implements IMeasurementSchemaInfo {
+public class MeasurementSchemaInfo implements IMeasurementSchemaInfo {
 
   private final String name;
   private final String alias;
   private Map<String, String> tagMap;
   private Map<String, String> attributeMap;
-//   private final IMeasurementSchema schema;
+  private final IMeasurementSchema schema;
 
   public MeasurementSchemaInfo(
       String name,
@@ -57,18 +57,18 @@ import java.util.Map;
     return name;
   }
 
-//   public IMeasurementSchema getSchema() {
+  public IMeasurementSchema getSchema() {
     return schema;
   }
 
-//   public MeasurementSchema getSchemaAsMeasurementSchema() {
-//     if (this.isLogicalView()) {
-//       return null;
-//     } else {
-//       return (MeasurementSchema) this.schema;
-//     }
-//   }
-// 
+  public MeasurementSchema getSchemaAsMeasurementSchema() {
+    if (this.isLogicalView()) {
+      return null;
+    } else {
+      return (MeasurementSchema) this.schema;
+    }
+  }
+
   @Override
   public Map<String, String> getTagMap() {
     return tagMap;
@@ -79,20 +79,20 @@ import java.util.Map;
     return attributeMap;
   }
 
-//   @Override
-//   public LogicalViewSchema getSchemaAsLogicalViewSchema() {
-//     if (this.isLogicalView()) {
-//       return (LogicalViewSchema) this.schema;
-//     }
-//     return null;
-//   }
-// 
+  @Override
+  public LogicalViewSchema getSchemaAsLogicalViewSchema() {
+    if (this.isLogicalView()) {
+      return (LogicalViewSchema) this.schema;
+    }
+    return null;
+  }
+
   public String getAlias() {
     return alias;
   }
-// 
-//   @Override
-//   public boolean isLogicalView() {
-//     return this.schema.isLogicalView();
-//   }
+
+  @Override
+  public boolean isLogicalView() {
+    return this.schema.isLogicalView();
+  }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/node/SchemaMeasurementNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/node/SchemaMeasurementNode.java
index 3ba8cc92392..6f5bd07f08f 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/node/SchemaMeasurementNode.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/common/schematree/node/SchemaMeasurementNode.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.db.queryengine.common.schematree.node;
 
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 import org.apache.iotdb.db.queryengine.common.schematree.IMeasurementSchemaInfo;
 
 import org.apache.tsfile.utils.RamUsageEstimator;
@@ -39,11 +39,11 @@ public class SchemaMeasurementNode extends SchemaNode implements IMeasurementSch
       RamUsageEstimator.shallowSizeOfInstance(SchemaMeasurementNode.class);
 
   private String alias;
-//   private IMeasurementSchema schema;
+  private IMeasurementSchema schema;
   private Map<String, String> tagMap;
   private Map<String, String> attributeMap;
 
-//   public SchemaMeasurementNode(String name, IMeasurementSchema schema) {
+  public SchemaMeasurementNode(String name, IMeasurementSchema schema) {
     super(name);
     this.schema = schema;
   }
@@ -68,35 +68,35 @@ public class SchemaMeasurementNode extends SchemaNode implements IMeasurementSch
     return alias;
   }
 
-//   @Override
-//   public boolean isLogicalView() {
-//     return this.schema.isLogicalView();
-//   }
-// 
+  @Override
+  public boolean isLogicalView() {
+    return this.schema.isLogicalView();
+  }
+
   public void setAlias(String alias) {
     this.alias = alias;
   }
 
-//   public IMeasurementSchema getSchema() {
+  public IMeasurementSchema getSchema() {
     return schema;
   }
 
-//   @Override
-//   public MeasurementSchema getSchemaAsMeasurementSchema() {
-//     if (this.schema instanceof MeasurementSchema) {
-//       return (MeasurementSchema) this.getSchema();
-//     }
-//     return null;
-//   }
-// 
-//   @Override
-//   public LogicalViewSchema getSchemaAsLogicalViewSchema() {
-//     if (this.schema instanceof LogicalViewSchema) {
-//       return (LogicalViewSchema) this.getSchema();
-//     }
-//     return null;
-//   }
-// 
+  @Override
+  public MeasurementSchema getSchemaAsMeasurementSchema() {
+    if (this.schema instanceof MeasurementSchema) {
+      return (MeasurementSchema) this.getSchema();
+    }
+    return null;
+  }
+
+  @Override
+  public LogicalViewSchema getSchemaAsLogicalViewSchema() {
+    if (this.schema instanceof LogicalViewSchema) {
+      return (LogicalViewSchema) this.getSchema();
+    }
+    return null;
+  }
+
   @Override
   public Map<String, String> getTagMap() {
     return tagMap;
@@ -138,7 +138,7 @@ public class SchemaMeasurementNode extends SchemaNode implements IMeasurementSch
     measurementNode.setAlias(alias);
   }
 
-//   private void setSchema(IMeasurementSchema schema) {
+  private void setSchema(IMeasurementSchema schema) {
     this.schema = schema;
   }
 
@@ -170,12 +170,12 @@ public class SchemaMeasurementNode extends SchemaNode implements IMeasurementSch
     ReadWriteIOUtils.write(getType(), outputStream);
     ReadWriteIOUtils.write(name, outputStream);
     ReadWriteIOUtils.write(alias, outputStream);
-// 
-//     MeasurementSchemaType measurementSchemaType = schema.getSchemaType();
-//     ReadWriteIOUtils.write(
-//         measurementSchemaType.getMeasurementSchemaTypeInByteEnum(), outputStream);
+
+    MeasurementSchemaType measurementSchemaType = schema.getSchemaType();
+    ReadWriteIOUtils.write(
+        measurementSchemaType.getMeasurementSchemaTypeInByteEnum(), outputStream);
     schema.serializeTo(outputStream);
-// 
+
     ReadWriteIOUtils.write(tagMap, outputStream);
     ReadWriteIOUtils.write(attributeMap, outputStream);
   }
@@ -183,17 +183,17 @@ public class SchemaMeasurementNode extends SchemaNode implements IMeasurementSch
   public static SchemaMeasurementNode deserialize(InputStream inputStream) throws IOException {
     String name = ReadWriteIOUtils.readString(inputStream);
     String alias = ReadWriteIOUtils.readString(inputStream);
-// 
-//     IMeasurementSchema schema = null;
+
+    IMeasurementSchema schema = null;
     byte measurementSchemaType = ReadWriteIOUtils.readByte(inputStream);
-//     if (measurementSchemaType
-//         == MeasurementSchemaType.MEASUREMENT_SCHEMA.getMeasurementSchemaTypeInByteEnum()) {
-//       schema = MeasurementSchema.deserializeFrom(inputStream);
-//     } else if (measurementSchemaType
-//         == MeasurementSchemaType.LOGICAL_VIEW_SCHEMA.getMeasurementSchemaTypeInByteEnum()) {
-//       schema = LogicalViewSchema.deserializeFrom(inputStream);
-//     }
-// 
+    if (measurementSchemaType
+        == MeasurementSchemaType.MEASUREMENT_SCHEMA.getMeasurementSchemaTypeInByteEnum()) {
+      schema = MeasurementSchema.deserializeFrom(inputStream);
+    } else if (measurementSchemaType
+        == MeasurementSchemaType.LOGICAL_VIEW_SCHEMA.getMeasurementSchemaTypeInByteEnum()) {
+      schema = LogicalViewSchema.deserializeFrom(inputStream);
+    }
+
     Map<String, String> tagMap = ReadWriteIOUtils.readMap(inputStream);
     Map<String, String> attributeMap = ReadWriteIOUtils.readMap(inputStream);
 
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java
index b8ff8f3f699..f4aca5e157e 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutor.java
@@ -1028,9 +1028,9 @@ public class RegionWriteExecutor {
         context.getRegionWriteValidationRWLock().readLock().unlock();
       }
     }
-// 
-//     @Override
-//     public RegionExecutionResult visitCreateLogicalView(
+
+    @Override
+    public RegionExecutionResult visitCreateLogicalView(
         final CreateLogicalViewNode node, final WritePlanNodeExecutionContext context) {
       return executeCreateLogicalView(node, context, false);
     }
@@ -1042,48 +1042,48 @@ public class RegionWriteExecutor {
       final ISchemaRegion schemaRegion =
           schemaEngine.getSchemaRegion((SchemaRegionId) context.getRegionId());
       if (CONFIG.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RATIS_CONSENSUS)) {
-//         context.getRegionWriteValidationRWLock().writeLock().lock();
-//         try {
+        context.getRegionWriteValidationRWLock().writeLock().lock();
+        try {
           // step 1. make sure all target paths do NOT exist.
           final List<PartialPath> targetPaths = node.getViewPathList();
           final List<MetadataException> failingMetadataException = new ArrayList<>();
           for (final PartialPath thisPath : targetPaths) {
-//             // no alias list for a view, so the third parameter is null
+            // no alias list for a view, so the third parameter is null
             final Map<Integer, MetadataException> failingMeasurementMap =
-//                 schemaRegion.checkMeasurementExistence(
-//                     thisPath.getDevicePath(),
-//                     Collections.singletonList(thisPath.getMeasurement()),
-//                     null);
+                schemaRegion.checkMeasurementExistence(
+                    thisPath.getDevicePath(),
+                    Collections.singletonList(thisPath.getMeasurement()),
+                    null);
             // merge all exceptions into one map
             for (final Map.Entry<Integer, MetadataException> entry :
                 failingMeasurementMap.entrySet()) {
-//               failingMetadataException.add(entry.getValue());
-//             }
-//           }
+              failingMetadataException.add(entry.getValue());
+            }
+          }
           // if there are some exceptions, handle each exception and return first of them.
-//           if (!failingMetadataException.isEmpty()) {
+          if (!failingMetadataException.isEmpty()) {
             final MetadataException metadataException = failingMetadataException.get(0);
             LOGGER.info(METADATA_ERROR_MSG, metadataException.getMessage());
             return RegionExecutionResult.create(
                 false,
                 metadataException.getMessage(),
-//                 RpcUtils.getStatus(
-//                     metadataException.getErrorCode(), metadataException.getMessage()));
-//           }
+                RpcUtils.getStatus(
+                    metadataException.getErrorCode(), metadataException.getMessage()));
+          }
           // step 2. make sure all source paths exist.
           return receivedFromPipe
               ? super.visitPipeEnrichedWritePlanNode(new PipeEnrichedWritePlanNode(node), context)
               : super.visitCreateLogicalView(node, context);
-//         } finally {
-//           context.getRegionWriteValidationRWLock().writeLock().unlock();
-//         }
-//       } else {
+        } finally {
+          context.getRegionWriteValidationRWLock().writeLock().unlock();
+        }
+      } else {
         return receivedFromPipe
             ? super.visitPipeEnrichedWritePlanNode(new PipeEnrichedWritePlanNode(node), context)
             : super.visitCreateLogicalView(node, context);
-//       }
-//       // end of visitCreateLogicalView
-//     }
+      }
+      // end of visitCreateLogicalView
+    }
 
     @Override
     public RegionExecutionResult visitCreateOrUpdateTableDevice(
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/LogicalViewSchemaSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/LogicalViewSchemaSource.java
index b9cf02cf884..f1eaaebbd1d 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/LogicalViewSchemaSource.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/LogicalViewSchemaSource.java
@@ -50,7 +50,7 @@ public class LogicalViewSchemaSource implements ISchemaSource<ITimeSeriesSchemaI
   private final long offset;
 
   private final SchemaFilter schemaFilter;
-// 
+
   LogicalViewSchemaSource(
       PartialPath pathPattern,
       long limit,
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TimeSeriesSchemaSource.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TimeSeriesSchemaSource.java
index a40fbb3e45e..5c13c958c02 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TimeSeriesSchemaSource.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TimeSeriesSchemaSource.java
@@ -54,7 +54,7 @@ public class TimeSeriesSchemaSource implements ISchemaSource<ITimeSeriesSchemaIn
   private final SchemaFilter schemaFilter;
   private final Map<Integer, Template> templateMap;
   private final boolean needViewDetail;
-// 
+
   TimeSeriesSchemaSource(
       PartialPath pathPattern,
       boolean isPrefixMatch,
@@ -104,7 +104,7 @@ public class TimeSeriesSchemaSource implements ISchemaSource<ITimeSeriesSchemaIn
     builder.writeNullableText(0, series.getFullPath());
     builder.writeNullableText(1, series.getAlias());
     builder.writeNullableText(2, database);
-//     builder.writeNullableText(3, series.getSchema().getType().toString());
+    builder.writeNullableText(3, series.getSchema().getType().toString());
     if (series.isLogicalView()) {
       builder.writeNullableText(4, null);
       builder.writeNullableText(5, null);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java
index 23d6850e65a..9235bc35088 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/Analysis.java
@@ -280,14 +280,14 @@ public class Analysis implements IAnalysis {
   // generated by combine the input path pattern and template set path
   private List<PartialPath> specifiedTemplateRelatedPathPatternList;
 
-//   /////////////////////////////////////////////////////////////////////////////////////////////////
-//   // Logical View Analysis
-//   /////////////////////////////////////////////////////////////////////////////////////////////////
-// 
+  /////////////////////////////////////////////////////////////////////////////////////////////////
+  // Logical View Analysis
+  /////////////////////////////////////////////////////////////////////////////////////////////////
+
   private boolean useLogicalView = false;
 
-//   private List<Pair<Expression, String>> outputExpressions = null;
-// 
+  private List<Pair<Expression, String>> outputExpressions = null;
+
   /////////////////////////////////////////////////////////////////////////////////////////////////
   // Show Queries Analysis
   /////////////////////////////////////////////////////////////////////////////////////////////////
@@ -871,26 +871,26 @@ public class Analysis implements IAnalysis {
   public void setDeviceToSortItems(Map<IDeviceID, List<SortItem>> deviceToSortItems) {
     this.deviceToSortItems = deviceToSortItems;
   }
-// 
-//   /////////////////////////////////////////////////////////////////////////////////////////////////
-//   // Logical View Analysis
-//   /////////////////////////////////////////////////////////////////////////////////////////////////
-// 
+
+  /////////////////////////////////////////////////////////////////////////////////////////////////
+  // Logical View Analysis
+  /////////////////////////////////////////////////////////////////////////////////////////////////
+
   public void setUseLogicalView(boolean useLogicalView) {
     this.useLogicalView = useLogicalView;
-//   }
-// 
+  }
+
   public boolean useLogicalView() {
     return this.useLogicalView;
-//   }
-// 
-//   public void setOutputExpressions(List<Pair<Expression, String>> outputExpressions) {
-//     this.outputExpressions = outputExpressions;
-//   }
-// 
-//   public List<Pair<Expression, String>> getOutputExpressions() {
-//     return this.outputExpressions;
-//   }
+  }
+
+  public void setOutputExpressions(List<Pair<Expression, String>> outputExpressions) {
+    this.outputExpressions = outputExpressions;
+  }
+
+  public List<Pair<Expression, String>> getOutputExpressions() {
+    return this.outputExpressions;
+  }
 
   public Ordering getTimeseriesOrderingForLastQuery() {
     return timeseriesOrderingForLastQuery;
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java
index d0e5643fdc6..30e8426c707 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java
@@ -36,14 +36,14 @@ import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.path.PathPatternTree;
 import org.apache.iotdb.commons.schema.column.ColumnHeader;
 import org.apache.iotdb.commons.schema.column.ColumnHeaderConstant;
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.commons.utils.TimePartitionUtils;
 import org.apache.iotdb.db.conf.IoTDBConfig;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.exception.ainode.GetModelInfoException;
 import org.apache.iotdb.db.exception.metadata.template.TemplateIncompatibleException;
-// import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException;
+import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException;
 import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
 import org.apache.iotdb.db.queryengine.common.DeviceContext;
@@ -701,9 +701,9 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
           for (PartialPath path : pathsNeedToReFetch) {
             patternTree.appendFullPath(path);
             needToReFetch = true;
-//           }
-//         }
-//       }
+          }
+        }
+      }
     } catch (Exception e) {
       throw new SemanticException(e);
     }
@@ -721,9 +721,9 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
       Set<String> allDatabases = viewSchemaTree.getDatabases();
       allDatabases.addAll(originSchemaTree.getDatabases());
       originSchemaTree.setDatabases(allDatabases);
-//     }
-//   }
-// 
+    }
+  }
+
   /** process select component for align by time + group by level. */
   private List<Pair<Expression, String>> analyzeGroupByLevelSelect(
       Analysis analysis,
@@ -799,7 +799,7 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
     Set<String> aliasSet = new HashSet<>();
 
     int columnIndex = 0;
-// 
+
     for (ResultColumn resultColumn : queryStatement.getSelectComponent().getResultColumns()) {
       List<Pair<Expression, String>> outputExpressions = new ArrayList<>();
       List<Expression> resultExpressions =
@@ -2893,20 +2893,20 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
     }
     analysis.setRealStatement(realInsertStatement);
 
-//     if (realInsertStatement instanceof InsertRowStatement) {
-//       InsertRowStatement realInsertRowStatement = (InsertRowStatement) realInsertStatement;
-//       DataPartitionQueryParam dataPartitionQueryParam = new DataPartitionQueryParam();
+    if (realInsertStatement instanceof InsertRowStatement) {
+      InsertRowStatement realInsertRowStatement = (InsertRowStatement) realInsertStatement;
+      DataPartitionQueryParam dataPartitionQueryParam = new DataPartitionQueryParam();
       dataPartitionQueryParam.setDeviceID(
           realInsertRowStatement.getDevicePath().getIDeviceIDAsFullDevice());
-//       dataPartitionQueryParam.setTimePartitionSlotList(
-//           Collections.singletonList(realInsertRowStatement.getTimePartitionSlot()));
+      dataPartitionQueryParam.setTimePartitionSlotList(
+          Collections.singletonList(realInsertRowStatement.getTimePartitionSlot()));
 
       AnalyzeUtils.analyzeDataPartition(
           analysis,
           Collections.singletonList(dataPartitionQueryParam),
           context.getSession().getUserName(),
           partitionFetcher::getOrCreateDataPartition);
-//     } else {
+    } else {
       AnalyzeUtils.analyzeDataPartition(
           analysis,
           AnalyzeUtils.computeTreeDataPartitionParams(realInsertStatement, context),
@@ -2917,8 +2917,8 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
   }
 
   @Override
-//   public Analysis visitInsertRows(
-//       InsertRowsStatement insertRowsStatement, MPPQueryContext context) {
+  public Analysis visitInsertRows(
+      InsertRowsStatement insertRowsStatement, MPPQueryContext context) {
     context.setQueryType(QueryType.WRITE);
     insertRowsStatement.semanticCheck();
     Analysis analysis = new Analysis();
@@ -2926,7 +2926,7 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
         analysis,
         insertRowsStatement,
         () -> SchemaValidator.validate(schemaFetcher, insertRowsStatement, context));
-//     InsertRowsStatement realInsertRowsStatement =
+    InsertRowsStatement realInsertRowsStatement =
         (InsertRowsStatement) removeLogicalView(analysis, insertRowsStatement);
     if (analysis.isFinishQueryAfterAnalyze()) {
       return analysis;
@@ -2941,31 +2941,31 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
     return analysis;
   }
 
-//   @Override
-//   public Analysis visitInsertMultiTablets(
-//       InsertMultiTabletsStatement insertMultiTabletsStatement, MPPQueryContext context) {
-//     context.setQueryType(QueryType.WRITE);
+  @Override
+  public Analysis visitInsertMultiTablets(
+      InsertMultiTabletsStatement insertMultiTabletsStatement, MPPQueryContext context) {
+    context.setQueryType(QueryType.WRITE);
     insertMultiTabletsStatement.semanticCheck();
-//     Analysis analysis = new Analysis();
+    Analysis analysis = new Analysis();
     validateSchema(
         analysis,
         insertMultiTabletsStatement,
         () -> SchemaValidator.validate(schemaFetcher, insertMultiTabletsStatement, context));
-//     InsertMultiTabletsStatement realStatement =
+    InsertMultiTabletsStatement realStatement =
         (InsertMultiTabletsStatement) removeLogicalView(analysis, insertMultiTabletsStatement);
-//     if (analysis.isFinishQueryAfterAnalyze()) {
-//       return analysis;
-//     }
+    if (analysis.isFinishQueryAfterAnalyze()) {
+      return analysis;
+    }
     analysis.setRealStatement(realStatement);
-// 
+
     AnalyzeUtils.analyzeDataPartition(
         analysis,
         AnalyzeUtils.computeTreeDataPartitionParams(realStatement, context),
         context.getSession().getUserName(),
         partitionFetcher::getOrCreateDataPartition);
     return analysis;
-//   }
-// 
+  }
+
   @Override
   public Analysis visitInsertRowsOfOneDevice(
       InsertRowsOfOneDeviceStatement insertRowsOfOneDeviceStatement, MPPQueryContext context) {
@@ -2983,25 +2983,25 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
     }
     analysis.setRealStatement(realInsertStatement);
 
-//     if (realInsertStatement instanceof InsertRowsOfOneDeviceStatement) {
-//       InsertRowsOfOneDeviceStatement realStatement =
-//           (InsertRowsOfOneDeviceStatement) realInsertStatement;
-//       DataPartitionQueryParam dataPartitionQueryParam = new DataPartitionQueryParam();
+    if (realInsertStatement instanceof InsertRowsOfOneDeviceStatement) {
+      InsertRowsOfOneDeviceStatement realStatement =
+          (InsertRowsOfOneDeviceStatement) realInsertStatement;
+      DataPartitionQueryParam dataPartitionQueryParam = new DataPartitionQueryParam();
       dataPartitionQueryParam.setDeviceID(realStatement.getDevicePath().getIDeviceIDAsFullDevice());
-//       dataPartitionQueryParam.setTimePartitionSlotList(realStatement.getTimePartitionSlots());
+      dataPartitionQueryParam.setTimePartitionSlotList(realStatement.getTimePartitionSlots());
 
       AnalyzeUtils.analyzeDataPartition(
           analysis,
           Collections.singletonList(dataPartitionQueryParam),
           context.getSession().getUserName(),
           partitionFetcher::getOrCreateDataPartition);
-//     } else {
+    } else {
       AnalyzeUtils.analyzeDataPartition(
           analysis,
           AnalyzeUtils.computeTreeDataPartitionParams(realInsertStatement, context),
           context.getSession().getUserName(),
           partitionFetcher::getOrCreateDataPartition);
-//     }
+    }
     return analysis;
   }
 
@@ -3803,9 +3803,9 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
 
     analysis.setWhereExpression(whereExpression);
   }
-// 
+
   // Region view
-// 
+
   // Create Logical View
   @Override
   public Analysis visitCreateLogicalView(
@@ -3852,61 +3852,61 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
       if (analysis.isFinishQueryAfterAnalyze()) {
         return analysis;
       }
-//     }
-// 
+    }
+
     // Check target paths.
     checkTargetPathsInCreateLogicalView(analysis, createLogicalViewStatement, context);
     if (analysis.isFinishQueryAfterAnalyze()) {
       return analysis;
-//     }
-// 
+    }
+
     // Set schema partition info, this info will be used to split logical plan node.
     PathPatternTree patternTree = new PathPatternTree();
     for (PartialPath thisFullPath : createLogicalViewStatement.getTargetPathList()) {
       patternTree.appendFullPath(thisFullPath);
-//     }
+    }
     SchemaPartition schemaPartitionInfo =
         partitionFetcher.getOrCreateSchemaPartition(
             patternTree, context.getSession().getUserName());
     analysis.setSchemaPartitionInfo(schemaPartitionInfo);
 
     return analysis;
-//   }
-// 
-//   private Pair<List<Expression>, Analysis> analyzeQueryInLogicalViewStatement(
-//       Analysis analysis, QueryStatement queryStatement, MPPQueryContext context) {
-//     Analysis queryAnalysis = this.visitQuery(queryStatement, context);
+  }
+
+  private Pair<List<Expression>, Analysis> analyzeQueryInLogicalViewStatement(
+      Analysis analysis, QueryStatement queryStatement, MPPQueryContext context) {
+    Analysis queryAnalysis = this.visitQuery(queryStatement, context);
     analysis.setSchemaTree(queryAnalysis.getSchemaTree());
-//     // get all expression from resultColumns
-//     List<Pair<Expression, String>> outputExpressions = queryAnalysis.getOutputExpressions();
-//     if (queryAnalysis.isFailed()) {
-//       analysis.setFinishQueryAfterAnalyze(true);
-//       analysis.setFailStatus(queryAnalysis.getFailStatus());
-//       return new Pair<>(null, analysis);
-//     }
-//     if (outputExpressions == null) {
-//       analysis.setFinishQueryAfterAnalyze(true);
-//       analysis.setFailStatus(
-//           RpcUtils.getStatus(
-//               TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
-//               "Columns in the query statement is empty. Please check your SQL."));
-//       return new Pair<>(null, analysis);
-//     }
+    // get all expression from resultColumns
+    List<Pair<Expression, String>> outputExpressions = queryAnalysis.getOutputExpressions();
+    if (queryAnalysis.isFailed()) {
+      analysis.setFinishQueryAfterAnalyze(true);
+      analysis.setFailStatus(queryAnalysis.getFailStatus());
+      return new Pair<>(null, analysis);
+    }
+    if (outputExpressions == null) {
+      analysis.setFinishQueryAfterAnalyze(true);
+      analysis.setFailStatus(
+          RpcUtils.getStatus(
+              TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
+              "Columns in the query statement is empty. Please check your SQL."));
+      return new Pair<>(null, analysis);
+    }
     if (queryAnalysis.useLogicalView()) {
-//       analysis.setFinishQueryAfterAnalyze(true);
-//       analysis.setFailStatus(
-//           RpcUtils.getStatus(
-//               TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
-//               "Can not create a view based on existing views. Check the query in your SQL."));
-//       return new Pair<>(null, analysis);
-//     }
-//     List<Expression> expressionList = new ArrayList<>();
-//     for (Pair<Expression, String> thisPair : outputExpressions) {
-//       expressionList.add(thisPair.left);
-//     }
-//     return new Pair<>(expressionList, analysis);
-//   }
-// 
+      analysis.setFinishQueryAfterAnalyze(true);
+      analysis.setFailStatus(
+          RpcUtils.getStatus(
+              TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
+              "Can not create a view based on existing views. Check the query in your SQL."));
+      return new Pair<>(null, analysis);
+    }
+    List<Expression> expressionList = new ArrayList<>();
+    for (Pair<Expression, String> thisPair : outputExpressions) {
+      expressionList.add(thisPair.left);
+    }
+    return new Pair<>(expressionList, analysis);
+  }
+
   private void checkSourcePathsInCreateLogicalView(
       Analysis analysis, CreateLogicalViewStatement createLogicalViewStatement) {
     Pair<Boolean, String> checkResult =
@@ -3938,47 +3938,46 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
       List<Expression> sourceExpressionList,
       MPPQueryContext context,
       boolean canSeeAuditDB) {
-//       Analysis analysis, List<Expression> sourceExpressionList, MPPQueryContext context) {
-//     List<PartialPath> pathsNeedCheck = new ArrayList<>();
-//     for (Expression expression : sourceExpressionList) {
-//       if (expression instanceof TimeSeriesOperand) {
-//         pathsNeedCheck.add(((TimeSeriesOperand) expression).getPath());
-//       }
-//     }
-//     Pair<ISchemaTree, Integer> schemaOfNeedToCheck =
-        fetchSchemaOfPathsAndCount(pathsNeedCheck, analysis, context);
-//     if (schemaOfNeedToCheck.right != pathsNeedCheck.size()) {
+    List<PartialPath> pathsNeedCheck = new ArrayList<>();
+    for (Expression expression : sourceExpressionList) {
+      if (expression instanceof TimeSeriesOperand) {
+        pathsNeedCheck.add(((TimeSeriesOperand) expression).getPath());
+      }
+    }
+    Pair<ISchemaTree, Integer> schemaOfNeedToCheck =
+        fetchSchemaOfPathsAndCount(pathsNeedCheck, analysis, context, canSeeAuditDB);
+    if (schemaOfNeedToCheck.right != pathsNeedCheck.size()) {
       // Some source paths is not exist, and could not fetch schema.
-//       analysis.setFinishQueryAfterAnalyze(true);
-//       analysis.setFailStatus(
-//           RpcUtils.getStatus(
-//               TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
-//               "Can not create a view based on non-exist time series."));
+      analysis.setFinishQueryAfterAnalyze(true);
+      analysis.setFailStatus(
+          RpcUtils.getStatus(
+              TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
+              "Can not create a view based on non-exist time series."));
       return;
-//     }
-//     Pair<List<PartialPath>, PartialPath> viewInSourceCheckResult =
-//         findAllViewsInPaths(pathsNeedCheck, schemaOfNeedToCheck.left);
-//     if (viewInSourceCheckResult.right != null) {
+    }
+    Pair<List<PartialPath>, PartialPath> viewInSourceCheckResult =
+        findAllViewsInPaths(pathsNeedCheck, schemaOfNeedToCheck.left);
+    if (viewInSourceCheckResult.right != null) {
       // Some source paths is not exist
-//       analysis.setFinishQueryAfterAnalyze(true);
-//       analysis.setFailStatus(
-//           RpcUtils.getStatus(
-//               TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
-//               "Path "
-//                   + viewInSourceCheckResult.right.toString()
-//                   + " does not exist! You can not create a view based on non-exist time series."));
+      analysis.setFinishQueryAfterAnalyze(true);
+      analysis.setFailStatus(
+          RpcUtils.getStatus(
+              TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
+              "Path "
+                  + viewInSourceCheckResult.right.toString()
+                  + " does not exist! You can not create a view based on non-exist time series."));
       return;
-//     }
+    }
     if (!viewInSourceCheckResult.left.isEmpty()) {
       // Some source paths is logical view
-//       analysis.setFinishQueryAfterAnalyze(true);
-//       analysis.setFailStatus(
-//           RpcUtils.getStatus(
-//               TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
-//               "Can not create a view based on existing views."));
-//     }
-//   }
-// 
+      analysis.setFinishQueryAfterAnalyze(true);
+      analysis.setFailStatus(
+          RpcUtils.getStatus(
+              TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
+              "Can not create a view based on existing views."));
+    }
+  }
+
   /**
    * Compute how many paths exist, get the schema tree and the number of existed paths.
    *
@@ -4038,42 +4037,42 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
       final MPPQueryContext context) {
     final Pair<Boolean, String> checkResult = createLogicalViewStatement.checkTargetPaths();
     if (Boolean.FALSE.equals(checkResult.left)) {
-//       analysis.setFinishQueryAfterAnalyze(true);
-//       analysis.setFailStatus(
-//           RpcUtils.getStatus(
-//               TSStatusCode.ILLEGAL_PATH.getStatusCode(),
-//               "The path " + checkResult.right + " is illegal."));
+      analysis.setFinishQueryAfterAnalyze(true);
+      analysis.setFailStatus(
+          RpcUtils.getStatus(
+              TSStatusCode.ILLEGAL_PATH.getStatusCode(),
+              "The path " + checkResult.right + " is illegal."));
       return;
-//     }
+    }
     // Make sure there are no redundant paths in targets. Note that redundant paths in source
     // are legal.
     final List<PartialPath> targetPathList = createLogicalViewStatement.getTargetPathList();
     final Set<String> targetStringSet = new HashSet<>();
     for (final PartialPath path : targetPathList) {
       final boolean repeatPathNotExist = targetStringSet.add(path.toString());
-//       if (!repeatPathNotExist) {
-//         analysis.setFinishQueryAfterAnalyze(true);
-//         analysis.setFailStatus(
-//             RpcUtils.getStatus(
-//                 TSStatusCode.ILLEGAL_PATH.getStatusCode(),
-//                 String.format("Path [%s] is redundant in target paths.", path)));
-//         return;
-//       }
-//     }
+      if (!repeatPathNotExist) {
+        analysis.setFinishQueryAfterAnalyze(true);
+        analysis.setFailStatus(
+            RpcUtils.getStatus(
+                TSStatusCode.ILLEGAL_PATH.getStatusCode(),
+                String.format("Path [%s] is redundant in target paths.", path)));
+        return;
+      }
+    }
     // Make sure all paths are not under any templates
-//     try {
+    try {
       for (final PartialPath path : createLogicalViewStatement.getTargetPathList()) {
         checkIsTemplateCompatible(path, null, context);
-//       }
+      }
     } catch (final Exception e) {
-//       analysis.setFinishQueryAfterAnalyze(true);
-//       analysis.setFailStatus(
-//           RpcUtils.getStatus(
-//               TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
-//               "Can not create view under template."));
-//     }
-//   }
-// 
+      analysis.setFinishQueryAfterAnalyze(true);
+      analysis.setFailStatus(
+          RpcUtils.getStatus(
+              TSStatusCode.UNSUPPORTED_OPERATION.getStatusCode(),
+              "Can not create view under template."));
+    }
+  }
+
   @Override
   public Analysis visitShowLogicalView(
       final ShowLogicalViewStatement showLogicalViewStatement, final MPPQueryContext context) {
@@ -4090,7 +4089,7 @@ public class AnalyzeVisitor extends StatementVisitor<Analysis, MPPQueryContext>
     return analysis;
   }
 
-//   // endregion view
+  // endregion view
 
   @Override
   public Analysis visitShowCurrentTimestamp(
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ExpressionAnalyzer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ExpressionAnalyzer.java
index ae9b0b23624..a53ee3f7d32 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ExpressionAnalyzer.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ExpressionAnalyzer.java
@@ -403,14 +403,14 @@ public class ExpressionAnalyzer {
     }
   }
 
-//   /**
-//    * Bind schema ({@link PartialPath} -> {@link MeasurementPath}) and removes wildcards in
-//    * Expression. And all logical view will be replaced.
-//    *
-//    * @param schemaTree interface for querying schema information
-//    * @return the expression list after binding schema and whether there is logical view in
-//    *     expressions
-//    */
+  /**
+   * Bind schema ({@link PartialPath} -> {@link MeasurementPath}) and removes wildcards in
+   * Expression. And all logical view will be replaced.
+   *
+   * @param schemaTree interface for querying schema information
+   * @return the expression list after binding schema and whether there is logical view in
+   *     expressions
+   */
   public static List<Expression> bindSchemaForExpression(
       final Expression expression,
       final ISchemaTree schemaTree,
@@ -419,15 +419,15 @@ public class ExpressionAnalyzer {
         .process(expression, new BindSchemaForExpressionVisitor.Context(schemaTree, queryContext));
   }
 
-//   /**
-//    * Concat suffix path in WHERE and HAVING clause with the prefix path in the FROM clause. And
-//    * then, bind schema ({@link PartialPath} -> {@link MeasurementPath}) and removes wildcards in
-//    * Expression. Logical view will be replaced.
-//    *
-//    * @param prefixPaths prefix paths in the FROM clause
-//    * @param schemaTree interface for querying schema information
-//    * @return the expression list with full path and after binding schema
-//    */
+  /**
+   * Concat suffix path in WHERE and HAVING clause with the prefix path in the FROM clause. And
+   * then, bind schema ({@link PartialPath} -> {@link MeasurementPath}) and removes wildcards in
+   * Expression. Logical view will be replaced.
+   *
+   * @param prefixPaths prefix paths in the FROM clause
+   * @param schemaTree interface for querying schema information
+   * @return the expression list with full path and after binding schema
+   */
   public static List<Expression> bindSchemaForPredicate(
       final Expression predicate,
       final List<PartialPath> prefixPaths,
@@ -435,12 +435,12 @@ public class ExpressionAnalyzer {
       final boolean isRoot,
       final MPPQueryContext queryContext) {
     return new BindSchemaForPredicateVisitor()
-//         .process(
+        .process(
             predicate,
             new BindSchemaForPredicateVisitor.Context(
                 prefixPaths, schemaTree, isRoot, queryContext));
-//   }
-// 
+  }
+
   public static Expression replaceRawPathWithGroupedPath(
       Expression expression,
       GroupByLevelHelper.RawPathToGroupedPathMap rawPathToGroupedPathMap,
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java
index 7c4a7770543..1a2b10d3448 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ClusterSchemaFetchExecutor.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.db.queryengine.plan.analyze.schema;
 
-// import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.exception.IoTDBException;
 import org.apache.iotdb.commons.exception.MetadataException;
 import org.apache.iotdb.commons.exception.QuerySchemaFetchFailedException;
@@ -208,24 +208,24 @@ class ClusterSchemaFetchExecutor {
   }
 
   ClusterSchemaTree fetchSchemaWithFullPaths(List<String> fullPathList, MPPQueryContext context) {
-//     PathPatternTree patternTree = new PathPatternTree();
-//     for (String fullPath : fullPathList) {
-//       try {
+    PathPatternTree patternTree = new PathPatternTree();
+    for (String fullPath : fullPathList) {
+      try {
         patternTree.appendFullPath(new MeasurementPath(fullPath));
-//       } catch (IllegalPathException e) {
-//         throw new RuntimeException(e);
-//       }
-//     }
-//     patternTree.constructTree();
+      } catch (IllegalPathException e) {
+        throw new RuntimeException(e);
+      }
+    }
+    patternTree.constructTree();
     return fetchSchemaAndCacheResult(patternTree, context);
-//   }
-// 
+  }
+
   ClusterSchemaTree fetchSchemaWithPatternTreeAndCache(
       PathPatternTree patternTree, MPPQueryContext context) {
-//     patternTree.constructTree();
+    patternTree.constructTree();
     return fetchSchemaAndCacheResult(patternTree, context);
-//   }
-// 
+  }
+
   private ClusterSchemaTree fetchSchemaAndCacheResult(
       PathPatternTree patternTree, MPPQueryContext context) {
     ClusterSchemaTree schemaTree =
@@ -338,8 +338,8 @@ class ClusterSchemaFetchExecutor {
       }
     } catch (MemoryNotEnoughException e) {
       throw e;
-//     } catch (Exception e) {
-//       throw new RuntimeException(e);
+    } catch (Exception e) {
+      throw new RuntimeException(e);
     }
   }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaComputation.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaComputation.java
index 125a9b69687..c0934b2dcc5 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaComputation.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaComputation.java
@@ -20,12 +20,12 @@
 package org.apache.iotdb.db.queryengine.plan.analyze.schema;
 
 import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 import org.apache.iotdb.db.queryengine.common.schematree.IMeasurementSchemaInfo;
 
 import org.apache.tsfile.utils.Pair;
-// 
-// import java.util.List;
+
+import java.util.List;
 
 /**
  * This interface defines the required behaviour invoked during schema fetch/computation, which is
@@ -47,41 +47,41 @@ public interface ISchemaComputation {
    * @param measurementSchemaInfo the measurement schema of fetched measurement
    */
   void computeMeasurement(int index, IMeasurementSchemaInfo measurementSchemaInfo);
-// 
-//   // region used by logical view
-//   boolean hasLogicalViewNeedProcess();
-// 
-//   /**
-//    * @return the logical view schema list recorded by this statement. It may be NULL if it is not
-//    *     used before.
-//    */
-//   List<LogicalViewSchema> getLogicalViewSchemaList();
-// 
-//   /**
-//    * @return the index list of logical view paths, where source of views should be placed. For
-//    *     example, IndexListOfLogicalViewPaths[alpha] = beta, then you should use
-//    *     LogicalViewSchemaList[alpha] to fill measurementSchema[beta].
-//    */
-//   List<Integer> getIndexListOfLogicalViewPaths();
-// 
-//   /**
-//    * Record the beginning and ending of logical schema list. After calling this interface, the range
-//    * should be record. For example, the range is [0,4) which means 4 schemas exist. Later, more 3
-//    * schemas are added, this function is called, then it records [4,7).
-//    */
-//   void recordRangeOfLogicalViewSchemaListNow();
-// 
+
+  // region used by logical view
+  boolean hasLogicalViewNeedProcess();
+
+  /**
+   * @return the logical view schema list recorded by this statement. It may be NULL if it is not
+   *     used before.
+   */
+  List<LogicalViewSchema> getLogicalViewSchemaList();
+
+  /**
+   * @return the index list of logical view paths, where source of views should be placed. For
+   *     example, IndexListOfLogicalViewPaths[alpha] = beta, then you should use
+   *     LogicalViewSchemaList[alpha] to fill measurementSchema[beta].
+   */
+  List<Integer> getIndexListOfLogicalViewPaths();
+
+  /**
+   * Record the beginning and ending of logical schema list. After calling this interface, the range
+   * should be record. For example, the range is [0,4) which means 4 schemas exist. Later, more 3
+   * schemas are added, this function is called, then it records [4,7).
+   */
+  void recordRangeOfLogicalViewSchemaListNow();
+
   /**
    * @return the recorded range of logical view schema list.
    */
-//   Pair<Integer, Integer> getRangeOfLogicalViewSchemaListRecorded();
-// 
-//   /**
-//    * @param index the index of fetched measurement in array returned by getMeasurements
-//    * @param measurementSchemaInfo the measurement schema of source of the logical view
-//    * @param isAligned whether the source of this view is aligned.
-//    */
-//   void computeMeasurementOfView(
-//       int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned);
-//   // endregion
+  Pair<Integer, Integer> getRangeOfLogicalViewSchemaListRecorded();
+
+  /**
+   * @param index the index of fetched measurement in array returned by getMeasurements
+   * @param measurementSchemaInfo the measurement schema of source of the logical view
+   * @param isAligned whether the source of this view is aligned.
+   */
+  void computeMeasurementOfView(
+      int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned);
+  // endregion
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaValidation.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaValidation.java
index 86fcd7a032a..658cd2ef79d 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaValidation.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/ISchemaValidation.java
@@ -34,22 +34,22 @@ public interface ISchemaValidation extends ISchemaComputationWithAutoCreation {
     validateMeasurementSchema(index, measurementSchemaInfo);
   }
 
-//   @Override
-//   default void computeMeasurementOfView(
-//       int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) {
-//     validateMeasurementSchema(index, measurementSchemaInfo, isAligned);
-//   }
-// 
-//   /**
-//    * Record the real value of <code>isAligned</code> of this device. This will change the value of
-//    * <code>isAligned</code> in this insert statement.
-//    *
-//    * @param isAligned The real value of attribute <code>isAligned</code> of this device schema
-//    */
+  @Override
+  default void computeMeasurementOfView(
+      int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) {
+    validateMeasurementSchema(index, measurementSchemaInfo, isAligned);
+  }
+
+  /**
+   * Record the real value of <code>isAligned</code> of this device. This will change the value of
+   * <code>isAligned</code> in this insert statement.
+   *
+   * @param isAligned The real value of attribute <code>isAligned</code> of this device schema
+   */
   void validateDeviceSchema(boolean isAligned);
 
   void validateMeasurementSchema(int index, IMeasurementSchemaInfo measurementSchemaInfo);
-// 
-//   void validateMeasurementSchema(
-//       int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned);
+
+  void validateMeasurementSchema(
+      int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned);
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java
index 6673205610d..59bb199acf0 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java
@@ -19,15 +19,13 @@
 
 package org.apache.iotdb.db.queryengine.plan.analyze.schema;
 
-// import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.path.MeasurementPath;
-// import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.path.PathPatternTree;
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.path.PathPatternTree;
 import org.apache.iotdb.commons.pipe.config.constant.SystemConstant;
 import org.apache.iotdb.db.conf.IoTDBConfig;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
-// import org.apache.iotdb.db.exception.metadata.AlignedTimeseriesException;
-import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
 import org.apache.iotdb.db.queryengine.common.schematree.ClusterSchemaTree;
 import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache.TreeDeviceSchemaCacheManager;
@@ -57,121 +55,121 @@ class NormalSchemaFetcher {
     this.clusterSchemaFetchExecutor = clusterSchemaFetchExecutor;
   }
 
-//   /** Given full paths will be */
-//   private void computePatternTreeNeededReFetch(
-//       PathPatternTree patternTree, List<String> fullPaths) {
-//     for (String fullPath : fullPaths) {
-//       try {
+  /** Given full paths will be */
+  private void computePatternTreeNeededReFetch(
+      PathPatternTree patternTree, List<String> fullPaths) {
+    for (String fullPath : fullPaths) {
+      try {
         patternTree.appendFullPath(new MeasurementPath(fullPath));
-//       } catch (IllegalPathException e) {
-//         throw new RuntimeException(e);
-//       }
-//     }
-//   }
-// 
-//   private PathPatternTree computePatternTreeNeededReFetch(
-//       PartialPath devicePath,
-//       String[] measurementList,
-//       List<Integer> indexOfMissingMeasurements,
-//       List<String> fullPaths) {
-//     PathPatternTree patternTree = new PathPatternTree();
-//     for (int index : indexOfMissingMeasurements) {
-//       patternTree.appendFullPath(devicePath, measurementList[index]);
-//     }
-//     for (String fullPath : fullPaths) {
-//       try {
+      } catch (IllegalPathException e) {
+        throw new RuntimeException(e);
+      }
+    }
+  }
+
+  private PathPatternTree computePatternTreeNeededReFetch(
+      PartialPath devicePath,
+      String[] measurementList,
+      List<Integer> indexOfMissingMeasurements,
+      List<String> fullPaths) {
+    PathPatternTree patternTree = new PathPatternTree();
+    for (int index : indexOfMissingMeasurements) {
+      patternTree.appendFullPath(devicePath, measurementList[index]);
+    }
+    for (String fullPath : fullPaths) {
+      try {
         patternTree.appendFullPath(new MeasurementPath(fullPath));
-//       } catch (IllegalPathException e) {
-//         throw new RuntimeException(e);
-//       }
-//     }
-//     return patternTree;
-//   }
-// 
-//   private PathPatternTree computePatternTreeNeededReFetch(
-//       List<PartialPath> devicePathList,
-//       List<String[]> measurementsList,
-//       List<Integer> indexOfTargetDevices,
-//       List<List<Integer>> indexOfTargetMeasurementsList) {
-//     PathPatternTree patternTree = new PathPatternTree();
-//     int deviceIndex;
-//     for (int i = 0, size = indexOfTargetDevices.size(); i < size; i++) {
-//       deviceIndex = indexOfTargetDevices.get(i);
-//       for (int measurementIndex : indexOfTargetMeasurementsList.get(i)) {
-//         patternTree.appendFullPath(
-//             devicePathList.get(deviceIndex), measurementsList.get(deviceIndex)[measurementIndex]);
-//       }
-//     }
-//     return patternTree;
-//   }
-// 
+      } catch (IllegalPathException e) {
+        throw new RuntimeException(e);
+      }
+    }
+    return patternTree;
+  }
+
+  private PathPatternTree computePatternTreeNeededReFetch(
+      List<PartialPath> devicePathList,
+      List<String[]> measurementsList,
+      List<Integer> indexOfTargetDevices,
+      List<List<Integer>> indexOfTargetMeasurementsList) {
+    PathPatternTree patternTree = new PathPatternTree();
+    int deviceIndex;
+    for (int i = 0, size = indexOfTargetDevices.size(); i < size; i++) {
+      deviceIndex = indexOfTargetDevices.get(i);
+      for (int measurementIndex : indexOfTargetMeasurementsList.get(i)) {
+        patternTree.appendFullPath(
+            devicePathList.get(deviceIndex), measurementsList.get(deviceIndex)[measurementIndex]);
+      }
+    }
+    return patternTree;
+  }
+
   List<Integer> processNormalTimeSeries(
       ISchemaComputationWithAutoCreation schemaComputationWithAutoCreation,
       MPPQueryContext context) {
-//     // [Step 0] Record the input value.
-//     boolean isAlignedPutIn = schemaComputationWithAutoCreation.isAligned();
-// 
-//     // [Step 1] Cache 1. compute measurements and record logical views.
+    // [Step 0] Record the input value.
+    boolean isAlignedPutIn = schemaComputationWithAutoCreation.isAligned();
+
+    // [Step 1] Cache 1. compute measurements and record logical views.
     List<Integer> indexOfMissingMeasurements =
         schemaCache.computeWithoutTemplate(schemaComputationWithAutoCreation);
-//     // [Step 2] Cache 2. process recorded logical views. If there is no views now, it returns empty
-//     // lists.
-//     Pair<List<Integer>, List<String>> missedIndexAndPathString =
-//         schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreation);
-//     List<Integer> indexOfMissingLogicalView = missedIndexAndPathString.left;
-//     List<String> missedPathStringOfLogicalView = missedIndexAndPathString.right;
+    // [Step 2] Cache 2. process recorded logical views. If there is no views now, it returns empty
+    // lists.
+    Pair<List<Integer>, List<String>> missedIndexAndPathString =
+        schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreation);
+    List<Integer> indexOfMissingLogicalView = missedIndexAndPathString.left;
+    List<String> missedPathStringOfLogicalView = missedIndexAndPathString.right;
     // all schema can be taken from cache
-//     if (indexOfMissingMeasurements.isEmpty() && indexOfMissingLogicalView.isEmpty()) {
+    if (indexOfMissingMeasurements.isEmpty() && indexOfMissingLogicalView.isEmpty()) {
       return indexOfMissingMeasurements;
     }
-//     // [Step 3] Fetch 1. fetch schema from remote. Process logical view first; then process
-//     // measurements.
-//     // try fetch the missing raw schema from remote and cache fetched schema
-//     ClusterSchemaTree remoteSchemaTree;
-//     if (missedPathStringOfLogicalView.isEmpty()) {
-//       remoteSchemaTree =
-//           clusterSchemaFetchExecutor.fetchSchemaOfOneDevice(
-//               schemaComputationWithAutoCreation.getDevicePath(),
-//               schemaComputationWithAutoCreation.getMeasurements(),
+    // [Step 3] Fetch 1. fetch schema from remote. Process logical view first; then process
+    // measurements.
+    // try fetch the missing raw schema from remote and cache fetched schema
+    ClusterSchemaTree remoteSchemaTree;
+    if (missedPathStringOfLogicalView.isEmpty()) {
+      remoteSchemaTree =
+          clusterSchemaFetchExecutor.fetchSchemaOfOneDevice(
+              schemaComputationWithAutoCreation.getDevicePath(),
+              schemaComputationWithAutoCreation.getMeasurements(),
               indexOfMissingMeasurements,
               context);
-//     } else {
-//       PathPatternTree patternTree =
-//           computePatternTreeNeededReFetch(
-//               schemaComputationWithAutoCreation.getDevicePath(),
-//               schemaComputationWithAutoCreation.getMeasurements(),
-//               indexOfMissingMeasurements,
-//               missedPathStringOfLogicalView);
+    } else {
+      PathPatternTree patternTree =
+          computePatternTreeNeededReFetch(
+              schemaComputationWithAutoCreation.getDevicePath(),
+              schemaComputationWithAutoCreation.getMeasurements(),
+              indexOfMissingMeasurements,
+              missedPathStringOfLogicalView);
       remoteSchemaTree =
           clusterSchemaFetchExecutor.fetchSchemaWithPatternTreeAndCache(patternTree, context);
-//     }
-//     // make sure all missed views are computed.
-//     remoteSchemaTree.computeSourceOfLogicalView(
-//         schemaComputationWithAutoCreation, indexOfMissingLogicalView);
+    }
+    // make sure all missed views are computed.
+    remoteSchemaTree.computeSourceOfLogicalView(
+        schemaComputationWithAutoCreation, indexOfMissingLogicalView);
     // check and compute the fetched schema
     indexOfMissingMeasurements =
         remoteSchemaTree.compute(schemaComputationWithAutoCreation, indexOfMissingMeasurements);
-//     schemaComputationWithAutoCreation.recordRangeOfLogicalViewSchemaListNow();
-// 
-//     // [Step 4] Fetch 2. Some fetched measurements in [Step 3] are views. Process them.
-//     missedIndexAndPathString =
-//         schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreation);
-//     indexOfMissingLogicalView = missedIndexAndPathString.left;
-//     missedPathStringOfLogicalView = missedIndexAndPathString.right;
-//     if (!missedPathStringOfLogicalView.isEmpty()) {
-//       ClusterSchemaTree viewSchemaTree =
+    schemaComputationWithAutoCreation.recordRangeOfLogicalViewSchemaListNow();
+
+    // [Step 4] Fetch 2. Some fetched measurements in [Step 3] are views. Process them.
+    missedIndexAndPathString =
+        schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreation);
+    indexOfMissingLogicalView = missedIndexAndPathString.left;
+    missedPathStringOfLogicalView = missedIndexAndPathString.right;
+    if (!missedPathStringOfLogicalView.isEmpty()) {
+      ClusterSchemaTree viewSchemaTree =
           clusterSchemaFetchExecutor.fetchSchemaWithFullPaths(
               missedPathStringOfLogicalView, context);
-//       viewSchemaTree.computeSourceOfLogicalView(
-//           schemaComputationWithAutoCreation, indexOfMissingLogicalView);
-//     }
+      viewSchemaTree.computeSourceOfLogicalView(
+          schemaComputationWithAutoCreation, indexOfMissingLogicalView);
+    }
 
     // all schema has been taken and processed
     if (indexOfMissingMeasurements.isEmpty()) {
       return indexOfMissingMeasurements;
     }
 
-//     // [Step 5] Auto Create and process the missing schema
+    // [Step 5] Auto Create and process the missing schema
     if (config.isAutoCreateSchemaEnabled()
         || schemaComputationWithAutoCreation
             .getDevicePath()
@@ -179,16 +177,13 @@ class NormalSchemaFetcher {
         || schemaComputationWithAutoCreation
             .getDevicePath()
             .startsWith("root." + SystemConstant.AUDIT_PREFIX_KEY)) {
-            .startsWith("root." + SystemConstant.SYSTEM_PREFIX_KEY)) {
-//       // Check the isAligned value. If the input value is different from the actual value of the
-//       // existing device, throw exception.
-//       PartialPath devicePath = schemaComputationWithAutoCreation.getDevicePath();
-//       validateIsAlignedValueIfAutoCreate(
-//           schemaComputationWithAutoCreation.isAligned(), isAlignedPutIn, devicePath);
+      // Check the isAligned value. If the input value is different from the actual value of the
+      // existing device, throw exception.
+      PartialPath devicePath = schemaComputationWithAutoCreation.getDevicePath();
       ClusterSchemaTree schemaTree = new ClusterSchemaTree();
       autoCreateSchemaExecutor.autoCreateTimeSeries(
           schemaTree,
-//           devicePath,
+          devicePath,
           indexOfMissingMeasurements,
           schemaComputationWithAutoCreation.getMeasurements(),
           schemaComputationWithAutoCreation::getDataType,
@@ -204,84 +199,84 @@ class NormalSchemaFetcher {
   void processNormalTimeSeries(
       List<? extends ISchemaComputationWithAutoCreation> schemaComputationWithAutoCreationList,
       MPPQueryContext context) {
-//     // [Step 0] Record the input value.
+    // [Step 0] Record the input value.
     List<Boolean> isAlignedPutInList =
         schemaComputationWithAutoCreationList.stream()
             .map(ISchemaComputationWithAutoCreation::isAligned)
             .collect(Collectors.toList());
-// 
-//     // [Step 1] Cache 1. compute measurements and record logical views.
+
+    // [Step 1] Cache 1. compute measurements and record logical views.
     List<Integer> indexOfDevicesWithMissingMeasurements = new ArrayList<>();
     List<List<Integer>> indexOfMissingMeasurementsList =
         new ArrayList<>(schemaComputationWithAutoCreationList.size());
     List<Integer> indexOfMissingMeasurements;
     for (int i = 0, size = schemaComputationWithAutoCreationList.size(); i < size; i++) {
       indexOfMissingMeasurements =
-//           schemaCache.computeWithoutTemplate(schemaComputationWithAutoCreationList.get(i));
+          schemaCache.computeWithoutTemplate(schemaComputationWithAutoCreationList.get(i));
       if (!indexOfMissingMeasurements.isEmpty()) {
         indexOfDevicesWithMissingMeasurements.add(i);
         indexOfMissingMeasurementsList.add(indexOfMissingMeasurements);
       }
     }
-//     // [Step 2] Cache 2. process recorded logical views.
-//     boolean hasUnFetchedLogicalView = false;
-//     List<Pair<List<Integer>, List<String>>> missedIndexAndPathStringOfViewList =
-//         new ArrayList<>(schemaComputationWithAutoCreationList.size());
-//     for (ISchemaComputationWithAutoCreation iSchemaComputationWithAutoCreation :
-//         schemaComputationWithAutoCreationList) {
-//       Pair<List<Integer>, List<String>> missedIndexAndPathString =
-//           schemaCache.computeSourceOfLogicalView(iSchemaComputationWithAutoCreation);
-//       if (!missedIndexAndPathString.left.isEmpty()) {
-//         hasUnFetchedLogicalView = true;
-//       }
-//       missedIndexAndPathStringOfViewList.add(missedIndexAndPathString);
-//     }
+    // [Step 2] Cache 2. process recorded logical views.
+    boolean hasUnFetchedLogicalView = false;
+    List<Pair<List<Integer>, List<String>>> missedIndexAndPathStringOfViewList =
+        new ArrayList<>(schemaComputationWithAutoCreationList.size());
+    for (ISchemaComputationWithAutoCreation iSchemaComputationWithAutoCreation :
+        schemaComputationWithAutoCreationList) {
+      Pair<List<Integer>, List<String>> missedIndexAndPathString =
+          schemaCache.computeSourceOfLogicalView(iSchemaComputationWithAutoCreation);
+      if (!missedIndexAndPathString.left.isEmpty()) {
+        hasUnFetchedLogicalView = true;
+      }
+      missedIndexAndPathStringOfViewList.add(missedIndexAndPathString);
+    }
     // all schema can be taken from cache
-//     if (indexOfDevicesWithMissingMeasurements.isEmpty() && (!hasUnFetchedLogicalView)) {
+    if (indexOfDevicesWithMissingMeasurements.isEmpty() && (!hasUnFetchedLogicalView)) {
       return;
     }
-//     // [Step 3] Fetch 1.fetch schema from remote. Process logical view first; then process
-//     // measurements.
+    // [Step 3] Fetch 1.fetch schema from remote. Process logical view first; then process
+    // measurements.
     // try fetch the missing schema from remote
-//     ISchemaComputationWithAutoCreation schemaComputationWithAutoCreation;
-//     ClusterSchemaTree remoteSchemaTree;
-//     if (!hasUnFetchedLogicalView) {
-//       remoteSchemaTree =
-//           clusterSchemaFetchExecutor.fetchSchemaOfMultiDevices(
-//               schemaComputationWithAutoCreationList.stream()
-//                   .map(ISchemaComputationWithAutoCreation::getDevicePath)
-//                   .collect(Collectors.toList()),
-//               schemaComputationWithAutoCreationList.stream()
-//                   .map(ISchemaComputationWithAutoCreation::getMeasurements)
-//                   .collect(Collectors.toList()),
-//               indexOfDevicesWithMissingMeasurements,
+    ISchemaComputationWithAutoCreation schemaComputationWithAutoCreation;
+    ClusterSchemaTree remoteSchemaTree;
+    if (!hasUnFetchedLogicalView) {
+      remoteSchemaTree =
+          clusterSchemaFetchExecutor.fetchSchemaOfMultiDevices(
+              schemaComputationWithAutoCreationList.stream()
+                  .map(ISchemaComputationWithAutoCreation::getDevicePath)
+                  .collect(Collectors.toList()),
+              schemaComputationWithAutoCreationList.stream()
+                  .map(ISchemaComputationWithAutoCreation::getMeasurements)
+                  .collect(Collectors.toList()),
+              indexOfDevicesWithMissingMeasurements,
               indexOfMissingMeasurementsList,
               context);
-//     } else {
-//       PathPatternTree patternTree =
-//           computePatternTreeNeededReFetch(
-//               schemaComputationWithAutoCreationList.stream()
-//                   .map(ISchemaComputationWithAutoCreation::getDevicePath)
-//                   .collect(Collectors.toList()),
-//               schemaComputationWithAutoCreationList.stream()
-//                   .map(ISchemaComputationWithAutoCreation::getMeasurements)
-//                   .collect(Collectors.toList()),
-//               indexOfDevicesWithMissingMeasurements,
-//               indexOfMissingMeasurementsList);
-//       List<String> fullPathsNeedReFetch = new ArrayList<>();
-//       for (Pair<List<Integer>, List<String>> pair : missedIndexAndPathStringOfViewList) {
-//         fullPathsNeedReFetch.addAll(pair.right);
-//       }
-//       computePatternTreeNeededReFetch(patternTree, fullPathsNeedReFetch);
+    } else {
+      PathPatternTree patternTree =
+          computePatternTreeNeededReFetch(
+              schemaComputationWithAutoCreationList.stream()
+                  .map(ISchemaComputationWithAutoCreation::getDevicePath)
+                  .collect(Collectors.toList()),
+              schemaComputationWithAutoCreationList.stream()
+                  .map(ISchemaComputationWithAutoCreation::getMeasurements)
+                  .collect(Collectors.toList()),
+              indexOfDevicesWithMissingMeasurements,
+              indexOfMissingMeasurementsList);
+      List<String> fullPathsNeedReFetch = new ArrayList<>();
+      for (Pair<List<Integer>, List<String>> pair : missedIndexAndPathStringOfViewList) {
+        fullPathsNeedReFetch.addAll(pair.right);
+      }
+      computePatternTreeNeededReFetch(patternTree, fullPathsNeedReFetch);
       remoteSchemaTree =
           clusterSchemaFetchExecutor.fetchSchemaWithPatternTreeAndCache(patternTree, context);
-//     }
-//     // make sure all missed views are computed.
-//     for (int i = 0; i < schemaComputationWithAutoCreationList.size(); i++) {
-//       schemaComputationWithAutoCreation = schemaComputationWithAutoCreationList.get(i);
-//       remoteSchemaTree.computeSourceOfLogicalView(
-//           schemaComputationWithAutoCreation, missedIndexAndPathStringOfViewList.get(i).left);
-//     }
+    }
+    // make sure all missed views are computed.
+    for (int i = 0; i < schemaComputationWithAutoCreationList.size(); i++) {
+      schemaComputationWithAutoCreation = schemaComputationWithAutoCreationList.get(i);
+      remoteSchemaTree.computeSourceOfLogicalView(
+          schemaComputationWithAutoCreation, missedIndexAndPathStringOfViewList.get(i).left);
+    }
     // check and compute the fetched schema
     List<Integer> indexOfDevicesNeedAutoCreateSchema = new ArrayList<>();
     List<List<Integer>> indexOfMeasurementsNeedAutoCreate = new ArrayList<>();
@@ -291,38 +286,38 @@ class NormalSchemaFetcher {
       indexOfMissingMeasurements =
           remoteSchemaTree.compute(
               schemaComputationWithAutoCreation, indexOfMissingMeasurementsList.get(i));
-//       schemaComputationWithAutoCreation.recordRangeOfLogicalViewSchemaListNow();
+      schemaComputationWithAutoCreation.recordRangeOfLogicalViewSchemaListNow();
       if (!indexOfMissingMeasurements.isEmpty()) {
         indexOfDevicesNeedAutoCreateSchema.add(indexOfDevicesWithMissingMeasurements.get(i));
         indexOfMeasurementsNeedAutoCreate.add(indexOfMissingMeasurements);
       }
     }
 
-//     // [Step 4] Fetch 2. Some fetched measurements in [Step 3] are views. Process them.
-//     hasUnFetchedLogicalView = false;
-//     for (int i = 0, size = schemaComputationWithAutoCreationList.size(); i < size; i++) {
-//       Pair<List<Integer>, List<String>> missedIndexAndPathString =
-//           schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreationList.get(i));
+    // [Step 4] Fetch 2. Some fetched measurements in [Step 3] are views. Process them.
+    hasUnFetchedLogicalView = false;
+    for (int i = 0, size = schemaComputationWithAutoCreationList.size(); i < size; i++) {
+      Pair<List<Integer>, List<String>> missedIndexAndPathString =
+          schemaCache.computeSourceOfLogicalView(schemaComputationWithAutoCreationList.get(i));
       if (!missedIndexAndPathString.left.isEmpty()) {
-//         hasUnFetchedLogicalView = true;
-//       }
-//       missedIndexAndPathStringOfViewList.get(i).left = missedIndexAndPathString.left;
-//       missedIndexAndPathStringOfViewList.get(i).right = missedIndexAndPathString.right;
-//     }
-//     if (hasUnFetchedLogicalView) {
-//       List<String> fullPathsNeedRefetch = new ArrayList<>();
-//       for (Pair<List<Integer>, List<String>> pair : missedIndexAndPathStringOfViewList) {
-//         fullPathsNeedRefetch.addAll(pair.right);
-//       }
-//       ClusterSchemaTree viewSchemaTree =
+        hasUnFetchedLogicalView = true;
+      }
+      missedIndexAndPathStringOfViewList.get(i).left = missedIndexAndPathString.left;
+      missedIndexAndPathStringOfViewList.get(i).right = missedIndexAndPathString.right;
+    }
+    if (hasUnFetchedLogicalView) {
+      List<String> fullPathsNeedRefetch = new ArrayList<>();
+      for (Pair<List<Integer>, List<String>> pair : missedIndexAndPathStringOfViewList) {
+        fullPathsNeedRefetch.addAll(pair.right);
+      }
+      ClusterSchemaTree viewSchemaTree =
           clusterSchemaFetchExecutor.fetchSchemaWithFullPaths(fullPathsNeedRefetch, context);
-//       for (int i = 0, size = schemaComputationWithAutoCreationList.size(); i < size; i++) {
-//         schemaComputationWithAutoCreation = schemaComputationWithAutoCreationList.get(i);
-//         viewSchemaTree.computeSourceOfLogicalView(
-//             schemaComputationWithAutoCreation, missedIndexAndPathStringOfViewList.get(i).left);
-//       }
-//     }
-// 
+      for (int i = 0, size = schemaComputationWithAutoCreationList.size(); i < size; i++) {
+        schemaComputationWithAutoCreation = schemaComputationWithAutoCreationList.get(i);
+        viewSchemaTree.computeSourceOfLogicalView(
+            schemaComputationWithAutoCreation, missedIndexAndPathStringOfViewList.get(i).left);
+      }
+    }
+
     // all schema has been taken and processed
     if (indexOfDevicesNeedAutoCreateSchema.isEmpty()) {
       return;
@@ -346,24 +341,17 @@ class NormalSchemaFetcher {
                   .startsWith("root." + SystemConstant.AUDIT_PREFIX_KEY));
     }
 
-//     // [Step 5] Auto Create and process the missing schema
+    // [Step 5] Auto Create and process the missing schema
     if (!indexOfMeasurementsNeedAutoCreate.isEmpty()) {
-//       List<PartialPath> devicePathList =
-//           schemaComputationWithAutoCreationList.stream()
-//               .map(ISchemaComputationWithAutoCreation::getDevicePath)
-//               .collect(Collectors.toList());
-//       List<Boolean> isAlignedRealList =
-//           schemaComputationWithAutoCreationList.stream()
-//               .map(ISchemaComputationWithAutoCreation::isAligned)
-//               .collect(Collectors.toList());
-//       // Check the isAligned value. If the input value is different from the actual value of the
-//       // existing device, throw exception.
-//       validateIsAlignedValueIfAutoCreate(isAlignedRealList, isAlignedPutInList, devicePathList);
-//
+      List<PartialPath> devicePathList =
+          schemaComputationWithAutoCreationList.stream()
+              .map(ISchemaComputationWithAutoCreation::getDevicePath)
+              .collect(Collectors.toList());
+
       ClusterSchemaTree schemaTree = new ClusterSchemaTree();
       autoCreateSchemaExecutor.autoCreateTimeSeries(
           schemaTree,
-//           devicePathList,
+          devicePathList,
           indexOfDevicesNeedAutoCreateSchema,
           indexOfMeasurementsNeedAutoCreate,
           schemaComputationWithAutoCreationList.stream()
@@ -415,29 +403,4 @@ class NormalSchemaFetcher {
       }
     }
   }
-// 
-//   private void validateIsAlignedValueIfAutoCreate(
-//       List<Boolean> realValueList, List<Boolean> putInValueList, List<PartialPath> devicePathList) {
-//     int checkLen =
-//         Math.min(Math.min(realValueList.size(), putInValueList.size()), devicePathList.size());
-//     for (int i = 0; i < checkLen; i++) {
-//       validateIsAlignedValueIfAutoCreate(
-//           realValueList.get(i), putInValueList.get(i), devicePathList.get(i));
-//     }
-//   }
-// 
-//   private void validateIsAlignedValueIfAutoCreate(
-//       boolean realValue, boolean putInValue, PartialPath devicePath) {
-//     if (realValue != putInValue) {
-//       String msg;
-//       if (realValue) {
-//         msg =
-//             "Timeseries under this device is aligned, please use createTimeseries or change device.";
-//       } else {
-//         msg =
-//             "Timeseries under this device is not aligned, please use createTimeseries or change device.";
-//       }
-      throw new SemanticException(new AlignedTimeseriesException(msg, devicePath.getFullPath()));
-//     }
-//   }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
index 0c3c06e9993..8770ed2873c 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
@@ -2863,7 +2863,7 @@ public class ClusterConfigTaskExecutor implements IConfigTaskExecutor {
     final PartialPath oldName = renameLogicalViewStatement.getOldName();
     if (oldName.hasWildcard()) {
       future.setException(
-//           new MetadataException("Rename view doesn't support path pattern with wildcard."));
+          new MetadataException("Rename view doesn't support path pattern with wildcard."));
       return future;
     }
 
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/Expression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/Expression.java
index daf34d27185..9b89a122b06 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/Expression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/Expression.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.db.queryengine.plan.expression;
 
-// import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.queryengine.common.NodeRef;
 import org.apache.iotdb.db.queryengine.plan.expression.binary.AdditionExpression;
 import org.apache.iotdb.db.queryengine.plan.expression.binary.DivisionExpression;
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/BinaryExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/BinaryExpression.java
index 413ccd55268..39189759a60 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/BinaryExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/BinaryExpression.java
@@ -152,12 +152,12 @@ public abstract class BinaryExpression extends Expression {
     Expression.serialize(leftExpression, stream);
     Expression.serialize(rightExpression, stream);
   }
-// 
-//   @Override
+
+  @Override
   public String getOutputSymbolInternal() {
     String left = this.getLeftExpression().getOutputSymbol();
     String right = this.getRightExpression().getOutputSymbol();
-// 
+
     return buildExpression(left, right);
   }
 
@@ -169,20 +169,20 @@ public abstract class BinaryExpression extends Expression {
   }
 
   private String buildExpression(String left, String right) {
-//     StringBuilder builder = new StringBuilder();
-//     if (leftExpression.getExpressionType().getPriority() < this.getExpressionType().getPriority()) {
-//       builder.append("(").append(left).append(")");
-//     } else {
-//       builder.append(left);
-//     }
-//     builder.append(" ").append(operator()).append(" ");
-//     if (rightExpression.getExpressionType().getPriority()
-//         < this.getExpressionType().getPriority()) {
-//       builder.append("(").append(right).append(")");
-//     } else {
-//       builder.append(right);
-//     }
-// 
-//     return builder.toString();
-//   }
+    StringBuilder builder = new StringBuilder();
+    if (leftExpression.getExpressionType().getPriority() < this.getExpressionType().getPriority()) {
+      builder.append("(").append(left).append(")");
+    } else {
+      builder.append(left);
+    }
+    builder.append(" ").append(operator()).append(" ");
+    if (rightExpression.getExpressionType().getPriority()
+        < this.getExpressionType().getPriority()) {
+      builder.append("(").append(right).append(")");
+    } else {
+      builder.append(right);
+    }
+
+    return builder.toString();
+  }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/WhenThenExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/WhenThenExpression.java
index 55543224434..c12c09852af 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/WhenThenExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/binary/WhenThenExpression.java
@@ -69,13 +69,13 @@ public class WhenThenExpression extends BinaryExpression {
         + this.getThen().getExpressionString();
   }
 
-//   @Override
+  @Override
   public String getOutputSymbolInternal() {
     String when = this.getWhen().getOutputSymbol();
     String then = this.getThen().getOutputSymbol();
-//     return "WHEN " + when + " THEN " + then;
-//   }
-// 
+    return "WHEN " + when + " THEN " + then;
+  }
+
   @Override
   public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
     return visitor.visitWhenThenExpression(this, context);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/LeafOperand.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/LeafOperand.java
index 64e38399706..31d8aa4ff07 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/LeafOperand.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/LeafOperand.java
@@ -47,9 +47,9 @@ public abstract class LeafOperand extends Expression {
   public boolean isMappable(Map<NodeRef<Expression>, TSDataType> expressionTypes) {
     return true;
   }
-// 
-//   @Override
+
+  @Override
   public String getOutputSymbolInternal() {
-//     return this.getExpressionString();
-//   }
+    return this.getExpressionString();
+  }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java
index da491fc3655..957856f4093 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/multi/FunctionExpression.java
@@ -214,27 +214,27 @@ public class FunctionExpression extends Expression {
     return expressions;
   }
 
-//   @Override
+  @Override
   public String getOutputSymbolInternal() {
-//     StringBuilder builder = new StringBuilder();
-//     if (!expressions.isEmpty()) {
+    StringBuilder builder = new StringBuilder();
+    if (!expressions.isEmpty()) {
       builder.append(expressions.get(0).getOutputSymbol());
-//       for (int i = 1; i < expressions.size(); ++i) {
+      for (int i = 1; i < expressions.size(); ++i) {
         builder.append(", ").append(expressions.get(i).getOutputSymbol());
-//       }
-//     }
-//     if (!functionAttributes.isEmpty()) {
-//       // Some built-in scalar functions may have different header.
-//       if (BuiltinScalarFunction.contains(functionName)) {
-//         BuiltInScalarFunctionHelperFactory.createHelper(functionName)
-//             .appendFunctionAttributes(!expressions.isEmpty(), builder, functionAttributes);
-//       } else {
-//         appendAttributes(!expressions.isEmpty(), builder, functionAttributes);
-//       }
-//     }
-//     return functionName + "(" + builder + ")";
-//   }
-// 
+      }
+    }
+    if (!functionAttributes.isEmpty()) {
+      // Some built-in scalar functions may have different header.
+      if (BuiltinScalarFunction.contains(functionName)) {
+        BuiltInScalarFunctionHelperFactory.createHelper(functionName)
+            .appendFunctionAttributes(!expressions.isEmpty(), builder, functionAttributes);
+      } else {
+        appendAttributes(!expressions.isEmpty(), builder, functionAttributes);
+      }
+    }
+    return functionName + "(" + builder + ")";
+  }
+
   @Override
   public void constructUdfExecutors(
       Map<String, UDTFExecutor> expressionName2Executor, ZoneId zoneId) {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/other/CaseWhenThenExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/other/CaseWhenThenExpression.java
index 9290c241f33..c0a30bb6854 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/other/CaseWhenThenExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/other/CaseWhenThenExpression.java
@@ -170,20 +170,20 @@ public class CaseWhenThenExpression extends Expression {
     return result;
   }
 
-//   @Override
+  @Override
   public String getOutputSymbolInternal() {
-//     StringBuilder builder = new StringBuilder();
-//     builder.append("CASE ");
-//     for (Expression expression : this.whenThenExpressions) {
+    StringBuilder builder = new StringBuilder();
+    builder.append("CASE ");
+    for (Expression expression : this.whenThenExpressions) {
       builder.append(expression.getOutputSymbol()).append(" ");
-//     }
-//     if (!(this.elseExpression instanceof NullOperand)) {
+    }
+    if (!(this.elseExpression instanceof NullOperand)) {
       builder.append("ELSE ").append(this.elseExpression.getOutputSymbol()).append(" ");
-//     }
-//     builder.append("END");
-//     return builder.toString();
-//   }
-// 
+    }
+    builder.append("END");
+    return builder.toString();
+  }
+
   @Override
   public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
     return visitor.visitCaseWhenThenExpression(this, context);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/BetweenExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/BetweenExpression.java
index a4fa8817314..00b307df340 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/BetweenExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/BetweenExpression.java
@@ -95,15 +95,15 @@ public class BetweenExpression extends TernaryExpression {
     ReadWriteIOUtils.write(isNotBetween, stream);
   }
 
-//   @Override
+  @Override
   public String getOutputSymbolInternal() {
     return firstExpression.getOutputSymbol()
         + (isNotBetween ? " NOT BETWEEN " : " BETWEEN ")
         + secondExpression.getOutputSymbol()
-//         + " AND "
+        + " AND "
         + thirdExpression.getOutputSymbol();
-//   }
-// 
+  }
+
   @Override
   public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
     return visitor.visitBetweenExpression(this, context);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/TernaryExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/TernaryExpression.java
index 957be777065..3fb533a9f00 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/TernaryExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/ternary/TernaryExpression.java
@@ -39,32 +39,32 @@ import java.util.List;
 import java.util.Map;
 
 public abstract class TernaryExpression extends Expression {
-//   protected Expression firstExpression;
-//   protected Expression secondExpression;
-//   protected Expression thirdExpression;
+  protected Expression firstExpression;
+  protected Expression secondExpression;
+  protected Expression thirdExpression;
 
   public Expression getFirstExpression() {
     return firstExpression;
   }
 
-//   public void setFirstExpression(Expression expression) {
-//     this.firstExpression = expression;
-//   }
-// 
+  public void setFirstExpression(Expression expression) {
+    this.firstExpression = expression;
+  }
+
   public Expression getSecondExpression() {
     return secondExpression;
   }
 
-//   public void setSecondExpression(Expression expression) {
-//     this.secondExpression = expression;
-//   }
-// 
+  public void setSecondExpression(Expression expression) {
+    this.secondExpression = expression;
+  }
+
   public Expression getThirdExpression() {
     return thirdExpression;
-//   }
-// 
-//   public void setThirdExpression(Expression expression) {
-//     this.thirdExpression = expression;
+  }
+
+  public void setThirdExpression(Expression expression) {
+    this.thirdExpression = expression;
   }
 
   protected TernaryExpression(
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/InExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/InExpression.java
index 7425c28aaab..0ace411cd94 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/InExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/InExpression.java
@@ -32,7 +32,7 @@ import org.apache.tsfile.utils.RamUsageEstimator;
 import org.apache.tsfile.utils.ReadWriteIOUtils;
 
 import javax.validation.constraints.NotNull;
-// 
+
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
@@ -82,11 +82,11 @@ public class InExpression extends UnaryExpression {
           .append(')')
           .append(operator);
     }
-//     return appendValuesToBuild(stringBuilder).toString();
-//   }
-// 
-//   @NotNull
-//   private StringBuilder appendValuesToBuild(StringBuilder stringBuilder) {
+    return appendValuesToBuild(stringBuilder).toString();
+  }
+
+  @NotNull
+  private StringBuilder appendValuesToBuild(StringBuilder stringBuilder) {
     Iterator<String> iterator = values.iterator();
     if (iterator.hasNext()) {
       stringBuilder.append(iterator.next());
@@ -95,7 +95,7 @@ public class InExpression extends UnaryExpression {
       stringBuilder.append(',').append(iterator.next());
     }
     stringBuilder.append(')');
-//     return stringBuilder;
+    return stringBuilder;
   }
 
   @Override
@@ -123,20 +123,20 @@ public class InExpression extends UnaryExpression {
     }
   }
 
-//   @Override
+  @Override
   public String getOutputSymbolInternal() {
     String operator = isNotIn ? " NOT IN (" : " IN (";
-//     StringBuilder stringBuilder = new StringBuilder();
-//     if (expression instanceof FunctionExpression
-//         || expression instanceof ConstantOperand
-//         || expression instanceof TimeSeriesOperand) {
+    StringBuilder stringBuilder = new StringBuilder();
+    if (expression instanceof FunctionExpression
+        || expression instanceof ConstantOperand
+        || expression instanceof TimeSeriesOperand) {
       stringBuilder.append(expression.getOutputSymbol()).append(operator);
-//     } else {
+    } else {
       stringBuilder.append('(').append(expression.getOutputSymbol()).append(')').append(operator);
-//     }
-//     return appendValuesToBuild(stringBuilder).toString();
-//   }
-// 
+    }
+    return appendValuesToBuild(stringBuilder).toString();
+  }
+
   @Override
   public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
     return visitor.visitInExpression(this, context);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/IsNullExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/IsNullExpression.java
index 35254e0ccb5..9542b29e2da 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/IsNullExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/IsNullExpression.java
@@ -73,11 +73,11 @@ public class IsNullExpression extends UnaryExpression {
     ReadWriteIOUtils.write(isNot, stream);
   }
 
-//   @Override
+  @Override
   public String getOutputSymbolInternal() {
     return expression.getOutputSymbol() + " IS " + (isNot ? "NOT " : "") + "NULL";
-//   }
-// 
+  }
+
   @Override
   public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
     return visitor.visitIsNullExpression(this, context);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LikeExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LikeExpression.java
index e71263aeedc..f9cdf0427bf 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LikeExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LikeExpression.java
@@ -123,7 +123,7 @@ public class LikeExpression extends UnaryExpression {
     ReadWriteIOUtils.write(isNot, stream);
   }
 
-//   @Override
+  @Override
   public String getOutputSymbolInternal() {
     String res =
         expression.getOutputSymbol()
@@ -136,8 +136,8 @@ public class LikeExpression extends UnaryExpression {
       res = res + " escape = '" + escape.get() + "'";
     }
     return res;
-//   }
-// 
+  }
+
   @Override
   public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
     return visitor.visitLikeExpression(this, context);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LogicNotExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LogicNotExpression.java
index 833c529816e..9797376e545 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LogicNotExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/LogicNotExpression.java
@@ -52,15 +52,15 @@ public class LogicNotExpression extends UnaryExpression {
         : "!(" + expression.getExpressionString() + ")";
   }
 
-//   @Override
+  @Override
   public String getOutputSymbolInternal() {
-//     return expression instanceof FunctionExpression
-//             || expression instanceof ConstantOperand
-//             || expression instanceof TimeSeriesOperand
+    return expression instanceof FunctionExpression
+            || expression instanceof ConstantOperand
+            || expression instanceof TimeSeriesOperand
         ? "!" + expression.getOutputSymbol()
         : "!(" + expression.getOutputSymbol() + ")";
-//   }
-// 
+  }
+
   @Override
   public ExpressionType getExpressionType() {
     return ExpressionType.LOGIC_NOT;
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/NegationExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/NegationExpression.java
index bdedbae4ac3..d496a05c261 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/NegationExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/NegationExpression.java
@@ -56,17 +56,17 @@ public class NegationExpression extends UnaryExpression {
         : "-(" + expression.getExpressionString() + ")";
   }
 
-//   @Override
+  @Override
   public String getOutputSymbolInternal() {
-//     return expression instanceof TimeSeriesOperand
-//             || expression instanceof FunctionExpression
-//             || expression instanceof NullOperand
-//             || (expression instanceof ConstantOperand
-//                 && !((ConstantOperand) expression).isNegativeNumber())
+    return expression instanceof TimeSeriesOperand
+            || expression instanceof FunctionExpression
+            || expression instanceof NullOperand
+            || (expression instanceof ConstantOperand
+                && !((ConstantOperand) expression).isNegativeNumber())
         ? "-" + expression.getOutputSymbol()
         : "-(" + expression.getOutputSymbol() + ")";
-//   }
-// 
+  }
+
   @Override
   public ExpressionType getExpressionType() {
     return ExpressionType.NEGATION;
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/RegularExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/RegularExpression.java
index f1f2f14f923..06194ef5bc7 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/RegularExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/RegularExpression.java
@@ -105,11 +105,11 @@ public class RegularExpression extends UnaryExpression {
     ReadWriteIOUtils.write(isNot, stream);
   }
 
-//   @Override
+  @Override
   public String getOutputSymbolInternal() {
     return expression.getOutputSymbol() + (isNot ? " NOT" : "") + " REGEXP '" + patternString + "'";
-//   }
-// 
+  }
+
   @Override
   public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
     return visitor.visitRegularExpression(this, context);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/UnaryExpression.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/UnaryExpression.java
index 6c541b96ad5..8b0689299ff 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/UnaryExpression.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/UnaryExpression.java
@@ -38,7 +38,7 @@ import java.util.Map;
 
 public abstract class UnaryExpression extends Expression {
 
-//   protected Expression expression;
+  protected Expression expression;
 
   protected UnaryExpression(Expression expression) {
     this.expression = expression;
@@ -48,10 +48,10 @@ public abstract class UnaryExpression extends Expression {
     return expression;
   }
 
-//   public void setExpression(Expression expression) {
-//     this.expression = expression;
-//   }
-// 
+  public void setExpression(Expression expression) {
+    this.expression = expression;
+  }
+
   @Override
   public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
     return visitor.visitUnaryExpression(this, context);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java
index 46339fcc771..f8bb7b8dbe7 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/CompleteMeasurementSchemaVisitor.java
@@ -1,27 +1,27 @@
-// /*
-//  * 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.
-//  */
-// 
+/*
+ * 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.queryengine.plan.expression.visitor;
-// 
-// import org.apache.iotdb.commons.path.MeasurementPath;
-// import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.db.exception.metadata.view.BrokenViewException;
+
+import org.apache.iotdb.commons.path.MeasurementPath;
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.db.exception.metadata.view.BrokenViewException;
 import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.queryengine.common.schematree.ISchemaTree;
 import org.apache.iotdb.db.queryengine.plan.expression.Expression;
@@ -30,67 +30,67 @@ import org.apache.iotdb.db.queryengine.plan.expression.leaf.TimeSeriesOperand;
 import org.apache.iotdb.db.queryengine.plan.expression.multi.FunctionExpression;
 import org.apache.iotdb.db.queryengine.plan.expression.ternary.TernaryExpression;
 import org.apache.iotdb.db.queryengine.plan.expression.unary.UnaryExpression;
-// 
-// import java.util.ArrayList;
-// import java.util.List;
-// 
-// public class CompleteMeasurementSchemaVisitor extends ExpressionVisitor<Expression, ISchemaTree> {
-// 
-//   @Override
-//   public Expression process(Expression expression, ISchemaTree schemaTree) {
-//     return expression.accept(this, schemaTree);
-//   }
-// 
-//   @Override
-//   public Expression visitExpression(Expression expression, ISchemaTree schemaTree) {
-//     return expression;
-//   }
-// 
-//   @Override
-//   public Expression visitUnaryExpression(UnaryExpression unaryExpression, ISchemaTree schemaTree) {
-//     unaryExpression.setExpression(this.process(unaryExpression.getExpression(), schemaTree));
-//     return unaryExpression;
-//   }
-// 
-//   @Override
-//   public Expression visitBinaryExpression(
-//       BinaryExpression binaryExpression, ISchemaTree schemaTree) {
-//     binaryExpression.setLeftExpression(
-//         this.process(binaryExpression.getLeftExpression(), schemaTree));
-//     binaryExpression.setRightExpression(
-//         this.process(binaryExpression.getRightExpression(), schemaTree));
-//     return binaryExpression;
-//   }
-// 
-//   @Override
-//   public Expression visitTernaryExpression(
-//       TernaryExpression ternaryExpression, ISchemaTree schemaTree) {
-//     ternaryExpression.setFirstExpression(
-//         this.process(ternaryExpression.getFirstExpression(), schemaTree));
-//     ternaryExpression.setSecondExpression(
-//         this.process(ternaryExpression.getSecondExpression(), schemaTree));
-//     ternaryExpression.setThirdExpression(
-//         this.process(ternaryExpression.getThirdExpression(), schemaTree));
-//     return ternaryExpression;
-//   }
-// 
-//   @Override
-//   public Expression visitFunctionExpression(
-//       FunctionExpression functionExpression, ISchemaTree schemaTree) {
-//     List<Expression> children = functionExpression.getExpressions();
-//     List<Expression> replacedChildren = new ArrayList<>();
-//     for (Expression child : children) {
-//       replacedChildren.add(this.process(child, schemaTree));
-//     }
-//     functionExpression.setExpressions(replacedChildren);
-//     return functionExpression;
-//   }
-// 
-//   @Override
-//   public Expression visitTimeSeriesOperand(
-//       TimeSeriesOperand timeSeriesOperand, ISchemaTree schemaTree) {
-//     PartialPath path = timeSeriesOperand.getPath();
-//     try {
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CompleteMeasurementSchemaVisitor extends ExpressionVisitor<Expression, ISchemaTree> {
+
+  @Override
+  public Expression process(Expression expression, ISchemaTree schemaTree) {
+    return expression.accept(this, schemaTree);
+  }
+
+  @Override
+  public Expression visitExpression(Expression expression, ISchemaTree schemaTree) {
+    return expression;
+  }
+
+  @Override
+  public Expression visitUnaryExpression(UnaryExpression unaryExpression, ISchemaTree schemaTree) {
+    unaryExpression.setExpression(this.process(unaryExpression.getExpression(), schemaTree));
+    return unaryExpression;
+  }
+
+  @Override
+  public Expression visitBinaryExpression(
+      BinaryExpression binaryExpression, ISchemaTree schemaTree) {
+    binaryExpression.setLeftExpression(
+        this.process(binaryExpression.getLeftExpression(), schemaTree));
+    binaryExpression.setRightExpression(
+        this.process(binaryExpression.getRightExpression(), schemaTree));
+    return binaryExpression;
+  }
+
+  @Override
+  public Expression visitTernaryExpression(
+      TernaryExpression ternaryExpression, ISchemaTree schemaTree) {
+    ternaryExpression.setFirstExpression(
+        this.process(ternaryExpression.getFirstExpression(), schemaTree));
+    ternaryExpression.setSecondExpression(
+        this.process(ternaryExpression.getSecondExpression(), schemaTree));
+    ternaryExpression.setThirdExpression(
+        this.process(ternaryExpression.getThirdExpression(), schemaTree));
+    return ternaryExpression;
+  }
+
+  @Override
+  public Expression visitFunctionExpression(
+      FunctionExpression functionExpression, ISchemaTree schemaTree) {
+    List<Expression> children = functionExpression.getExpressions();
+    List<Expression> replacedChildren = new ArrayList<>();
+    for (Expression child : children) {
+      replacedChildren.add(this.process(child, schemaTree));
+    }
+    functionExpression.setExpressions(replacedChildren);
+    return functionExpression;
+  }
+
+  @Override
+  public Expression visitTimeSeriesOperand(
+      TimeSeriesOperand timeSeriesOperand, ISchemaTree schemaTree) {
+    PartialPath path = timeSeriesOperand.getPath();
+    try {
       path.getMeasurementSchema();
     } catch (Exception notAMeasurementPath) {
       List<MeasurementPath> actualPaths = schemaTree.searchMeasurementPaths(path).left;
@@ -100,9 +100,9 @@ import org.apache.iotdb.db.queryengine.plan.expression.unary.UnaryExpression;
         } else {
           throw new SemanticException(new BrokenViewException(path.getFullPath(), actualPaths));
         }
-//       }
+      }
       return new TimeSeriesOperand(actualPaths.get(0));
-//     }
-//     return timeSeriesOperand;
-//   }
-// }
+    }
+    return timeSeriesOperand;
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/ReplaceLogicalViewVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/ReplaceLogicalViewVisitor.java
index 44a82b70e1d..39fe3c637c9 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/ReplaceLogicalViewVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/ReplaceLogicalViewVisitor.java
@@ -1,28 +1,28 @@
-// /*
-//  * 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.
-//  */
-// 
+/*
+ * 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.queryengine.plan.expression.visitor;
-// 
+
 import org.apache.iotdb.commons.path.MeasurementPath;
-// import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.queryengine.plan.expression.Expression;
 import org.apache.iotdb.db.queryengine.plan.expression.binary.BinaryExpression;
 import org.apache.iotdb.db.queryengine.plan.expression.leaf.TimeSeriesOperand;
@@ -34,146 +34,146 @@ import org.apache.iotdb.db.schemaengine.schemaregion.view.visitor.TransformToExp
 
 import org.apache.tsfile.utils.Pair;
 import org.apache.tsfile.write.schema.IMeasurementSchema;
-// 
-// import java.util.ArrayList;
-// import java.util.List;
-// 
-// /**
-//  * step 1. check whether this expression contains logical view, that means check TimeSeriesOperand
-//  * which has the LogicalViewSchema.
-//  *
-//  * <p>step 2. replace that TimeSeriesOperand with expression recorded in LogicalViewSchema (view
-//  * expression).
-//  *
-//  * <p>step 3. record paths that appeared in view expression. They should be fetched later.
-//  */
-// public class ReplaceLogicalViewVisitor extends ExpressionVisitor<Expression, List<PartialPath>> {
-// 
-//   private TransformToExpressionVisitor transformToExpressionVisitor = null;
-// 
-//   private GetSourcePathsVisitor getSourcePathsVisitor = null;
-// 
-//   private boolean hasProcessedAggregationFunction = false;
-// 
-//   /** The paths that are new added, which should be re-fetched. */
-//   private List<PartialPath> newAddedPathList = null;
-// 
-//   public ReplaceLogicalViewVisitor() {
-//     this.transformToExpressionVisitor = new TransformToExpressionVisitor();
-//     this.getSourcePathsVisitor = new GetSourcePathsVisitor();
-//     this.resetHadProcessedAggregationFunction();
-//     this.newAddedPathList = new ArrayList<>();
-//   }
-// 
-//   /**
-//    * This function will check the expression you put in, find the TimeSeriesOperand which has
-//    * LogicalViewSchema. These TimeSeriesOperand will be replaced with logical view expression, and
-//    * this function will record paths that appeared in view expression. The logical view you replaced
-//    * have INCOMPLETE path information, and use PartialPath in TimeSeriesOperand. This may cause
-//    * ERROR, therefore you should call completeMeasurementPathCausedByView() later, make sure the
-//    * path info is complete and using MeasurementPath with full MeasurementSchema.
-//    *
-//    * @param expression the expression you want to check.
-//    * @return pair of replaced expression and whether replacement was happened. 'True' means the
-//    *     expression you put in contains logical view, and has been replaced. 'False' means there is
-//    *     no need to modify the expression you put in.
-//    */
-//   public Pair<Expression, Boolean> replaceViewInThisExpression(Expression expression) {
-//     // step 1. check whether this expression contains logical view, that means finding
-//     // TimeSeriesOperand which has
-//     // the LogicalViewSchema.
-//     // step 2. replace that TimeSeriesOperand with expression recorded in LogicalViewSchema (view
-//     // expression).
-//     // step 3. record paths that appeared in view expression. They should be fetched, then you can
-//     // use fetched schema
-//     // to complete new added TimeSeriesOperand.
-//     int oldSize = this.newAddedPathList.size();
-//     Expression result = this.process(expression, this.newAddedPathList);
-//     int newSize = this.newAddedPathList.size();
-//     if (oldSize != newSize) {
-//       return new Pair<>(result, true);
-//     }
-//     return new Pair<>(expression, false);
-//   }
-// 
-//   public List<PartialPath> getNewAddedPathList() {
-//     return this.newAddedPathList;
-//   }
-// 
-//   private Expression transform(ViewExpression viewExpression) {
-//     return this.transformToExpressionVisitor.process(viewExpression, null);
-//   }
-// 
-//   private List<PartialPath> collectSourcePaths(ViewExpression viewExpression) {
-//     return this.getSourcePathsVisitor.process(viewExpression, null);
-//   }
-// 
-//   public boolean getHadProcessedAggregationFunction() {
-//     return this.hasProcessedAggregationFunction;
-//   }
-// 
-//   public void resetHadProcessedAggregationFunction() {
-//     this.hasProcessedAggregationFunction = false;
-//   }
-// 
-//   @Override
-//   public Expression process(Expression expression, List<PartialPath> context) {
-//     return expression.accept(this, context);
-//   }
-// 
-//   @Override
-//   public Expression visitExpression(Expression expression, List<PartialPath> context) {
-//     return expression;
-//   }
-// 
-//   @Override
-//   public Expression visitUnaryExpression(
-//       UnaryExpression unaryExpression, List<PartialPath> context) {
-//     unaryExpression.setExpression(this.process(unaryExpression.getExpression(), context));
-//     return unaryExpression;
-//   }
-// 
-//   @Override
-//   public Expression visitBinaryExpression(
-//       BinaryExpression binaryExpression, List<PartialPath> context) {
-//     binaryExpression.setLeftExpression(this.process(binaryExpression.getLeftExpression(), context));
-//     binaryExpression.setRightExpression(
-//         this.process(binaryExpression.getRightExpression(), context));
-//     return binaryExpression;
-//   }
-// 
-//   @Override
-//   public Expression visitTernaryExpression(
-//       TernaryExpression ternaryExpression, List<PartialPath> context) {
-//     ternaryExpression.setFirstExpression(
-//         this.process(ternaryExpression.getFirstExpression(), context));
-//     ternaryExpression.setSecondExpression(
-//         this.process(ternaryExpression.getSecondExpression(), context));
-//     ternaryExpression.setThirdExpression(
-//         this.process(ternaryExpression.getThirdExpression(), context));
-//     return ternaryExpression;
-//   }
-// 
-//   @Override
-//   public Expression visitFunctionExpression(
-//       FunctionExpression functionExpression, List<PartialPath> context) {
-//     List<Expression> children = functionExpression.getExpressions();
-//     List<Expression> replacedChildren = new ArrayList<>();
-//     for (Expression child : children) {
-//       replacedChildren.add(this.process(child, context));
-//     }
-//     functionExpression.setExpressions(replacedChildren);
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * step 1. check whether this expression contains logical view, that means check TimeSeriesOperand
+ * which has the LogicalViewSchema.
+ *
+ * <p>step 2. replace that TimeSeriesOperand with expression recorded in LogicalViewSchema (view
+ * expression).
+ *
+ * <p>step 3. record paths that appeared in view expression. They should be fetched later.
+ */
+public class ReplaceLogicalViewVisitor extends ExpressionVisitor<Expression, List<PartialPath>> {
+
+  private TransformToExpressionVisitor transformToExpressionVisitor = null;
+
+  private GetSourcePathsVisitor getSourcePathsVisitor = null;
+
+  private boolean hasProcessedAggregationFunction = false;
+
+  /** The paths that are new added, which should be re-fetched. */
+  private List<PartialPath> newAddedPathList = null;
+
+  public ReplaceLogicalViewVisitor() {
+    this.transformToExpressionVisitor = new TransformToExpressionVisitor();
+    this.getSourcePathsVisitor = new GetSourcePathsVisitor();
+    this.resetHadProcessedAggregationFunction();
+    this.newAddedPathList = new ArrayList<>();
+  }
+
+  /**
+   * This function will check the expression you put in, find the TimeSeriesOperand which has
+   * LogicalViewSchema. These TimeSeriesOperand will be replaced with logical view expression, and
+   * this function will record paths that appeared in view expression. The logical view you replaced
+   * have INCOMPLETE path information, and use PartialPath in TimeSeriesOperand. This may cause
+   * ERROR, therefore you should call completeMeasurementPathCausedByView() later, make sure the
+   * path info is complete and using MeasurementPath with full MeasurementSchema.
+   *
+   * @param expression the expression you want to check.
+   * @return pair of replaced expression and whether replacement was happened. 'True' means the
+   *     expression you put in contains logical view, and has been replaced. 'False' means there is
+   *     no need to modify the expression you put in.
+   */
+  public Pair<Expression, Boolean> replaceViewInThisExpression(Expression expression) {
+    // step 1. check whether this expression contains logical view, that means finding
+    // TimeSeriesOperand which has
+    // the LogicalViewSchema.
+    // step 2. replace that TimeSeriesOperand with expression recorded in LogicalViewSchema (view
+    // expression).
+    // step 3. record paths that appeared in view expression. They should be fetched, then you can
+    // use fetched schema
+    // to complete new added TimeSeriesOperand.
+    int oldSize = this.newAddedPathList.size();
+    Expression result = this.process(expression, this.newAddedPathList);
+    int newSize = this.newAddedPathList.size();
+    if (oldSize != newSize) {
+      return new Pair<>(result, true);
+    }
+    return new Pair<>(expression, false);
+  }
+
+  public List<PartialPath> getNewAddedPathList() {
+    return this.newAddedPathList;
+  }
+
+  private Expression transform(ViewExpression viewExpression) {
+    return this.transformToExpressionVisitor.process(viewExpression, null);
+  }
+
+  private List<PartialPath> collectSourcePaths(ViewExpression viewExpression) {
+    return this.getSourcePathsVisitor.process(viewExpression, null);
+  }
+
+  public boolean getHadProcessedAggregationFunction() {
+    return this.hasProcessedAggregationFunction;
+  }
+
+  public void resetHadProcessedAggregationFunction() {
+    this.hasProcessedAggregationFunction = false;
+  }
+
+  @Override
+  public Expression process(Expression expression, List<PartialPath> context) {
+    return expression.accept(this, context);
+  }
+
+  @Override
+  public Expression visitExpression(Expression expression, List<PartialPath> context) {
+    return expression;
+  }
+
+  @Override
+  public Expression visitUnaryExpression(
+      UnaryExpression unaryExpression, List<PartialPath> context) {
+    unaryExpression.setExpression(this.process(unaryExpression.getExpression(), context));
+    return unaryExpression;
+  }
+
+  @Override
+  public Expression visitBinaryExpression(
+      BinaryExpression binaryExpression, List<PartialPath> context) {
+    binaryExpression.setLeftExpression(this.process(binaryExpression.getLeftExpression(), context));
+    binaryExpression.setRightExpression(
+        this.process(binaryExpression.getRightExpression(), context));
+    return binaryExpression;
+  }
+
+  @Override
+  public Expression visitTernaryExpression(
+      TernaryExpression ternaryExpression, List<PartialPath> context) {
+    ternaryExpression.setFirstExpression(
+        this.process(ternaryExpression.getFirstExpression(), context));
+    ternaryExpression.setSecondExpression(
+        this.process(ternaryExpression.getSecondExpression(), context));
+    ternaryExpression.setThirdExpression(
+        this.process(ternaryExpression.getThirdExpression(), context));
+    return ternaryExpression;
+  }
+
+  @Override
+  public Expression visitFunctionExpression(
+      FunctionExpression functionExpression, List<PartialPath> context) {
+    List<Expression> children = functionExpression.getExpressions();
+    List<Expression> replacedChildren = new ArrayList<>();
+    for (Expression child : children) {
+      replacedChildren.add(this.process(child, context));
+    }
+    functionExpression.setExpressions(replacedChildren);
     if (functionExpression.isAggregationFunctionExpression()) {
-//       this.hasProcessedAggregationFunction = true;
-//     }
-//     return functionExpression;
-//   }
-// 
-//   @Override
-//   public Expression visitTimeSeriesOperand(
-//       TimeSeriesOperand timeSeriesOperand, List<PartialPath> context) {
-//     PartialPath path = timeSeriesOperand.getPath();
-//     try {
+      this.hasProcessedAggregationFunction = true;
+    }
+    return functionExpression;
+  }
+
+  @Override
+  public Expression visitTimeSeriesOperand(
+      TimeSeriesOperand timeSeriesOperand, List<PartialPath> context) {
+    PartialPath path = timeSeriesOperand.getPath();
+    try {
       if (path instanceof MeasurementPath) {
         IMeasurementSchema measurementSchema = path.getMeasurementSchema();
         if (measurementSchema.isLogicalView()) {
@@ -183,10 +183,10 @@ import org.apache.tsfile.write.schema.IMeasurementSchema;
           context.addAll(this.collectSourcePaths(viewExpression));
           return result;
         }
-//       }
-//     } catch (Exception e) {
-//       throw new RuntimeException(e);
-//     }
-//     return timeSeriesOperand;
-//   }
-// }
+      }
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+    return timeSeriesOperand;
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/TransformToViewExpressionVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/TransformToViewExpressionVisitor.java
index 0b381c5e02c..27befb28c90 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/TransformToViewExpressionVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/visitor/TransformToViewExpressionVisitor.java
@@ -1,50 +1,50 @@
-// /*
-//  * 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.
-//  */
-// 
+/*
+ * 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.queryengine.plan.expression.visitor;
-// 
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand;
-// import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression;
+
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand;
+import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression;
 import org.apache.iotdb.db.queryengine.plan.expression.Expression;
 import org.apache.iotdb.db.queryengine.plan.expression.binary.AdditionExpression;
 import org.apache.iotdb.db.queryengine.plan.expression.binary.BinaryExpression;
@@ -74,252 +74,252 @@ import org.apache.iotdb.db.queryengine.plan.expression.unary.NegationExpression;
 import org.apache.iotdb.db.queryengine.plan.expression.unary.RegularExpression;
 
 import org.apache.tsfile.utils.Pair;
-// 
-// import java.util.ArrayList;
-// import java.util.LinkedHashMap;
-// import java.util.List;
-// import java.util.Map;
-// 
-// public class TransformToViewExpressionVisitor extends ExpressionVisitor<ViewExpression, Void> {
-// 
-//   @Override
-//   public ViewExpression process(Expression expression, Void context) {
-//     return expression.accept(this, context);
-//   }
-// 
-//   @Override
-//   public ViewExpression visitExpression(Expression expression, Void context) {
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class TransformToViewExpressionVisitor extends ExpressionVisitor<ViewExpression, Void> {
+
+  @Override
+  public ViewExpression process(Expression expression, Void context) {
+    return expression.accept(this, context);
+  }
+
+  @Override
+  public ViewExpression visitExpression(Expression expression, Void context) {
     throw new UnsupportedOperationException(
         "Unsupported expression type in TransformToViewExpressionVisitor: "
             + expression.getExpressionType());
-//   }
-// 
-//   // region leaf operand
-// 
-//   @Override
-//   public ViewExpression visitConstantOperand(ConstantOperand constantOperand, Void context) {
-//     return new ConstantViewOperand(constantOperand.getDataType(), constantOperand.getValueString());
-//   }
-// 
-//   @Override
-//   public ViewExpression visitNullOperand(NullOperand nullOperand, Void context) {
-//     return new NullViewOperand();
-//   }
-// 
-//   @Override
-//   public ViewExpression visitTimeSeriesOperand(TimeSeriesOperand timeSeriesOperand, Void context) {
-//     return new TimeSeriesViewOperand(timeSeriesOperand.getPath().toString());
-//   }
-// 
-//   @Override
-//   public ViewExpression visitTimeStampOperand(TimestampOperand timestampOperand, Void context) {
-//     return new TimestampViewOperand();
-//   }
-
-//   // endregion
-// 
-//   // region Unary Expressions
-// 
-//   @Override
-//   public ViewExpression visitInExpression(InExpression inExpression, Void context) {
-//     ViewExpression child = this.process(inExpression.getExpression(), context);
-//     List<String> valueList = new ArrayList<>(inExpression.getValues());
-//     return new InViewExpression(child, inExpression.isNotIn(), valueList);
-//   }
-// 
-//   @Override
-//   public ViewExpression visitIsNullExpression(IsNullExpression isNullExpression, Void context) {
-//     ViewExpression child = this.process(isNullExpression.getExpression(), context);
-//     return new IsNullViewExpression(child, isNullExpression.isNot());
-//   }
-// 
-//   @Override
-//   public ViewExpression visitLikeExpression(LikeExpression likeExpression, Void context) {
-//     ViewExpression child = this.process(likeExpression.getExpression(), context);
-//     return new LikeViewExpression(
+  }
+
+  // region leaf operand
+
+  @Override
+  public ViewExpression visitConstantOperand(ConstantOperand constantOperand, Void context) {
+    return new ConstantViewOperand(constantOperand.getDataType(), constantOperand.getValueString());
+  }
+
+  @Override
+  public ViewExpression visitNullOperand(NullOperand nullOperand, Void context) {
+    return new NullViewOperand();
+  }
+
+  @Override
+  public ViewExpression visitTimeSeriesOperand(TimeSeriesOperand timeSeriesOperand, Void context) {
+    return new TimeSeriesViewOperand(timeSeriesOperand.getPath().toString());
+  }
+
+  @Override
+  public ViewExpression visitTimeStampOperand(TimestampOperand timestampOperand, Void context) {
+    return new TimestampViewOperand();
+  }
+
+  // endregion
+
+  // region Unary Expressions
+
+  @Override
+  public ViewExpression visitInExpression(InExpression inExpression, Void context) {
+    ViewExpression child = this.process(inExpression.getExpression(), context);
+    List<String> valueList = new ArrayList<>(inExpression.getValues());
+    return new InViewExpression(child, inExpression.isNotIn(), valueList);
+  }
+
+  @Override
+  public ViewExpression visitIsNullExpression(IsNullExpression isNullExpression, Void context) {
+    ViewExpression child = this.process(isNullExpression.getExpression(), context);
+    return new IsNullViewExpression(child, isNullExpression.isNot());
+  }
+
+  @Override
+  public ViewExpression visitLikeExpression(LikeExpression likeExpression, Void context) {
+    ViewExpression child = this.process(likeExpression.getExpression(), context);
+    return new LikeViewExpression(
         child, likeExpression.getPattern(), likeExpression.getEscape(), likeExpression.isNot());
-//   }
-// 
-//   @Override
-//   public ViewExpression visitLogicNotExpression(
-//       LogicNotExpression logicNotExpression, Void context) {
-//     ViewExpression child = this.process(logicNotExpression.getExpression(), context);
-//     return new LogicNotViewExpression(child);
-//   }
-// 
-//   @Override
-//   public ViewExpression visitNegationExpression(
-//       NegationExpression negationExpression, Void context) {
-//     ViewExpression child = this.process(negationExpression.getExpression(), context);
-//     return new NegationViewExpression(child);
-//   }
-// 
-//   @Override
-//   public ViewExpression visitRegularExpression(RegularExpression regularExpression, Void context) {
-//     ViewExpression child = this.process(regularExpression.getExpression(), context);
-//     return new RegularViewExpression(
+  }
+
+  @Override
+  public ViewExpression visitLogicNotExpression(
+      LogicNotExpression logicNotExpression, Void context) {
+    ViewExpression child = this.process(logicNotExpression.getExpression(), context);
+    return new LogicNotViewExpression(child);
+  }
+
+  @Override
+  public ViewExpression visitNegationExpression(
+      NegationExpression negationExpression, Void context) {
+    ViewExpression child = this.process(negationExpression.getExpression(), context);
+    return new NegationViewExpression(child);
+  }
+
+  @Override
+  public ViewExpression visitRegularExpression(RegularExpression regularExpression, Void context) {
+    ViewExpression child = this.process(regularExpression.getExpression(), context);
+    return new RegularViewExpression(
         child,
         regularExpression.getPatternString(),
         regularExpression.getPattern(),
         regularExpression.isNot());
-//   }
-
-//   // endregion
-// 
-//   // region Binary Expressions
-// 
-//   private Pair<ViewExpression, ViewExpression> getExpressionsForBinaryExpression(
-//       BinaryExpression binaryExpression) {
-//     ViewExpression left = this.process(binaryExpression.getLeftExpression(), null);
-//     ViewExpression right = this.process(binaryExpression.getRightExpression(), null);
-//     return new Pair<>(left, right);
-//   }
-// 
-//   // region Binary : Arithmetic Binary Expression
-//   @Override
-//   public ViewExpression visitAdditionExpression(
-//       AdditionExpression additionExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(additionExpression);
-//     return new AdditionViewExpression(pair.left, pair.right);
-//   }
-// 
+  }
+
+  // endregion
+
+  // region Binary Expressions
+
+  private Pair<ViewExpression, ViewExpression> getExpressionsForBinaryExpression(
+      BinaryExpression binaryExpression) {
+    ViewExpression left = this.process(binaryExpression.getLeftExpression(), null);
+    ViewExpression right = this.process(binaryExpression.getRightExpression(), null);
+    return new Pair<>(left, right);
+  }
+
+  // region Binary : Arithmetic Binary Expression
   @Override
-//   public ViewExpression visitDivisionExpression(
-//       DivisionExpression divisionExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(divisionExpression);
-//     return new DivisionViewExpression(pair.left, pair.right);
-//   }
-// 
+  public ViewExpression visitAdditionExpression(
+      AdditionExpression additionExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(additionExpression);
+    return new AdditionViewExpression(pair.left, pair.right);
+  }
+
+  @Override
+  public ViewExpression visitDivisionExpression(
+      DivisionExpression divisionExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(divisionExpression);
+    return new DivisionViewExpression(pair.left, pair.right);
+  }
+
   @Override
-//   public ViewExpression visitModuloExpression(ModuloExpression moduloExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(moduloExpression);
-//     return new ModuloViewExpression(pair.left, pair.right);
-//   }
-// 
+  public ViewExpression visitModuloExpression(ModuloExpression moduloExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(moduloExpression);
+    return new ModuloViewExpression(pair.left, pair.right);
+  }
+
   @Override
-//   public ViewExpression visitMultiplicationExpression(
-//       MultiplicationExpression multiplicationExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(multiplicationExpression);
-//     return new MultiplicationViewExpression(pair.left, pair.right);
-//   }
-// 
+  public ViewExpression visitMultiplicationExpression(
+      MultiplicationExpression multiplicationExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(multiplicationExpression);
+    return new MultiplicationViewExpression(pair.left, pair.right);
+  }
+
+  @Override
+  public ViewExpression visitSubtractionExpression(
+      SubtractionExpression subtractionExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(subtractionExpression);
+    return new SubtractionViewExpression(pair.left, pair.right);
+  }
+
+  // endregion
+
+  // region Binary: Compare Binary Expression
+
+  @Override
+  public ViewExpression visitEqualToExpression(EqualToExpression equalToExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(equalToExpression);
+    return new EqualToViewExpression(pair.left, pair.right);
+  }
+
   @Override
-//   public ViewExpression visitSubtractionExpression(
-//       SubtractionExpression subtractionExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(subtractionExpression);
-//     return new SubtractionViewExpression(pair.left, pair.right);
-//   }
-
-//   // endregion
-// 
-//   // region Binary: Compare Binary Expression
-// 
+  public ViewExpression visitGreaterEqualExpression(
+      GreaterEqualExpression greaterEqualExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(greaterEqualExpression);
+    return new GreaterEqualViewExpression(pair.left, pair.right);
+  }
+
   @Override
-//   public ViewExpression visitEqualToExpression(EqualToExpression equalToExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(equalToExpression);
-//     return new EqualToViewExpression(pair.left, pair.right);
-//   }
-// 
+  public ViewExpression visitGreaterThanExpression(
+      GreaterThanExpression greaterThanExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(greaterThanExpression);
+    return new GreaterThanViewExpression(pair.left, pair.right);
+  }
+
   @Override
-//   public ViewExpression visitGreaterEqualExpression(
-//       GreaterEqualExpression greaterEqualExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(greaterEqualExpression);
-//     return new GreaterEqualViewExpression(pair.left, pair.right);
-//   }
-// 
+  public ViewExpression visitLessEqualExpression(
+      LessEqualExpression lessEqualExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(lessEqualExpression);
+    return new LessEqualViewExpression(pair.left, pair.right);
+  }
+
   @Override
-//   public ViewExpression visitGreaterThanExpression(
-//       GreaterThanExpression greaterThanExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(greaterThanExpression);
-//     return new GreaterThanViewExpression(pair.left, pair.right);
-//   }
-// 
+  public ViewExpression visitLessThanExpression(
+      LessThanExpression lessThanExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(lessThanExpression);
+    return new LessThanViewExpression(pair.left, pair.right);
+  }
+
   @Override
-//   public ViewExpression visitLessEqualExpression(
-//       LessEqualExpression lessEqualExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(lessEqualExpression);
-//     return new LessEqualViewExpression(pair.left, pair.right);
-//   }
-// 
+  public ViewExpression visitNonEqualExpression(
+      NonEqualExpression nonEqualExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(nonEqualExpression);
+    return new NonEqualViewExpression(pair.left, pair.right);
+  }
+
+  // endregion
+
+  // region Binary : Logic Binary Expression
+
   @Override
-//   public ViewExpression visitLessThanExpression(
-//       LessThanExpression lessThanExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(lessThanExpression);
-//     return new LessThanViewExpression(pair.left, pair.right);
-//   }
-// 
+  public ViewExpression visitLogicAndExpression(
+      LogicAndExpression logicAndExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(logicAndExpression);
+    return new LogicAndViewExpression(pair.left, pair.right);
+  }
+
   @Override
-//   public ViewExpression visitNonEqualExpression(
-//       NonEqualExpression nonEqualExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(nonEqualExpression);
-//     return new NonEqualViewExpression(pair.left, pair.right);
-//   }
-
-//   // endregion
-// 
-//   // region Binary : Logic Binary Expression
-// 
+  public ViewExpression visitLogicOrExpression(LogicOrExpression logicOrExpression, Void context) {
+    Pair<ViewExpression, ViewExpression> pair =
+        this.getExpressionsForBinaryExpression(logicOrExpression);
+    return new LogicOrViewExpression(pair.left, pair.right);
+  }
+
+  // endregion
+
+  // endregion
+
+  // region Ternary Expressions
+
   @Override
-//   public ViewExpression visitLogicAndExpression(
-//       LogicAndExpression logicAndExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(logicAndExpression);
-//     return new LogicAndViewExpression(pair.left, pair.right);
-//   }
-// 
+  public ViewExpression visitBetweenExpression(BetweenExpression betweenExpression, Void context) {
+    ViewExpression first = this.process(betweenExpression.getFirstExpression(), null);
+    ViewExpression second = this.process(betweenExpression.getSecondExpression(), null);
+    ViewExpression third = this.process(betweenExpression.getSecondExpression(), null);
+    return new BetweenViewExpression(first, second, third, betweenExpression.isNotBetween());
+  }
+
+  // endregion
+
+  // region FunctionExpression
   @Override
-//   public ViewExpression visitLogicOrExpression(LogicOrExpression logicOrExpression, Void context) {
-//     Pair<ViewExpression, ViewExpression> pair =
-//         this.getExpressionsForBinaryExpression(logicOrExpression);
-//     return new LogicOrViewExpression(pair.left, pair.right);
-//   }
-
-//   // endregion
-// 
-//   // endregion
-// 
-//   // region Ternary Expressions
-// 
-//   @Override
-//   public ViewExpression visitBetweenExpression(BetweenExpression betweenExpression, Void context) {
-//     ViewExpression first = this.process(betweenExpression.getFirstExpression(), null);
-//     ViewExpression second = this.process(betweenExpression.getSecondExpression(), null);
-//     ViewExpression third = this.process(betweenExpression.getSecondExpression(), null);
-//     return new BetweenViewExpression(first, second, third, betweenExpression.isNotBetween());
-//   }
-
-//   // endregion
-// 
-//   // region FunctionExpression
-//   @Override
-//   public ViewExpression visitFunctionExpression(
-//       FunctionExpression functionExpression, Void context) {
-//     List<Expression> expressionList = functionExpression.getExpressions();
-//     List<ViewExpression> viewExpressionList = new ArrayList<>();
-//     for (Expression expression : expressionList) {
-//       viewExpressionList.add(this.process(expression, null));
-//     }
-//     LinkedHashMap<String, String> map = functionExpression.getFunctionAttributes();
-//     List<String> keyList = new ArrayList<>();
-//     List<String> valueList = new ArrayList<>();
-//     for (Map.Entry<String, String> entry : map.entrySet()) {
-//       keyList.add(entry.getKey());
-//       valueList.add(entry.getValue());
-//     }
-//     return new FunctionViewExpression(
-//         functionExpression.getFunctionName(), keyList, valueList, viewExpressionList);
-//   }
-//   // endregion
-// 
-// }
+  public ViewExpression visitFunctionExpression(
+      FunctionExpression functionExpression, Void context) {
+    List<Expression> expressionList = functionExpression.getExpressions();
+    List<ViewExpression> viewExpressionList = new ArrayList<>();
+    for (Expression expression : expressionList) {
+      viewExpressionList.add(this.process(expression, null));
+    }
+    LinkedHashMap<String, String> map = functionExpression.getFunctionAttributes();
+    List<String> keyList = new ArrayList<>();
+    List<String> valueList = new ArrayList<>();
+    for (Map.Entry<String, String> entry : map.entrySet()) {
+      keyList.add(entry.getKey());
+      valueList.add(entry.getValue());
+    }
+    return new FunctionViewExpression(
+        functionExpression.getFunctionName(), keyList, valueList, viewExpressionList);
+  }
+  // endregion
+
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java
index 800e23804ae..fa39b3ba7dc 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanVisitor.java
@@ -20,7 +20,7 @@ package org.apache.iotdb.db.queryengine.plan.planner;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.schema.column.ColumnHeaderConstant;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
 import org.apache.iotdb.db.queryengine.plan.analyze.Analysis;
 import org.apache.iotdb.db.queryengine.plan.expression.Expression;
@@ -954,11 +954,11 @@ public class LogicalPlanVisitor extends StatementVisitor<PlanNode, MPPQueryConte
             .planLimit(showQueriesStatement.getRowLimit());
     return planBuilder.getRoot();
   }
-// 
-//   @Override
-//   public PlanNode visitCreateLogicalView(
-//       CreateLogicalViewStatement createLogicalViewStatement, MPPQueryContext context) {
-//     List<ViewExpression> viewExpressionList = new ArrayList<>();
+
+  @Override
+  public PlanNode visitCreateLogicalView(
+      CreateLogicalViewStatement createLogicalViewStatement, MPPQueryContext context) {
+    List<ViewExpression> viewExpressionList = new ArrayList<>();
     if (createLogicalViewStatement.getViewExpressions() == null) {
       // Transform all Expressions into ViewExpressions.
       TransformToViewExpressionVisitor transformToViewExpressionVisitor =
@@ -969,13 +969,13 @@ public class LogicalPlanVisitor extends StatementVisitor<PlanNode, MPPQueryConte
       }
     } else {
       viewExpressionList = createLogicalViewStatement.getViewExpressions();
-//     }
+    }
 
-//     return new CreateLogicalViewNode(
-//         context.getQueryId().genPlanNodeId(),
-//         createLogicalViewStatement.getTargetPathList(),
-//         viewExpressionList);
-//   }
+    return new CreateLogicalViewNode(
+        context.getQueryId().genPlanNodeId(),
+        createLogicalViewStatement.getTargetPathList(),
+        viewExpressionList);
+  }
 
   @Override
   public PlanNode visitShowLogicalView(
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanNodeType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanNodeType.java
index 4b0ed3bffdf..a834f7e076d 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanNodeType.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanNodeType.java
@@ -226,7 +226,7 @@ public enum PlanNodeType {
   INTERNAL_CREATE_MULTI_TIMESERIES((short) 69),
   IDENTITY_SINK((short) 70),
   SHUFFLE_SINK((short) 71),
-//   BATCH_ACTIVATE_TEMPLATE((short) 72),
+  BATCH_ACTIVATE_TEMPLATE((short) 72),
   CREATE_LOGICAL_VIEW((short) 73),
   CONSTRUCT_LOGICAL_VIEW_BLACK_LIST((short) 74),
   ROLLBACK_LOGICAL_VIEW_BLACK_LIST((short) 75),
@@ -534,8 +534,8 @@ public enum PlanNodeType {
         return ShuffleSinkNode.deserialize(buffer);
       case 72:
         return BatchActivateTemplateNode.deserialize(buffer);
-//       case 73:
-//         return CreateLogicalViewNode.deserialize(buffer);
+      case 73:
+        return CreateLogicalViewNode.deserialize(buffer);
       case 74:
         return ConstructLogicalViewBlackListNode.deserialize(buffer);
       case 75:
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/write/view/CreateLogicalViewNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/write/view/CreateLogicalViewNode.java
index 71934096e8c..ffdd63b29a4 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/write/view/CreateLogicalViewNode.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/write/view/CreateLogicalViewNode.java
@@ -1,29 +1,29 @@
-// /*
-//  * 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.
-//  */
-// 
+/*
+ * 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.queryengine.plan.planner.plan.node.metadata.write.view;
-// 
-// import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
+
+import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
 import org.apache.iotdb.commons.path.MeasurementPath;
-// import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.path.PathDeserializeUtil;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.path.PathDeserializeUtil;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.queryengine.plan.analyze.IAnalysis;
 import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
@@ -36,217 +36,217 @@ import org.apache.iotdb.db.schemaengine.schemaregion.write.req.view.ICreateLogic
 
 import org.apache.tsfile.exception.NotImplementedException;
 import org.apache.tsfile.utils.ReadWriteIOUtils;
-// 
-// import java.io.DataOutputStream;
-// import java.io.IOException;
-// import java.nio.ByteBuffer;
-// import java.util.ArrayList;
-// import java.util.HashMap;
-// import java.util.List;
-// import java.util.Map;
-// import java.util.Objects;
-// 
-// public class CreateLogicalViewNode extends WritePlanNode implements ICreateLogicalViewPlan {
-// 
-//   /**
-//    * A map from target path to source expression. Yht target path is the name of this logical view,
-//    * and the source expression is the data source of this view.
-//    */
-//   private Map<PartialPath, ViewExpression> viewPathToSourceMap;
-// 
-//   /**
-//    * This variable will be set in function splitByPartition() according to analysis. And it will be
-//    * set when creating new split nodes.
-//    */
-//   private TRegionReplicaSet regionReplicaSet = null;
-// 
-//   public CreateLogicalViewNode(
-//       PlanNodeId id, List<PartialPath> paths, List<ViewExpression> expressions) {
-//     super(id);
-//     this.viewPathToSourceMap = convertTargetAndSourceListsToMap(paths, expressions);
-//   }
-// 
-//   public CreateLogicalViewNode(
-//       PlanNodeId id, Map<PartialPath, ViewExpression> viewPathToSourceMap) {
-//     super(id);
-//     this.viewPathToSourceMap = viewPathToSourceMap;
-//   }
-// 
-//   public CreateLogicalViewNode(
-//       PlanNodeId id,
-//       Map<PartialPath, ViewExpression> viewPathToSourceMap,
-//       TRegionReplicaSet regionReplicaSet) {
-//     super(id);
-//     this.viewPathToSourceMap = viewPathToSourceMap;
-//     this.regionReplicaSet = regionReplicaSet;
-//   }
-// 
-//   protected final Map<PartialPath, ViewExpression> convertTargetAndSourceListsToMap(
-//       List<PartialPath> paths, List<ViewExpression> expressions) {
-//     if (paths.size() != expressions.size()) {
-//       return null;
-//     }
-//     Map<PartialPath, ViewExpression> result = new HashMap<>();
-//     for (int i = 0; i < paths.size(); i++) {
-//       result.put(paths.get(i), expressions.get(i));
-//     }
-//     return result;
-//   }
-// 
-//   // region Interfaces in ICreateLogicalViewPlan
-//   @Override
-//   public int getViewSize() {
-//     return this.viewPathToSourceMap.size();
-//   }
-// 
-//   @Override
-//   public Map<PartialPath, ViewExpression> getViewPathToSourceExpressionMap() {
-//     return this.viewPathToSourceMap;
-//   }
-// 
-//   @Override
-//   public List<PartialPath> getViewPathList() {
-//     List<PartialPath> result = new ArrayList<>(this.viewPathToSourceMap.keySet());
-//     return result;
-//   }
-// 
-//   @Override
-//   public void setViewPathToSourceExpressionMap(
-//       Map<PartialPath, ViewExpression> viewPathToSourceExpressionMap) {
-//     this.viewPathToSourceMap = viewPathToSourceExpressionMap;
-//   }
-// 
-//   @Override
-//   public <R, C> R accept(PlanVisitor<R, C> visitor, C schemaRegion) {
-//     return visitor.visitCreateLogicalView(this, schemaRegion);
-//   }
-
-//   // endregion
-// 
-//   // region Interfaces in WritePlanNode or PlanNode
-// 
-//   @Override
-//   public TRegionReplicaSet getRegionReplicaSet() {
-//     return this.regionReplicaSet;
-//   }
-// 
-//   @Override
-//   public List<PlanNode> getChildren() {
-//     return new ArrayList<>();
-//   }
-// 
-//   @Override
-//   public void addChild(PlanNode child) {
-//     // do nothing. this node should never have any child
-//   }
-// 
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+public class CreateLogicalViewNode extends WritePlanNode implements ICreateLogicalViewPlan {
+
+  /**
+   * A map from target path to source expression. Yht target path is the name of this logical view,
+   * and the source expression is the data source of this view.
+   */
+  private Map<PartialPath, ViewExpression> viewPathToSourceMap;
+
+  /**
+   * This variable will be set in function splitByPartition() according to analysis. And it will be
+   * set when creating new split nodes.
+   */
+  private TRegionReplicaSet regionReplicaSet = null;
+
+  public CreateLogicalViewNode(
+      PlanNodeId id, List<PartialPath> paths, List<ViewExpression> expressions) {
+    super(id);
+    this.viewPathToSourceMap = convertTargetAndSourceListsToMap(paths, expressions);
+  }
+
+  public CreateLogicalViewNode(
+      PlanNodeId id, Map<PartialPath, ViewExpression> viewPathToSourceMap) {
+    super(id);
+    this.viewPathToSourceMap = viewPathToSourceMap;
+  }
+
+  public CreateLogicalViewNode(
+      PlanNodeId id,
+      Map<PartialPath, ViewExpression> viewPathToSourceMap,
+      TRegionReplicaSet regionReplicaSet) {
+    super(id);
+    this.viewPathToSourceMap = viewPathToSourceMap;
+    this.regionReplicaSet = regionReplicaSet;
+  }
+
+  protected final Map<PartialPath, ViewExpression> convertTargetAndSourceListsToMap(
+      List<PartialPath> paths, List<ViewExpression> expressions) {
+    if (paths.size() != expressions.size()) {
+      return null;
+    }
+    Map<PartialPath, ViewExpression> result = new HashMap<>();
+    for (int i = 0; i < paths.size(); i++) {
+      result.put(paths.get(i), expressions.get(i));
+    }
+    return result;
+  }
+
+  // region Interfaces in ICreateLogicalViewPlan
+  @Override
+  public int getViewSize() {
+    return this.viewPathToSourceMap.size();
+  }
+
+  @Override
+  public Map<PartialPath, ViewExpression> getViewPathToSourceExpressionMap() {
+    return this.viewPathToSourceMap;
+  }
+
+  @Override
+  public List<PartialPath> getViewPathList() {
+    List<PartialPath> result = new ArrayList<>(this.viewPathToSourceMap.keySet());
+    return result;
+  }
+
+  @Override
+  public void setViewPathToSourceExpressionMap(
+      Map<PartialPath, ViewExpression> viewPathToSourceExpressionMap) {
+    this.viewPathToSourceMap = viewPathToSourceExpressionMap;
+  }
+
+  @Override
+  public <R, C> R accept(PlanVisitor<R, C> visitor, C schemaRegion) {
+    return visitor.visitCreateLogicalView(this, schemaRegion);
+  }
+
+  // endregion
+
+  // region Interfaces in WritePlanNode or PlanNode
+
+  @Override
+  public TRegionReplicaSet getRegionReplicaSet() {
+    return this.regionReplicaSet;
+  }
+
+  @Override
+  public List<PlanNode> getChildren() {
+    return new ArrayList<>();
+  }
+
+  @Override
+  public void addChild(PlanNode child) {
+    // do nothing. this node should never have any child
+  }
+
   @Override
   public PlanNodeType getType() {
     return PlanNodeType.CREATE_LOGICAL_VIEW;
   }
 
-//   @Override
-//   public PlanNode clone() {
-//     // TODO: CRTODO, complete this method
-//     throw new NotImplementedException("Clone of CreateMultiTimeSeriesNode is not implemented");
-//   }
-// 
-//   @Override
-//   public boolean equals(Object obj) {
-//     if (this == obj) {
-//       return true;
-//     }
-//     if (obj == null || getClass() != obj.getClass()) {
-//       return false;
-//     }
-//     CreateLogicalViewNode that = (CreateLogicalViewNode) obj;
-//     return (this.getPlanNodeId().equals(that.getPlanNodeId())
-//         && Objects.equals(this.viewPathToSourceMap, that.viewPathToSourceMap));
-//   }
-// 
+  @Override
+  public PlanNode clone() {
+    // TODO: CRTODO, complete this method
+    throw new NotImplementedException("Clone of CreateMultiTimeSeriesNode is not implemented");
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null || getClass() != obj.getClass()) {
+      return false;
+    }
+    CreateLogicalViewNode that = (CreateLogicalViewNode) obj;
+    return (this.getPlanNodeId().equals(that.getPlanNodeId())
+        && Objects.equals(this.viewPathToSourceMap, that.viewPathToSourceMap));
+  }
+
   @Override
   public int hashCode() {
     return Objects.hash(this.getPlanNodeId(), this.viewPathToSourceMap);
   }
 
-//   @Override
-//   public int allowedChildCount() {
-//     // this node should never have any child
-//     return NO_CHILD_ALLOWED;
-//   }
-// 
-//   @Override
-//   public List<String> getOutputColumnNames() {
-//     // TODO: CRTODO, complete this method
-//     throw new NotImplementedException(
-//         "getOutputColumnNames of CreateMultiTimeSeriesNode is not implemented");
-//   }
-// 
-//   @Override
-//   protected void serializeAttributes(ByteBuffer byteBuffer) {
-//     PlanNodeType.CREATE_LOGICAL_VIEW.serialize(byteBuffer);
-//     // serialize other member variables for this node
-//     ReadWriteIOUtils.write(this.viewPathToSourceMap.size(), byteBuffer);
-//     for (Map.Entry<PartialPath, ViewExpression> entry : viewPathToSourceMap.entrySet()) {
-//       entry.getKey().serialize(byteBuffer);
-//       ViewExpression.serialize(entry.getValue(), byteBuffer);
-//     }
-//   }
-// 
-//   @Override
-//   protected void serializeAttributes(DataOutputStream stream) throws IOException {
-//     PlanNodeType.CREATE_LOGICAL_VIEW.serialize(stream);
-//     // serialize other member variables for this node
-//     ReadWriteIOUtils.write(this.viewPathToSourceMap.size(), stream);
-//     for (Map.Entry<PartialPath, ViewExpression> entry : viewPathToSourceMap.entrySet()) {
-//       entry.getKey().serialize(stream);
-//       ViewExpression.serialize(entry.getValue(), stream);
-//     }
-//   }
-// 
-//   public static CreateLogicalViewNode deserialize(ByteBuffer byteBuffer) {
-//     // deserialize member variables
-//     Map<PartialPath, ViewExpression> viewPathToSourceMap = new HashMap<>();
-//     int size = byteBuffer.getInt();
-//     PartialPath path;
-//     ViewExpression viewExpression;
-//     for (int i = 0; i < size; i++) {
-//       path = (PartialPath) PathDeserializeUtil.deserialize(byteBuffer);
-//       viewExpression = ViewExpression.deserialize(byteBuffer);
-//       viewPathToSourceMap.put(path, viewExpression);
-//     }
-//     // deserialize PlanNodeId next
-//     PlanNodeId planNodeId = PlanNodeId.deserialize(byteBuffer);
-//     return new CreateLogicalViewNode(planNodeId, viewPathToSourceMap);
-//   }
-// 
-//   @Override
+  @Override
+  public int allowedChildCount() {
+    // this node should never have any child
+    return NO_CHILD_ALLOWED;
+  }
+
+  @Override
+  public List<String> getOutputColumnNames() {
+    // TODO: CRTODO, complete this method
+    throw new NotImplementedException(
+        "getOutputColumnNames of CreateMultiTimeSeriesNode is not implemented");
+  }
+
+  @Override
+  protected void serializeAttributes(ByteBuffer byteBuffer) {
+    PlanNodeType.CREATE_LOGICAL_VIEW.serialize(byteBuffer);
+    // serialize other member variables for this node
+    ReadWriteIOUtils.write(this.viewPathToSourceMap.size(), byteBuffer);
+    for (Map.Entry<PartialPath, ViewExpression> entry : viewPathToSourceMap.entrySet()) {
+      entry.getKey().serialize(byteBuffer);
+      ViewExpression.serialize(entry.getValue(), byteBuffer);
+    }
+  }
+
+  @Override
+  protected void serializeAttributes(DataOutputStream stream) throws IOException {
+    PlanNodeType.CREATE_LOGICAL_VIEW.serialize(stream);
+    // serialize other member variables for this node
+    ReadWriteIOUtils.write(this.viewPathToSourceMap.size(), stream);
+    for (Map.Entry<PartialPath, ViewExpression> entry : viewPathToSourceMap.entrySet()) {
+      entry.getKey().serialize(stream);
+      ViewExpression.serialize(entry.getValue(), stream);
+    }
+  }
+
+  public static CreateLogicalViewNode deserialize(ByteBuffer byteBuffer) {
+    // deserialize member variables
+    Map<PartialPath, ViewExpression> viewPathToSourceMap = new HashMap<>();
+    int size = byteBuffer.getInt();
+    PartialPath path;
+    ViewExpression viewExpression;
+    for (int i = 0; i < size; i++) {
+      path = (PartialPath) PathDeserializeUtil.deserialize(byteBuffer);
+      viewExpression = ViewExpression.deserialize(byteBuffer);
+      viewPathToSourceMap.put(path, viewExpression);
+    }
+    // deserialize PlanNodeId next
+    PlanNodeId planNodeId = PlanNodeId.deserialize(byteBuffer);
+    return new CreateLogicalViewNode(planNodeId, viewPathToSourceMap);
+  }
+
+  @Override
   public List<WritePlanNode> splitByPartition(IAnalysis analysis) {
-//     Map<TRegionReplicaSet, Map<PartialPath, ViewExpression>> splitMap = new HashMap<>();
-//     for (Map.Entry<PartialPath, ViewExpression> entry : this.viewPathToSourceMap.entrySet()) {
-//       // for each entry in the map for target path to source expression,
-//       // build a map from TRegionReplicaSet to this entry.
-//       // Please note that getSchemaRegionReplicaSet needs a device path as parameter.
-//       TRegionReplicaSet regionReplicaSet =
+    Map<TRegionReplicaSet, Map<PartialPath, ViewExpression>> splitMap = new HashMap<>();
+    for (Map.Entry<PartialPath, ViewExpression> entry : this.viewPathToSourceMap.entrySet()) {
+      // for each entry in the map for target path to source expression,
+      // build a map from TRegionReplicaSet to this entry.
+      // Please note that getSchemaRegionReplicaSet needs a device path as parameter.
+      TRegionReplicaSet regionReplicaSet =
           analysis
               .getSchemaPartitionInfo()
               .getSchemaRegionReplicaSet(
                   new MeasurementPath(entry.getKey().getNodes()).getIDeviceID());
-// 
-//       // create a map if the key(regionReplicaSet) is not exists,
-//       // then put this entry into this map(from regionReplicaSet to this entry)
-//       splitMap
-//           .computeIfAbsent(regionReplicaSet, k -> new HashMap<>())
-//           .put(entry.getKey(), entry.getValue());
-//     }
-// 
-//     // split this node into several nodes according to their regionReplicaSet
-//     List<WritePlanNode> result = new ArrayList<>();
+
+      // create a map if the key(regionReplicaSet) is not exists,
+      // then put this entry into this map(from regionReplicaSet to this entry)
+      splitMap
+          .computeIfAbsent(regionReplicaSet, k -> new HashMap<>())
+          .put(entry.getKey(), entry.getValue());
+    }
+
+    // split this node into several nodes according to their regionReplicaSet
+    List<WritePlanNode> result = new ArrayList<>();
     int maxSingleRequestSize =
         IoTDBDescriptor.getInstance().getConfig().getMaxMeasurementNumOfInternalRequest();
-//     for (Map.Entry<TRegionReplicaSet, Map<PartialPath, ViewExpression>> entry :
-//         splitMap.entrySet()) {
-//       // for each entry in splitMap, create a plan node.
+    for (Map.Entry<TRegionReplicaSet, Map<PartialPath, ViewExpression>> entry :
+        splitMap.entrySet()) {
+      // for each entry in splitMap, create a plan node.
       if (entry.getValue().size() > maxSingleRequestSize) {
         for (Map<PartialPath, ViewExpression> splitRequest :
             splitRequest(entry.getValue(), maxSingleRequestSize)) {
@@ -255,9 +255,9 @@ import org.apache.tsfile.utils.ReadWriteIOUtils;
       } else {
         result.add(new CreateLogicalViewNode(getPlanNodeId(), entry.getValue(), entry.getKey()));
       }
-//     }
-//     return result;
-//   }
+    }
+    return result;
+  }
 
   private List<Map<PartialPath, ViewExpression>> splitRequest(
       Map<PartialPath, ViewExpression> rawRequest, int maxSize) {
@@ -280,19 +280,19 @@ import org.apache.tsfile.utils.ReadWriteIOUtils;
     return result;
   }
 
-//   // endregion
-// 
-//   public List<PartialPath> getAllTimeSeriesPathInSource() {
-//     List<ViewExpression> sourceExpressions = new ArrayList<>();
-//     for (Map.Entry<PartialPath, ViewExpression> entry : this.viewPathToSourceMap.entrySet()) {
-//       sourceExpressions.add(entry.getValue());
-//     }
-//     // for each view expression, get the partial path for time series operand
-//     List<PartialPath> result = new ArrayList<>();
-//     GetSourcePathsVisitor getSourcePathsVisitor = new GetSourcePathsVisitor();
-//     for (ViewExpression expression : sourceExpressions) {
-//       result.addAll(getSourcePathsVisitor.process(expression, null));
-//     }
-//     return result;
-//   }
-// }
+  // endregion
+
+  public List<PartialPath> getAllTimeSeriesPathInSource() {
+    List<ViewExpression> sourceExpressions = new ArrayList<>();
+    for (Map.Entry<PartialPath, ViewExpression> entry : this.viewPathToSourceMap.entrySet()) {
+      sourceExpressions.add(entry.getValue());
+    }
+    // for each view expression, get the partial path for time series operand
+    List<PartialPath> result = new ArrayList<>();
+    GetSourcePathsVisitor getSourcePathsVisitor = new GetSourcePathsVisitor();
+    for (ViewExpression expression : sourceExpressions) {
+      result.addAll(getSourcePathsVisitor.process(expression, null));
+    }
+    return result;
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/SchemaCacheEntry.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/SchemaCacheEntry.java
index 5c46b69e00e..d26ddd88fc1 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/SchemaCacheEntry.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/SchemaCacheEntry.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache;
 
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 import org.apache.iotdb.db.queryengine.common.schematree.IMeasurementSchemaInfo;
 
 import org.apache.tsfile.enums.TSDataType;
@@ -51,14 +51,14 @@ public class SchemaCacheEntry implements IMeasurementSchemaInfo {
   private static final int INSTANCE_SIZE =
       (int) RamUsageEstimator.shallowSizeOfInstance(SchemaCacheEntry.class) + 75;
 
-//   private final IMeasurementSchema iMeasurementSchema;
+  private final IMeasurementSchema iMeasurementSchema;
 
   private final Map<String, String> tagMap;
 
   public SchemaCacheEntry(
       final @Nonnull IMeasurementSchema iMeasurementSchema,
       final @Nullable Map<String, String> tagMap) {
-//     this.iMeasurementSchema = iMeasurementSchema;
+    this.iMeasurementSchema = iMeasurementSchema;
     this.tagMap = tagMap;
   }
 
@@ -73,7 +73,7 @@ public class SchemaCacheEntry implements IMeasurementSchemaInfo {
   }
 
   public TSDataType getTsDataType() {
-//     return iMeasurementSchema.getType();
+    return iMeasurementSchema.getType();
   }
 
   public static int estimateSize(final SchemaCacheEntry schemaCacheEntry) {
@@ -88,33 +88,33 @@ public class SchemaCacheEntry implements IMeasurementSchemaInfo {
   }
 
   @Override
-//   public IMeasurementSchema getSchema() {
-//     return iMeasurementSchema;
-//   }
-// 
-//   @Override
-//   public MeasurementSchema getSchemaAsMeasurementSchema() {
-//     if (this.iMeasurementSchema instanceof MeasurementSchema) {
-//       return (MeasurementSchema) this.getSchema();
-//     }
-//     return null;
+  public IMeasurementSchema getSchema() {
+    return iMeasurementSchema;
+  }
+
+  @Override
+  public MeasurementSchema getSchemaAsMeasurementSchema() {
+    if (this.iMeasurementSchema instanceof MeasurementSchema) {
+      return (MeasurementSchema) this.getSchema();
+    }
+    return null;
+  }
+
+  @Override
+  public LogicalViewSchema getSchemaAsLogicalViewSchema() {
+    if (this.iMeasurementSchema instanceof LogicalViewSchema) {
+      return (LogicalViewSchema) this.getSchema();
+    }
+    return null;
   }
 
-//   @Override
-//   public LogicalViewSchema getSchemaAsLogicalViewSchema() {
-//     if (this.iMeasurementSchema instanceof LogicalViewSchema) {
-//       return (LogicalViewSchema) this.getSchema();
-//     }
-//     return null;
-//   }
-// 
   @Override
   public String getAlias() {
     return null;
   }
-// 
-//   @Override
-//   public boolean isLogicalView() {
-//     return this.iMeasurementSchema.isLogicalView();
-//   }
+
+  @Override
+  public boolean isLogicalView() {
+    return this.iMeasurementSchema.isLogicalView();
+  }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java
index 654554a0eca..4284a484d57 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementType.java
@@ -171,8 +171,8 @@ public enum StatementType {
   SHOW_SPACE_QUOTA,
   SET_THROTTLE_QUOTA,
   SHOW_THROTTLE_QUOTA,
-// 
-//   CREATE_LOGICAL_VIEW,
+
+  CREATE_LOGICAL_VIEW,
   DELETE_LOGICAL_VIEW,
   RENAME_LOGICAL_VIEW,
   ALTER_LOGICAL_VIEW,
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementVisitor.java
index 3367b293d7c..3bafdf8bfe0 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/StatementVisitor.java
@@ -280,12 +280,12 @@ public abstract class StatementVisitor<R, C> {
     return visitStatement(showPipePluginsStatement, context);
   }
 
-//   // Create Logical View
-//   public R visitCreateLogicalView(
-//       CreateLogicalViewStatement createLogicalViewStatement, C context) {
-//     return visitStatement(createLogicalViewStatement, context);
-//   }
-// 
+  // Create Logical View
+  public R visitCreateLogicalView(
+      CreateLogicalViewStatement createLogicalViewStatement, C context) {
+    return visitStatement(createLogicalViewStatement, context);
+  }
+
   public R visitDeleteLogicalView(
       DeleteLogicalViewStatement deleteLogicalViewStatement, C context) {
     return visitStatement(deleteLogicalViewStatement, context);
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java
index f08f72cbb3d..177c05bde19 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertBaseStatement.java
@@ -21,11 +21,10 @@ package org.apache.iotdb.db.queryengine.plan.statement.crud;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
-import org.apache.iotdb.db.auth.AuthorityChecker;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.exception.metadata.DataTypeMismatchException;
-// import org.apache.iotdb.db.exception.metadata.DuplicateInsertException;
+import org.apache.iotdb.db.exception.metadata.DuplicateInsertException;
 import org.apache.iotdb.db.exception.metadata.PathNotExistException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
 import org.apache.iotdb.db.exception.sql.SemanticException;
@@ -47,17 +46,17 @@ import org.apache.tsfile.utils.Pair;
 import org.apache.tsfile.utils.RamUsageEstimator;
 import org.apache.tsfile.write.schema.MeasurementSchema;
 
-// import java.util.ArrayList;
-// import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
-// import java.util.HashMap;
-// import java.util.HashSet;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Objects;
 import java.util.Optional;
-// import java.util.Set;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 public abstract class InsertBaseStatement extends Statement implements Accountable {
@@ -88,31 +87,31 @@ public abstract class InsertBaseStatement extends Statement implements Accountab
   protected List<Integer> attrColumnIndices;
   protected boolean writeToTable = false;
 
-//   // region params used by analyzing logical views.
-// 
-//   /** This param records the logical view schema appeared in this statement. */
+  // region params used by analyzing logical views.
+
+  /** This param records the logical view schema appeared in this statement. */
   protected List<LogicalViewSchema> logicalViewSchemaList;
-// 
-//   /**
-//    * This param records the index of the location where the source of this view should be placed.
-//    *
-//    * <p>For example, indexListOfLogicalViewPaths[alpha] = beta means source of
-//    * logicalViewSchemaList[alpha] should be filled into measurementSchemas[beta].
-//    */
+
+  /**
+   * This param records the index of the location where the source of this view should be placed.
+   *
+   * <p>For example, indexListOfLogicalViewPaths[alpha] = beta means source of
+   * logicalViewSchemaList[alpha] should be filled into measurementSchemas[beta].
+   */
   protected List<Integer> indexOfSourcePathsOfLogicalViews;
-// 
-//   /** it is the end of last range, the beginning of current range. */
+
+  /** it is the end of last range, the beginning of current range. */
   protected int recordedBeginOfLogicalViewSchemaList = 0;
-// 
-//   /** it is the end of current range. */
+
+  /** it is the end of current range. */
   protected int recordedEndOfLogicalViewSchemaList = 0;
-// 
+
   @TableModel protected String databaseName;
 
   protected long ramBytesUsed = Long.MIN_VALUE;
 
-//   // endregion
-// 
+  // endregion
+
   public PartialPath getDevicePath() {
     return devicePath;
   }
@@ -450,96 +449,96 @@ public abstract class InsertBaseStatement extends Statement implements Accountab
   }
 
   // endregion
-// 
-//   // region functions used by analyzing logical views
-//   /**
-//    * Remove logical view in this statement according to validated schemas. So this function should
-//    * be called after validating schemas.
-//    */
-//   public abstract InsertBaseStatement removeLogicalView();
-// 
-//   public void setFailedMeasurementIndex2Info(
-//       Map<Integer, FailedMeasurementInfo> failedMeasurementIndex2Info) {
-//     this.failedMeasurementIndex2Info = failedMeasurementIndex2Info;
-//   }
-// 
-//   /**
-//    * This function is used in splitting. Traverse two lists: logicalViewSchemaList, measurements,
-//    * then find out all devices in this statement. Those devices will map to their measurements,
-//    * recorded in a pair of measurement name and the index of measurement schemas
-//    * (this.measurementSchemas).
-//    *
-//    * @return map from device path to its measurements.
-//    */
+
+  // region functions used by analyzing logical views
+  /**
+   * Remove logical view in this statement according to validated schemas. So this function should
+   * be called after validating schemas.
+   */
+  public abstract InsertBaseStatement removeLogicalView();
+
+  public void setFailedMeasurementIndex2Info(
+      Map<Integer, FailedMeasurementInfo> failedMeasurementIndex2Info) {
+    this.failedMeasurementIndex2Info = failedMeasurementIndex2Info;
+  }
+
+  /**
+   * This function is used in splitting. Traverse two lists: logicalViewSchemaList, measurements,
+   * then find out all devices in this statement. Those devices will map to their measurements,
+   * recorded in a pair of measurement name and the index of measurement schemas
+   * (this.measurementSchemas).
+   *
+   * @return map from device path to its measurements.
+   */
   protected Map<PartialPath, List<Pair<String, Integer>>> getMapFromDeviceToMeasurementAndIndex() {
-//     boolean[] isLogicalView = new boolean[this.measurements.length];
-//     int[] indexMapToLogicalViewList = new int[this.measurements.length];
-//     Arrays.fill(isLogicalView, false);
-//     if (this.indexOfSourcePathsOfLogicalViews != null) {
-//       for (int i = 0; i < this.indexOfSourcePathsOfLogicalViews.size(); i++) {
-//         int realIndex = this.indexOfSourcePathsOfLogicalViews.get(i);
-//         isLogicalView[realIndex] = true;
-//         indexMapToLogicalViewList[realIndex] = i;
-//       }
-//     }
+    boolean[] isLogicalView = new boolean[this.measurements.length];
+    int[] indexMapToLogicalViewList = new int[this.measurements.length];
+    Arrays.fill(isLogicalView, false);
+    if (this.indexOfSourcePathsOfLogicalViews != null) {
+      for (int i = 0; i < this.indexOfSourcePathsOfLogicalViews.size(); i++) {
+        int realIndex = this.indexOfSourcePathsOfLogicalViews.get(i);
+        isLogicalView[realIndex] = true;
+        indexMapToLogicalViewList[realIndex] = i;
+      }
+    }
     // construct map from device to measurements and record the index of its measurement
     // schema
-//     Map<PartialPath, List<Pair<String, Integer>>> mapFromDeviceToMeasurementAndIndex =
-//         new HashMap<>();
-//     for (int i = 0; i < this.measurements.length; i++) {
+    Map<PartialPath, List<Pair<String, Integer>>> mapFromDeviceToMeasurementAndIndex =
+        new HashMap<>();
+    for (int i = 0; i < this.measurements.length; i++) {
       PartialPath targetDevicePath;
-//       String measurementName;
-//       if (isLogicalView[i]) {
-//         int viewIndex = indexMapToLogicalViewList[i];
+      String measurementName;
+      if (isLogicalView[i]) {
+        int viewIndex = indexMapToLogicalViewList[i];
         targetDevicePath =
-//             this.logicalViewSchemaList.get(viewIndex).getSourcePathIfWritable().getDevicePath();
-//         measurementName =
-//             this.logicalViewSchemaList.get(viewIndex).getSourcePathIfWritable().getMeasurement();
-//       } else {
+            this.logicalViewSchemaList.get(viewIndex).getSourcePathIfWritable().getDevicePath();
+        measurementName =
+            this.logicalViewSchemaList.get(viewIndex).getSourcePathIfWritable().getMeasurement();
+      } else {
         targetDevicePath = this.devicePath;
-//         measurementName = this.measurements[i];
-//       }
-//       int index = i;
-//       final String finalMeasurementName = measurementName;
-//       mapFromDeviceToMeasurementAndIndex.compute(
+        measurementName = this.measurements[i];
+      }
+      int index = i;
+      final String finalMeasurementName = measurementName;
+      mapFromDeviceToMeasurementAndIndex.compute(
           targetDevicePath,
-//           (k, v) -> {
-//             if (v == null) {
-//               List<Pair<String, Integer>> valueList = new ArrayList<>();
-//               valueList.add(new Pair<>(finalMeasurementName, index));
-//               return valueList;
-//             } else {
-//               v.add(new Pair<>(finalMeasurementName, index));
-//               return v;
-//             }
-//           });
-//     }
-//     // check this map, ensure that all time series (measurements in each device) only appear once
-//     validateMapFromDeviceToMeasurement(mapFromDeviceToMeasurementAndIndex);
-//     return mapFromDeviceToMeasurementAndIndex;
-//   }
-// 
-//   protected static void validateMapFromDeviceToMeasurement(
-//       Map<PartialPath, List<Pair<String, Integer>>> map) {
-//     if (map == null) {
-//       return;
-//     }
-//     for (Map.Entry<PartialPath, List<Pair<String, Integer>>> entry : map.entrySet()) {
-//       List<Pair<String, Integer>> measurementList = entry.getValue();
-//       if (measurementList.size() <= 1) {
-//         continue;
-//       }
-//       Set<String> measurementSet = new HashSet<>();
-//       for (Pair<String, Integer> thisPair : measurementList) {
-//         boolean measurementNotExists = measurementSet.add(thisPair.left);
-//         if (!measurementNotExists) {
-//           PartialPath devicePath = entry.getKey();
+          (k, v) -> {
+            if (v == null) {
+              List<Pair<String, Integer>> valueList = new ArrayList<>();
+              valueList.add(new Pair<>(finalMeasurementName, index));
+              return valueList;
+            } else {
+              v.add(new Pair<>(finalMeasurementName, index));
+              return v;
+            }
+          });
+    }
+    // check this map, ensure that all time series (measurements in each device) only appear once
+    validateMapFromDeviceToMeasurement(mapFromDeviceToMeasurementAndIndex);
+    return mapFromDeviceToMeasurementAndIndex;
+  }
+
+  protected static void validateMapFromDeviceToMeasurement(
+      Map<PartialPath, List<Pair<String, Integer>>> map) {
+    if (map == null) {
+      return;
+    }
+    for (Map.Entry<PartialPath, List<Pair<String, Integer>>> entry : map.entrySet()) {
+      List<Pair<String, Integer>> measurementList = entry.getValue();
+      if (measurementList.size() <= 1) {
+        continue;
+      }
+      Set<String> measurementSet = new HashSet<>();
+      for (Pair<String, Integer> thisPair : measurementList) {
+        boolean measurementNotExists = measurementSet.add(thisPair.left);
+        if (!measurementNotExists) {
+          PartialPath devicePath = entry.getKey();
           throw new SemanticException(
-//               new DuplicateInsertException(devicePath.getFullPath(), thisPair.left));
-//         }
-//       }
-//     }
-//   }
+              new DuplicateInsertException(devicePath.getFullPath(), thisPair.left));
+        }
+      }
+    }
+  }
 
   public void insertColumn(final int pos, final ColumnSchema columnSchema) {
     if (pos < 0 || pos > measurements.length) {
@@ -634,7 +633,7 @@ public abstract class InsertBaseStatement extends Statement implements Accountab
     return Optional.ofNullable(databaseName);
   }
 
-//   // endregion
+  // endregion
 
   @TableModel
   public void toLowerCase() {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertMultiTabletsStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertMultiTabletsStatement.java
index bc5989d4d57..f1816347c21 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertMultiTabletsStatement.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertMultiTabletsStatement.java
@@ -138,23 +138,23 @@ public class InsertMultiTabletsStatement extends InsertBaseStatement {
   public Object getFirstValueOfIndex(int index) {
     throw new NotImplementedException();
   }
-// 
-//   @Override
-//   public InsertBaseStatement removeLogicalView() {
-//     List<InsertTabletStatement> mergedList = new ArrayList<>();
-//     boolean needSplit = false;
-//     for (InsertTabletStatement child : this.insertTabletStatementList) {
-//       List<InsertTabletStatement> childSplitResult = child.getSplitList();
-//       needSplit = needSplit || child.isNeedSplit();
-//       mergedList.addAll(childSplitResult);
-//     }
-//     if (!needSplit) {
-//       return this;
-//     }
-//     InsertMultiTabletsStatement splitResult = new InsertMultiTabletsStatement();
-//     splitResult.setInsertTabletStatementList(mergedList);
-//     return splitResult;
-//   }
+
+  @Override
+  public InsertBaseStatement removeLogicalView() {
+    List<InsertTabletStatement> mergedList = new ArrayList<>();
+    boolean needSplit = false;
+    for (InsertTabletStatement child : this.insertTabletStatementList) {
+      List<InsertTabletStatement> childSplitResult = child.getSplitList();
+      needSplit = needSplit || child.isNeedSplit();
+      mergedList.addAll(childSplitResult);
+    }
+    if (!needSplit) {
+      return this;
+    }
+    InsertMultiTabletsStatement splitResult = new InsertMultiTabletsStatement();
+    splitResult.setInsertTabletStatementList(mergedList);
+    return splitResult;
+  }
 
   @TableModel
   @Override
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java
index 12c3069e076..52901f6f7fe 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java
@@ -22,7 +22,7 @@ package org.apache.iotdb.db.queryengine.plan.statement.crud;
 import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 import org.apache.iotdb.commons.conf.IoTDBConstant;
 import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 import org.apache.iotdb.commons.utils.TimePartitionUtils;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.exception.metadata.DataTypeMismatchException;
@@ -59,11 +59,11 @@ import org.slf4j.LoggerFactory;
 import java.nio.ByteBuffer;
 import java.time.ZoneId;
 import java.util.ArrayList;
-// import java.util.Arrays;
-// import java.util.Collections;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
-// import java.util.Map;
+import java.util.Map;
 import java.util.Objects;
 
 public class InsertRowStatement extends InsertBaseStatement implements ISchemaValidation {
@@ -80,19 +80,19 @@ public class InsertRowStatement extends InsertBaseStatement implements ISchemaVa
   protected Object[] values;
   protected boolean isNeedInferType = false;
 
-//   /**
-//    * This param record whether the source of logical view is aligned. Only used when there are
-//    * views.
-//    */
+  /**
+   * This param record whether the source of logical view is aligned. Only used when there are
+   * views.
+   */
   protected boolean[] measurementIsAligned;
-// 
+
   protected IDeviceID deviceID;
 
   public InsertRowStatement() {
     super();
     statementType = StatementType.INSERT;
-//     this.recordedBeginOfLogicalViewSchemaList = 0;
-//     this.recordedEndOfLogicalViewSchemaList = 0;
+    this.recordedBeginOfLogicalViewSchemaList = 0;
+    this.recordedEndOfLogicalViewSchemaList = 0;
   }
 
   @Override
@@ -312,65 +312,65 @@ public class InsertRowStatement extends InsertBaseStatement implements ISchemaVa
     }
   }
 
-//   public boolean isNeedSplit() {
+  public boolean isNeedSplit() {
     return hasLogicalViewNeedProcess();
-//   }
-// 
-//   public List<InsertRowStatement> getSplitList() {
-//     if (!isNeedSplit()) {
-//       return Collections.singletonList(this);
-//     }
-//     Map<PartialPath, List<Pair<String, Integer>>> mapFromDeviceToMeasurementAndIndex =
-//         this.getMapFromDeviceToMeasurementAndIndex();
-//     // Reconstruct statements
-//     List<InsertRowStatement> insertRowStatementList = new ArrayList<>();
-//     for (Map.Entry<PartialPath, List<Pair<String, Integer>>> entry :
-//         mapFromDeviceToMeasurementAndIndex.entrySet()) {
-//       List<Pair<String, Integer>> pairList = entry.getValue();
-//       InsertRowStatement statement = new InsertRowStatement();
-//       statement.setTime(this.time);
-//       statement.setNeedInferType(this.isNeedInferType);
-//       statement.setDevicePath(entry.getKey());
-//       statement.setAligned(this.isAligned);
+  }
+
+  public List<InsertRowStatement> getSplitList() {
+    if (!isNeedSplit()) {
+      return Collections.singletonList(this);
+    }
+    Map<PartialPath, List<Pair<String, Integer>>> mapFromDeviceToMeasurementAndIndex =
+        this.getMapFromDeviceToMeasurementAndIndex();
+    // Reconstruct statements
+    List<InsertRowStatement> insertRowStatementList = new ArrayList<>();
+    for (Map.Entry<PartialPath, List<Pair<String, Integer>>> entry :
+        mapFromDeviceToMeasurementAndIndex.entrySet()) {
+      List<Pair<String, Integer>> pairList = entry.getValue();
+      InsertRowStatement statement = new InsertRowStatement();
+      statement.setTime(this.time);
+      statement.setNeedInferType(this.isNeedInferType);
+      statement.setDevicePath(entry.getKey());
+      statement.setAligned(this.isAligned);
       Object[] copiedValues = new Object[pairList.size()];
-//       String[] measurements = new String[pairList.size()];
-//       MeasurementSchema[] measurementSchemas = new MeasurementSchema[pairList.size()];
-//       TSDataType[] dataTypes = new TSDataType[pairList.size()];
-//       for (int i = 0; i < pairList.size(); i++) {
-//         int realIndex = pairList.get(i).right;
+      String[] measurements = new String[pairList.size()];
+      MeasurementSchema[] measurementSchemas = new MeasurementSchema[pairList.size()];
+      TSDataType[] dataTypes = new TSDataType[pairList.size()];
+      for (int i = 0; i < pairList.size(); i++) {
+        int realIndex = pairList.get(i).right;
         copiedValues[i] = this.values[realIndex];
         measurements[i] =
             Objects.nonNull(this.measurements[realIndex]) ? pairList.get(i).left : null;
-//         measurementSchemas[i] = this.measurementSchemas[realIndex];
-//         dataTypes[i] = this.dataTypes[realIndex];
-//         if (this.measurementIsAligned != null) {
-//           statement.setAligned(this.measurementIsAligned[realIndex]);
-//         }
-//       }
+        measurementSchemas[i] = this.measurementSchemas[realIndex];
+        dataTypes[i] = this.dataTypes[realIndex];
+        if (this.measurementIsAligned != null) {
+          statement.setAligned(this.measurementIsAligned[realIndex]);
+        }
+      }
       statement.setValues(copiedValues);
-//       statement.setMeasurements(measurements);
-//       statement.setMeasurementSchemas(measurementSchemas);
-//       statement.setDataTypes(dataTypes);
-//       statement.setFailedMeasurementIndex2Info(failedMeasurementIndex2Info);
-//       insertRowStatementList.add(statement);
-//     }
-//     return insertRowStatementList;
-//   }
-// 
-//   @Override
-//   public InsertBaseStatement removeLogicalView() {
-//     if (!isNeedSplit()) {
-//       return this;
-//     }
-//     List<InsertRowStatement> insertRowStatementList = this.getSplitList();
-//     if (insertRowStatementList.size() == 1) {
-//       return insertRowStatementList.get(0);
-//     }
-//     InsertRowsStatement insertRowsStatement = new InsertRowsStatement();
-//     insertRowsStatement.setInsertRowStatementList(insertRowStatementList);
-//     return insertRowsStatement;
-//   }
-// 
+      statement.setMeasurements(measurements);
+      statement.setMeasurementSchemas(measurementSchemas);
+      statement.setDataTypes(dataTypes);
+      statement.setFailedMeasurementIndex2Info(failedMeasurementIndex2Info);
+      insertRowStatementList.add(statement);
+    }
+    return insertRowStatementList;
+  }
+
+  @Override
+  public InsertBaseStatement removeLogicalView() {
+    if (!isNeedSplit()) {
+      return this;
+    }
+    List<InsertRowStatement> insertRowStatementList = this.getSplitList();
+    if (insertRowStatementList.size() == 1) {
+      return insertRowStatementList.get(0);
+    }
+    InsertRowsStatement insertRowsStatement = new InsertRowsStatement();
+    insertRowsStatement.setInsertRowStatementList(insertRowStatementList);
+    return insertRowsStatement;
+  }
+
   @Override
   public ISchemaValidation getSchemaValidation() {
     return this;
@@ -413,7 +413,7 @@ public class InsertRowStatement extends InsertBaseStatement implements ISchemaVa
 
   @Override
   public void validateDeviceSchema(boolean isAligned) {
-//     this.isAligned = isAligned;
+    this.isAligned = isAligned;
   }
 
   @Override
@@ -424,17 +424,17 @@ public class InsertRowStatement extends InsertBaseStatement implements ISchemaVa
     if (measurementSchemaInfo == null) {
       measurementSchemas[index] = null;
     } else {
-//       if (measurementSchemaInfo.isLogicalView()) {
-//         if (logicalViewSchemaList == null || indexOfSourcePathsOfLogicalViews == null) {
-//           logicalViewSchemaList = new ArrayList<>();
-//           indexOfSourcePathsOfLogicalViews = new ArrayList<>();
-//         }
-//         logicalViewSchemaList.add(measurementSchemaInfo.getSchemaAsLogicalViewSchema());
-//         indexOfSourcePathsOfLogicalViews.add(index);
-//         return;
-//       } else {
-//         measurementSchemas[index] = measurementSchemaInfo.getSchemaAsMeasurementSchema();
-//       }
+      if (measurementSchemaInfo.isLogicalView()) {
+        if (logicalViewSchemaList == null || indexOfSourcePathsOfLogicalViews == null) {
+          logicalViewSchemaList = new ArrayList<>();
+          indexOfSourcePathsOfLogicalViews = new ArrayList<>();
+        }
+        logicalViewSchemaList.add(measurementSchemaInfo.getSchemaAsLogicalViewSchema());
+        indexOfSourcePathsOfLogicalViews.add(index);
+        return;
+      } else {
+        measurementSchemas[index] = measurementSchemaInfo.getSchemaAsMeasurementSchema();
+      }
     }
     if (isNeedInferType) {
       return;
@@ -446,49 +446,49 @@ public class InsertRowStatement extends InsertBaseStatement implements ISchemaVa
       throw new SemanticException(e);
     }
   }
-// 
-//   @Override
-//   public void validateMeasurementSchema(
-//       int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) {
-//     this.validateMeasurementSchema(index, measurementSchemaInfo);
-//     if (this.measurementIsAligned == null) {
-//       this.measurementIsAligned = new boolean[this.measurements.length];
-//       Arrays.fill(this.measurementIsAligned, this.isAligned);
-//     }
-//     this.measurementIsAligned[index] = isAligned;
-//   }
-// 
-//   @Override
-//   public boolean hasLogicalViewNeedProcess() {
-//     if (this.indexOfSourcePathsOfLogicalViews == null) {
-//       return false;
-//     }
-//     return !this.indexOfSourcePathsOfLogicalViews.isEmpty();
-//   }
-// 
-//   @Override
-//   public List<LogicalViewSchema> getLogicalViewSchemaList() {
-//     return this.logicalViewSchemaList;
-//   }
-// 
-//   @Override
-//   public List<Integer> getIndexListOfLogicalViewPaths() {
-//     return this.indexOfSourcePathsOfLogicalViews;
-//   }
-// 
-//   @Override
-//   public void recordRangeOfLogicalViewSchemaListNow() {
-//     if (this.logicalViewSchemaList != null) {
-//       this.recordedBeginOfLogicalViewSchemaList = this.recordedEndOfLogicalViewSchemaList;
-//       this.recordedEndOfLogicalViewSchemaList = this.logicalViewSchemaList.size();
-//     }
-//   }
-// 
-//   @Override
-//   public Pair<Integer, Integer> getRangeOfLogicalViewSchemaListRecorded() {
-//     return new Pair<>(
-//         this.recordedBeginOfLogicalViewSchemaList, this.recordedEndOfLogicalViewSchemaList);
-//   }
+
+  @Override
+  public void validateMeasurementSchema(
+      int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) {
+    this.validateMeasurementSchema(index, measurementSchemaInfo);
+    if (this.measurementIsAligned == null) {
+      this.measurementIsAligned = new boolean[this.measurements.length];
+      Arrays.fill(this.measurementIsAligned, this.isAligned);
+    }
+    this.measurementIsAligned[index] = isAligned;
+  }
+
+  @Override
+  public boolean hasLogicalViewNeedProcess() {
+    if (this.indexOfSourcePathsOfLogicalViews == null) {
+      return false;
+    }
+    return !this.indexOfSourcePathsOfLogicalViews.isEmpty();
+  }
+
+  @Override
+  public List<LogicalViewSchema> getLogicalViewSchemaList() {
+    return this.logicalViewSchemaList;
+  }
+
+  @Override
+  public List<Integer> getIndexListOfLogicalViewPaths() {
+    return this.indexOfSourcePathsOfLogicalViews;
+  }
+
+  @Override
+  public void recordRangeOfLogicalViewSchemaListNow() {
+    if (this.logicalViewSchemaList != null) {
+      this.recordedBeginOfLogicalViewSchemaList = this.recordedEndOfLogicalViewSchemaList;
+      this.recordedEndOfLogicalViewSchemaList = this.logicalViewSchemaList.size();
+    }
+  }
+
+  @Override
+  public Pair<Integer, Integer> getRangeOfLogicalViewSchemaListRecorded() {
+    return new Pair<>(
+        this.recordedBeginOfLogicalViewSchemaList, this.recordedEndOfLogicalViewSchemaList);
+  }
 
   @TableModel
   public IDeviceID getTableDeviceID() {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsOfOneDeviceStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsOfOneDeviceStatement.java
index f8dbdef08de..69324594f78 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsOfOneDeviceStatement.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsOfOneDeviceStatement.java
@@ -155,27 +155,27 @@ public class InsertRowsOfOneDeviceStatement extends InsertBaseStatement {
   public Object getFirstValueOfIndex(int index) {
     throw new NotImplementedException();
   }
-// 
-//   @Override
-//   public InsertBaseStatement removeLogicalView() {
-//     boolean needSplit = false;
-//     for (InsertRowStatement child : this.insertRowStatementList) {
-//       if (child.isNeedSplit()) {
-//         needSplit = true;
-//       }
-//     }
-//     if (needSplit) {
-//       List<InsertRowStatement> mergedList = new ArrayList<>();
-//       for (InsertRowStatement child : this.insertRowStatementList) {
-//         List<InsertRowStatement> childSplitResult = child.getSplitList();
-//         mergedList.addAll(childSplitResult);
-//       }
-//       InsertRowsStatement splitResult = new InsertRowsStatement();
-//       splitResult.setInsertRowStatementList(mergedList);
-//       return splitResult;
-//     }
-//     return this;
-//   }
+
+  @Override
+  public InsertBaseStatement removeLogicalView() {
+    boolean needSplit = false;
+    for (InsertRowStatement child : this.insertRowStatementList) {
+      if (child.isNeedSplit()) {
+        needSplit = true;
+      }
+    }
+    if (needSplit) {
+      List<InsertRowStatement> mergedList = new ArrayList<>();
+      for (InsertRowStatement child : this.insertRowStatementList) {
+        List<InsertRowStatement> childSplitResult = child.getSplitList();
+        mergedList.addAll(childSplitResult);
+      }
+      InsertRowsStatement splitResult = new InsertRowsStatement();
+      splitResult.setInsertRowStatementList(mergedList);
+      return splitResult;
+    }
+    return this;
+  }
 
   @TableModel
   @Override
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsStatement.java
index 411e68d354b..ad9e9ff4546 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsStatement.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowsStatement.java
@@ -159,23 +159,23 @@ public class InsertRowsStatement extends InsertBaseStatement {
   public Object getFirstValueOfIndex(int index) {
     throw new NotImplementedException();
   }
-// 
-//   @Override
-//   public InsertBaseStatement removeLogicalView() {
-//     List<InsertRowStatement> mergedList = new ArrayList<>();
-//     boolean needSplit = false;
-//     for (InsertRowStatement child : this.insertRowStatementList) {
-//       List<InsertRowStatement> childSplitResult = child.getSplitList();
-//       needSplit = needSplit || child.isNeedSplit();
-//       mergedList.addAll(childSplitResult);
-//     }
-//     if (!needSplit) {
-//       return this;
-//     }
-//     InsertRowsStatement splitResult = new InsertRowsStatement();
-//     splitResult.setInsertRowStatementList(mergedList);
-//     return splitResult;
-//   }
+
+  @Override
+  public InsertBaseStatement removeLogicalView() {
+    List<InsertRowStatement> mergedList = new ArrayList<>();
+    boolean needSplit = false;
+    for (InsertRowStatement child : this.insertRowStatementList) {
+      List<InsertRowStatement> childSplitResult = child.getSplitList();
+      needSplit = needSplit || child.isNeedSplit();
+      mergedList.addAll(childSplitResult);
+    }
+    if (!needSplit) {
+      return this;
+    }
+    InsertRowsStatement splitResult = new InsertRowsStatement();
+    splitResult.setInsertRowStatementList(mergedList);
+    return splitResult;
+  }
 
   public List<Object[]> getDeviceIdListNoTableName() {
     return insertRowStatementList.stream()
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java
index 56f8e845ee8..4680c313ba5 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java
@@ -23,7 +23,7 @@ import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 import org.apache.iotdb.commons.exception.MetadataException;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 import org.apache.iotdb.commons.utils.TimePartitionUtils;
 import org.apache.iotdb.db.exception.metadata.DataTypeMismatchException;
 import org.apache.iotdb.db.exception.metadata.PathNotExistException;
@@ -60,11 +60,11 @@ import org.apache.tsfile.write.schema.MeasurementSchema;
 
 import java.time.LocalDate;
 import java.util.ArrayList;
-// import java.util.Arrays;
-// import java.util.Collections;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
-// import java.util.Map;
+import java.util.Map;
 import java.util.Objects;
 
 public class InsertTabletStatement extends InsertBaseStatement implements ISchemaValidation {
@@ -83,17 +83,17 @@ public class InsertTabletStatement extends InsertBaseStatement implements ISchem
 
   protected int rowCount = 0;
 
-//   /**
-//    * This param record whether the source of logical view is aligned. Only used when there are
-//    * views.
-//    */
+  /**
+   * This param record whether the source of logical view is aligned. Only used when there are
+   * views.
+   */
   protected boolean[] measurementIsAligned;
-// 
+
   public InsertTabletStatement() {
     super();
     statementType = StatementType.BATCH_INSERT;
-//     this.recordedBeginOfLogicalViewSchemaList = 0;
-//     this.recordedEndOfLogicalViewSchemaList = 0;
+    this.recordedBeginOfLogicalViewSchemaList = 0;
+    this.recordedEndOfLogicalViewSchemaList = 0;
   }
 
   public InsertTabletStatement(
@@ -302,72 +302,72 @@ public class InsertTabletStatement extends InsertBaseStatement implements ISchem
     }
   }
 
-//   public boolean isNeedSplit() {
+  public boolean isNeedSplit() {
     return hasLogicalViewNeedProcess();
-//   }
-// 
-//   public List<InsertTabletStatement> getSplitList() {
-//     if (!isNeedSplit()) {
-//       return Collections.singletonList(this);
-//     }
-//     Map<PartialPath, List<Pair<String, Integer>>> mapFromDeviceToMeasurementAndIndex =
-//         this.getMapFromDeviceToMeasurementAndIndex();
-//     // Reconstruct statements
-//     List<InsertTabletStatement> insertTabletStatementList = new ArrayList<>();
-//     for (Map.Entry<PartialPath, List<Pair<String, Integer>>> entry :
-//         mapFromDeviceToMeasurementAndIndex.entrySet()) {
-//       List<Pair<String, Integer>> pairList = entry.getValue();
-//       InsertTabletStatement statement = new InsertTabletStatement();
-//       statement.setTimes(this.times);
-//       statement.setDevicePath(entry.getKey());
-//       statement.setRowCount(this.rowCount);
-//       statement.setAligned(this.isAligned);
+  }
+
+  public List<InsertTabletStatement> getSplitList() {
+    if (!isNeedSplit()) {
+      return Collections.singletonList(this);
+    }
+    Map<PartialPath, List<Pair<String, Integer>>> mapFromDeviceToMeasurementAndIndex =
+        this.getMapFromDeviceToMeasurementAndIndex();
+    // Reconstruct statements
+    List<InsertTabletStatement> insertTabletStatementList = new ArrayList<>();
+    for (Map.Entry<PartialPath, List<Pair<String, Integer>>> entry :
+        mapFromDeviceToMeasurementAndIndex.entrySet()) {
+      List<Pair<String, Integer>> pairList = entry.getValue();
+      InsertTabletStatement statement = new InsertTabletStatement();
+      statement.setTimes(this.times);
+      statement.setDevicePath(entry.getKey());
+      statement.setRowCount(this.rowCount);
+      statement.setAligned(this.isAligned);
       Object[] copiedColumns = new Object[pairList.size()];
-//       String[] measurements = new String[pairList.size()];
+      String[] measurements = new String[pairList.size()];
       BitMap[] copiedBitMaps = new BitMap[pairList.size()];
-//       MeasurementSchema[] measurementSchemas = new MeasurementSchema[pairList.size()];
-//       TSDataType[] dataTypes = new TSDataType[pairList.size()];
-//       for (int i = 0; i < pairList.size(); i++) {
-//         int realIndex = pairList.get(i).right;
+      MeasurementSchema[] measurementSchemas = new MeasurementSchema[pairList.size()];
+      TSDataType[] dataTypes = new TSDataType[pairList.size()];
+      for (int i = 0; i < pairList.size(); i++) {
+        int realIndex = pairList.get(i).right;
         copiedColumns[i] = this.columns[realIndex];
         measurements[i] =
             Objects.nonNull(this.measurements[realIndex]) ? pairList.get(i).left : null;
-//         measurementSchemas[i] = this.measurementSchemas[realIndex];
-//         dataTypes[i] = this.dataTypes[realIndex];
+        measurementSchemas[i] = this.measurementSchemas[realIndex];
+        dataTypes[i] = this.dataTypes[realIndex];
         if (this.nullBitMaps != null) {
           copiedBitMaps[i] = this.nullBitMaps[realIndex];
-//         }
-//         if (this.measurementIsAligned != null) {
-//           statement.setAligned(this.measurementIsAligned[realIndex]);
-//         }
-//       }
+        }
+        if (this.measurementIsAligned != null) {
+          statement.setAligned(this.measurementIsAligned[realIndex]);
+        }
+      }
       statement.setColumns(copiedColumns);
-//       statement.setMeasurements(measurements);
-//       statement.setMeasurementSchemas(measurementSchemas);
-//       statement.setDataTypes(dataTypes);
+      statement.setMeasurements(measurements);
+      statement.setMeasurementSchemas(measurementSchemas);
+      statement.setDataTypes(dataTypes);
       if (this.nullBitMaps != null) {
         statement.setBitMaps(copiedBitMaps);
-//       }
-//       statement.setFailedMeasurementIndex2Info(failedMeasurementIndex2Info);
-//       insertTabletStatementList.add(statement);
-//     }
-//     return insertTabletStatementList;
-//   }
-// 
-//   @Override
-//   public InsertBaseStatement removeLogicalView() {
-//     if (!isNeedSplit()) {
-//       return this;
-//     }
-//     List<InsertTabletStatement> insertTabletStatementList = this.getSplitList();
-//     if (insertTabletStatementList.size() == 1) {
-//       return insertTabletStatementList.get(0);
-//     }
-//     InsertMultiTabletsStatement insertMultiTabletsStatement = new InsertMultiTabletsStatement();
-//     insertMultiTabletsStatement.setInsertTabletStatementList(insertTabletStatementList);
-//     return insertMultiTabletsStatement;
-//   }
-// 
+      }
+      statement.setFailedMeasurementIndex2Info(failedMeasurementIndex2Info);
+      insertTabletStatementList.add(statement);
+    }
+    return insertTabletStatementList;
+  }
+
+  @Override
+  public InsertBaseStatement removeLogicalView() {
+    if (!isNeedSplit()) {
+      return this;
+    }
+    List<InsertTabletStatement> insertTabletStatementList = this.getSplitList();
+    if (insertTabletStatementList.size() == 1) {
+      return insertTabletStatementList.get(0);
+    }
+    InsertMultiTabletsStatement insertMultiTabletsStatement = new InsertMultiTabletsStatement();
+    insertMultiTabletsStatement.setInsertTabletStatementList(insertTabletStatementList);
+    return insertMultiTabletsStatement;
+  }
+
   @Override
   public long getMinTime() {
     return times[0];
@@ -429,7 +429,7 @@ public class InsertTabletStatement extends InsertBaseStatement implements ISchem
 
   @Override
   public void validateDeviceSchema(boolean isAligned) {
-//     this.isAligned = isAligned;
+    this.isAligned = isAligned;
   }
 
   @Override
@@ -440,17 +440,17 @@ public class InsertTabletStatement extends InsertBaseStatement implements ISchem
     if (measurementSchemaInfo == null) {
       measurementSchemas[index] = null;
     } else {
-//       if (measurementSchemaInfo.isLogicalView()) {
-//         if (logicalViewSchemaList == null || indexOfSourcePathsOfLogicalViews == null) {
-//           logicalViewSchemaList = new ArrayList<>();
-//           indexOfSourcePathsOfLogicalViews = new ArrayList<>();
-//         }
-//         logicalViewSchemaList.add(measurementSchemaInfo.getSchemaAsLogicalViewSchema());
-//         indexOfSourcePathsOfLogicalViews.add(index);
-//         return;
-//       } else {
-//         measurementSchemas[index] = measurementSchemaInfo.getSchemaAsMeasurementSchema();
-//       }
+      if (measurementSchemaInfo.isLogicalView()) {
+        if (logicalViewSchemaList == null || indexOfSourcePathsOfLogicalViews == null) {
+          logicalViewSchemaList = new ArrayList<>();
+          indexOfSourcePathsOfLogicalViews = new ArrayList<>();
+        }
+        logicalViewSchemaList.add(measurementSchemaInfo.getSchemaAsLogicalViewSchema());
+        indexOfSourcePathsOfLogicalViews.add(index);
+        return;
+      } else {
+        measurementSchemas[index] = measurementSchemaInfo.getSchemaAsMeasurementSchema();
+      }
     }
 
     try {
@@ -459,49 +459,49 @@ public class InsertTabletStatement extends InsertBaseStatement implements ISchem
       throw new SemanticException(e);
     }
   }
-// 
-//   @Override
-//   public void validateMeasurementSchema(
-//       int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) {
-//     this.validateMeasurementSchema(index, measurementSchemaInfo);
-//     if (this.measurementIsAligned == null) {
-//       this.measurementIsAligned = new boolean[this.measurements.length];
-//       Arrays.fill(this.measurementIsAligned, this.isAligned);
-//     }
-//     this.measurementIsAligned[index] = isAligned;
-//   }
-// 
-//   @Override
-//   public boolean hasLogicalViewNeedProcess() {
-//     if (this.indexOfSourcePathsOfLogicalViews == null) {
-//       return false;
-//     }
-//     return !this.indexOfSourcePathsOfLogicalViews.isEmpty();
-//   }
-// 
-//   @Override
-//   public List<LogicalViewSchema> getLogicalViewSchemaList() {
-//     return this.logicalViewSchemaList;
-//   }
-// 
-//   @Override
-//   public List<Integer> getIndexListOfLogicalViewPaths() {
-//     return this.indexOfSourcePathsOfLogicalViews;
-//   }
-// 
-//   @Override
-//   public void recordRangeOfLogicalViewSchemaListNow() {
-//     if (this.logicalViewSchemaList != null) {
-//       this.recordedBeginOfLogicalViewSchemaList = this.recordedEndOfLogicalViewSchemaList;
-//       this.recordedEndOfLogicalViewSchemaList = this.logicalViewSchemaList.size();
-//     }
-//   }
-// 
-//   @Override
-//   public Pair<Integer, Integer> getRangeOfLogicalViewSchemaListRecorded() {
-//     return new Pair<>(
-//         this.recordedBeginOfLogicalViewSchemaList, this.recordedEndOfLogicalViewSchemaList);
-//   }
+
+  @Override
+  public void validateMeasurementSchema(
+      int index, IMeasurementSchemaInfo measurementSchemaInfo, boolean isAligned) {
+    this.validateMeasurementSchema(index, measurementSchemaInfo);
+    if (this.measurementIsAligned == null) {
+      this.measurementIsAligned = new boolean[this.measurements.length];
+      Arrays.fill(this.measurementIsAligned, this.isAligned);
+    }
+    this.measurementIsAligned[index] = isAligned;
+  }
+
+  @Override
+  public boolean hasLogicalViewNeedProcess() {
+    if (this.indexOfSourcePathsOfLogicalViews == null) {
+      return false;
+    }
+    return !this.indexOfSourcePathsOfLogicalViews.isEmpty();
+  }
+
+  @Override
+  public List<LogicalViewSchema> getLogicalViewSchemaList() {
+    return this.logicalViewSchemaList;
+  }
+
+  @Override
+  public List<Integer> getIndexListOfLogicalViewPaths() {
+    return this.indexOfSourcePathsOfLogicalViews;
+  }
+
+  @Override
+  public void recordRangeOfLogicalViewSchemaListNow() {
+    if (this.logicalViewSchemaList != null) {
+      this.recordedBeginOfLogicalViewSchemaList = this.recordedEndOfLogicalViewSchemaList;
+      this.recordedEndOfLogicalViewSchemaList = this.logicalViewSchemaList.size();
+    }
+  }
+
+  @Override
+  public Pair<Integer, Integer> getRangeOfLogicalViewSchemaListRecorded() {
+    return new Pair<>(
+        this.recordedBeginOfLogicalViewSchemaList, this.recordedEndOfLogicalViewSchemaList);
+  }
 
   @Override
   public Statement toRelationalStatement(MPPQueryContext context) {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/view/CreateLogicalViewStatement.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/view/CreateLogicalViewStatement.java
index 6bb976a6634..e1a122b0816 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/view/CreateLogicalViewStatement.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/metadata/view/CreateLogicalViewStatement.java
@@ -1,31 +1,27 @@
-// /*
-//  * 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.
-//  */
-// 
+/*
+ * 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.queryengine.plan.statement.metadata.view;
-// 
-import org.apache.iotdb.common.rpc.thrift.TSStatus;
-import org.apache.iotdb.commons.auth.entity.PrivilegeType;
-import org.apache.iotdb.commons.conf.IoTDBConstant;
-// import org.apache.iotdb.commons.path.PartialPath;
+
+import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
-import org.apache.iotdb.db.auth.AuthorityChecker;
-// import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException;
+import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException;
 import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.queryengine.plan.analyze.SelectIntoUtils;
 import org.apache.iotdb.db.queryengine.plan.expression.Expression;
@@ -40,80 +36,41 @@ import org.apache.iotdb.db.schemaengine.schemaregion.view.ViewPathType;
 import org.apache.iotdb.db.schemaengine.schemaregion.view.ViewPaths;
 
 import org.apache.tsfile.utils.Pair;
-// 
-// import java.util.ArrayList;
-// import java.util.Collections;
-// import java.util.List;
-import java.util.Objects;
-// 
-// /** CREATE LOGICAL VIEW statement. */
-// public class CreateLogicalViewStatement extends Statement {
-// 
-//   // the paths of this view
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/** CREATE LOGICAL VIEW statement. */
+public class CreateLogicalViewStatement extends Statement {
+
+  // the paths of this view
   private ViewPaths targetPaths;
-//   private IntoItem batchGenerationItem;
-// 
-//   // the paths of sources
+  private IntoItem batchGenerationItem;
+
+  // the paths of sources
   private ViewPaths sourcePaths;
-//   private QueryStatement queryStatement;
-// 
+  private QueryStatement queryStatement;
+
   // if not null, all related check and generation will be skipped
   private List<ViewExpression> viewExpressions;
   private boolean canSeeAuditDB;
 
-//   public CreateLogicalViewStatement() {
-//     super();
-//     this.statementType = StatementType.CREATE_LOGICAL_VIEW;
+  public CreateLogicalViewStatement() {
+    super();
+    this.statementType = StatementType.CREATE_LOGICAL_VIEW;
     this.sourcePaths = new ViewPaths();
     this.targetPaths = new ViewPaths();
-//   }
-// 
-//   // region Interfaces about setting and getting
-// 
-//   // get paths
-//   @Override
-//   public List<PartialPath> getPaths() {
-//     return this.getTargetPathList();
-//   }
-//
-  public TSStatus checkPermissionBeforeProcess(String userName) {
-    if (AuthorityChecker.SUPER_USER.equals(userName)) {
-      return new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
-    }
-    TSStatus status = new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
-    List<PartialPath> sourcePathList = sourcePaths.fullPathList;
-    if (sourcePathList != null) {
-      status =
-          AuthorityChecker.getTSStatus(
-              AuthorityChecker.checkFullPathOrPatternListPermission(
-                  userName, sourcePathList, PrivilegeType.READ_SCHEMA),
-              sourcePathList,
-              PrivilegeType.READ_SCHEMA);
-    }
-    if (queryStatement != null && status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-      sourcePathList = queryStatement.getPaths();
-      status =
-          AuthorityChecker.getTSStatus(
-              AuthorityChecker.checkFullPathOrPatternListPermission(
-                  userName, sourcePathList, PrivilegeType.READ_SCHEMA),
-              sourcePathList,
-              PrivilegeType.READ_SCHEMA);
-    }
-    final List<PartialPath> paths =
-        Objects.nonNull(getTargetPathList())
-            ? getTargetPathList()
-            : Collections.singletonList(
-                batchGenerationItem
-                    .getIntoDevice()
-                    .concatNode(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD));
-    if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-      return AuthorityChecker.getTSStatus(
-          AuthorityChecker.checkFullPathOrPatternListPermission(
-              userName, paths, PrivilegeType.WRITE_SCHEMA),
-          paths,
-          PrivilegeType.WRITE_SCHEMA);
-    }
-    return status;
+  }
+
+  // region Interfaces about setting and getting
+
+  // get paths
+  @Override
+  public List<PartialPath> getPaths() {
+    return this.getTargetPathList();
+  }
+
   public ViewPaths getTargetPaths() {
     return targetPaths;
   }
@@ -122,172 +79,182 @@ import java.util.Objects;
     return sourcePaths;
   }
 
-//   public List<PartialPath> getTargetPathList() {
-//     return this.targetPaths.fullPathList;
-//   }
-// 
-//   public List<Expression> getSourceExpressionList() {
-//     this.sourcePaths.generateExpressionsIfNecessary();
-//     return this.sourcePaths.expressionsList;
-//   }
-// 
-//   public QueryStatement getQueryStatement() {
-//     return this.queryStatement;
-//   }
-// 
+  public List<PartialPath> getTargetPathList() {
+    return this.targetPaths.fullPathList;
+  }
+
+  public List<Expression> getSourceExpressionList() {
+    this.sourcePaths.generateExpressionsIfNecessary();
+    return this.sourcePaths.expressionsList;
+  }
+
+  public QueryStatement getQueryStatement() {
+    return this.queryStatement;
+  }
+
   public List<ViewExpression> getViewExpressions() {
     return viewExpressions;
   }
 
-//   // set source paths
+  // set source paths
   public void setSourcePaths(ViewPaths sourcePaths) {
     this.sourcePaths = sourcePaths;
   }
 
-//   public void setSourceFullPaths(List<PartialPath> paths) {
-//     this.sourcePaths.setViewPathType(ViewPathType.FULL_PATH_LIST);
-//     this.sourcePaths.setFullPathList(paths);
-//   }
-// 
-//   public void setSourcePathsGroup(PartialPath prefixPath, List<PartialPath> suffixPaths) {
-//     this.sourcePaths.setViewPathType(ViewPathType.PATHS_GROUP);
-//     this.sourcePaths.setPrefixOfPathsGroup(prefixPath);
-//     this.sourcePaths.setSuffixOfPathsGroup(suffixPaths);
-//     this.sourcePaths.generateFullPathsFromPathsGroup();
-//   }
-// 
-//   public void setSourceQueryStatement(QueryStatement queryStatement) {
-//     this.sourcePaths.setViewPathType(ViewPathType.QUERY_STATEMENT);
-//     this.queryStatement = queryStatement;
-//   }
-// 
+  public void setSourceFullPaths(List<PartialPath> paths) {
+    this.sourcePaths.setViewPathType(ViewPathType.FULL_PATH_LIST);
+    this.sourcePaths.setFullPathList(paths);
+  }
+
+  public void setSourcePathsGroup(PartialPath prefixPath, List<PartialPath> suffixPaths) {
+    this.sourcePaths.setViewPathType(ViewPathType.PATHS_GROUP);
+    this.sourcePaths.setPrefixOfPathsGroup(prefixPath);
+    this.sourcePaths.setSuffixOfPathsGroup(suffixPaths);
+    this.sourcePaths.generateFullPathsFromPathsGroup();
+  }
+
+  public void setSourceQueryStatement(QueryStatement queryStatement) {
+    this.sourcePaths.setViewPathType(ViewPathType.QUERY_STATEMENT);
+    this.queryStatement = queryStatement;
+  }
+
   public void setQueryStatement(QueryStatement queryStatement) {
     this.queryStatement = queryStatement;
   }
 
-//   /**
+  /**
    * This function must be called after analyzing read statement. Expressions that analyzed should
-//    * be set through here.
-//    *
-//    * @param expressionList
-//    */
-//   public void setSourceExpressions(List<Expression> expressionList)
-//       throws UnsupportedViewException {
-//     // check expressions, make sure no aggregation function expression
-//     Pair<Boolean, UnsupportedViewException> checkResult =
-//         ViewPaths.checkExpressionList(expressionList);
+   * be set through here.
+   *
+   * @param expressionList
+   */
+  public void setSourceExpressions(List<Expression> expressionList)
+      throws UnsupportedViewException {
+    // check expressions, make sure no aggregation function expression
+    Pair<Boolean, UnsupportedViewException> checkResult =
+        ViewPaths.checkExpressionList(expressionList);
     if (Boolean.TRUE.equals(checkResult.left)) {
-//       this.sourcePaths.setExpressionsList(expressionList);
-//     } else {
-//       throw checkResult.right;
-//     }
-//   }
-// 
-//   // set target paths
+      this.sourcePaths.setExpressionsList(expressionList);
+    } else {
+      throw checkResult.right;
+    }
+  }
+
+  // set target paths
   public void setTargetPaths(ViewPaths targetPaths) {
     this.targetPaths = targetPaths;
   }
 
-//   public void setTargetFullPaths(List<PartialPath> paths) {
-//     this.targetPaths.setViewPathType(ViewPathType.FULL_PATH_LIST);
-//     this.targetPaths.setFullPathList(paths);
-//   }
-// 
-//   public void setTargetPathsGroup(PartialPath prefixPath, List<PartialPath> suffixPaths) {
-//     this.targetPaths.setViewPathType(ViewPathType.PATHS_GROUP);
-//     this.targetPaths.setPrefixOfPathsGroup(prefixPath);
-//     this.targetPaths.setSuffixOfPathsGroup(suffixPaths);
-//     this.targetPaths.generateFullPathsFromPathsGroup();
-//   }
-// 
+  public void setTargetFullPaths(List<PartialPath> paths) {
+    this.targetPaths.setViewPathType(ViewPathType.FULL_PATH_LIST);
+    this.targetPaths.setFullPathList(paths);
+  }
+
+  public void setTargetPathsGroup(PartialPath prefixPath, List<PartialPath> suffixPaths) {
+    this.targetPaths.setViewPathType(ViewPathType.PATHS_GROUP);
+    this.targetPaths.setPrefixOfPathsGroup(prefixPath);
+    this.targetPaths.setSuffixOfPathsGroup(suffixPaths);
+    this.targetPaths.generateFullPathsFromPathsGroup();
+  }
+
   public void setViewExpressions(List<ViewExpression> viewExpressions) {
     this.viewExpressions = viewExpressions;
   }
 
-//   public void setTargetIntoItem(IntoItem intoItem) {
-//     this.targetPaths.setViewPathType(ViewPathType.BATCH_GENERATION);
-//     this.batchGenerationItem = intoItem;
-//   }
-// 
-//   public void parseIntoItemIfNecessary() {
-//     if (this.batchGenerationItem != null) {
-//       List<Expression> sourceExpressionList = this.getSourceExpressionList();
-//       IntoComponent intoComponent =
-//           new IntoComponent(Collections.singletonList(this.batchGenerationItem));
-//       intoComponent.validate(sourceExpressionList);
-//       IntoComponent.IntoPathIterator intoPathIterator = intoComponent.getIntoPathIterator();
-//       List<PartialPath> targetPathsList = new ArrayList<>();
-//       for (Expression sourceColumn : sourceExpressionList) {
-//         PartialPath deviceTemplate = intoPathIterator.getDeviceTemplate();
-//         String measurementTemplate = intoPathIterator.getMeasurementTemplate();
-// 
-//         if (sourceColumn instanceof TimeSeriesOperand) {
-//           PartialPath sourcePath = ((TimeSeriesOperand) sourceColumn).getPath();
-//           targetPathsList.add(
-//               SelectIntoUtils.constructTargetPath(sourcePath, deviceTemplate, measurementTemplate));
-//         } else {
+  public void setTargetIntoItem(IntoItem intoItem) {
+    this.targetPaths.setViewPathType(ViewPathType.BATCH_GENERATION);
+    this.batchGenerationItem = intoItem;
+  }
+
+  public void parseIntoItemIfNecessary() {
+    if (this.batchGenerationItem != null) {
+      List<Expression> sourceExpressionList = this.getSourceExpressionList();
+      IntoComponent intoComponent =
+          new IntoComponent(Collections.singletonList(this.batchGenerationItem));
+      intoComponent.validate(sourceExpressionList);
+      IntoComponent.IntoPathIterator intoPathIterator = intoComponent.getIntoPathIterator();
+      List<PartialPath> targetPathsList = new ArrayList<>();
+      for (Expression sourceColumn : sourceExpressionList) {
+        PartialPath deviceTemplate = intoPathIterator.getDeviceTemplate();
+        String measurementTemplate = intoPathIterator.getMeasurementTemplate();
+
+        if (sourceColumn instanceof TimeSeriesOperand) {
+          PartialPath sourcePath = ((TimeSeriesOperand) sourceColumn).getPath();
+          targetPathsList.add(
+              SelectIntoUtils.constructTargetPath(sourcePath, deviceTemplate, measurementTemplate));
+        } else {
           throw new SemanticException(
+              new UnsupportedViewException(
+                  "Cannot create views using data sources with calculated expressions while using into item."));
+        }
+      }
+      this.targetPaths.setFullPathList(targetPathsList);
+    }
+  }
+
   public IntoItem getBatchGenerationItem() {
     return batchGenerationItem;
   }
-//               new UnsupportedViewException(
-//                   "Cannot create views using data sources with calculated expressions while using into item."));
-//         }
-//       }
-//       this.targetPaths.setFullPathList(targetPathsList);
-//     }
-//   }
-// 
-//   // endregion
-// 
-//   // region Interfaces for checking
-//   /**
-//    * Check errors in targetPaths.
-//    *
+
+  // endregion
+
+  // region Interfaces for checking
+  /**
+   * Check errors in targetPaths.
+   *
    * @return Pair {@literal <}Boolean, String{@literal >}. True: checks passed; False: checks
    *     failed. If check failed, return the string of illegal path.
-//    */
-//   public Pair<Boolean, String> checkTargetPaths() {
-//     for (PartialPath thisPath : this.getTargetPathList()) {
-//       if (thisPath.getNodeLength() < 3) {
-//         return new Pair<>(false, thisPath.getFullPath());
-//       }
-//     }
-//     return new Pair<>(true, null);
-//   }
-// 
-//   /**
+   */
+  public Pair<Boolean, String> checkTargetPaths() {
+    for (PartialPath thisPath : this.getTargetPathList()) {
+      if (thisPath.getNodeLength() < 3) {
+        return new Pair<>(false, thisPath.getFullPath());
+      }
+    }
+    return new Pair<>(true, null);
+  }
+
+  /**
    * Check errors in sourcePaths. Only usable when not using read statement. If this statement is
    * generated with a read statement, check always pass; if not, check each full paths.
-//    *
+   *
    * @return Pair {@literal <}Boolean, String{@literal >}. True: checks passed; False: checks
    *     failed. If check failed, return the string of illegal path.
-//    */
-//   public Pair<Boolean, String> checkSourcePathsIfNotUsingQueryStatement() {
-//     if (this.sourcePaths.viewPathType == ViewPathType.PATHS_GROUP
-//         || this.sourcePaths.viewPathType == ViewPathType.FULL_PATH_LIST) {
-//       for (PartialPath thisPath : this.sourcePaths.fullPathList) {
-//         if (thisPath.getNodeLength() < 3) {
-//           return new Pair<>(false, thisPath.getFullPath());
-//         }
-//       }
-//     }
-//     return new Pair<>(true, null);
-//   }
-// 
-//   /**
+   */
+  public Pair<Boolean, String> checkSourcePathsIfNotUsingQueryStatement() {
+    if (this.sourcePaths.viewPathType == ViewPathType.PATHS_GROUP
+        || this.sourcePaths.viewPathType == ViewPathType.FULL_PATH_LIST) {
+      for (PartialPath thisPath : this.sourcePaths.fullPathList) {
+        if (thisPath.getNodeLength() < 3) {
+          return new Pair<>(false, thisPath.getFullPath());
+        }
+      }
+    }
+    return new Pair<>(true, null);
+  }
+
+  /**
    * @return return {@link true} if checks passed; else return {@link false}. If check failed,
    *     return the string of illegal path.
-//    */
-//   public Pair<Boolean, String> checkAllPaths() {
-//     Pair<Boolean, String> result = this.checkTargetPaths();
+   */
+  public Pair<Boolean, String> checkAllPaths() {
+    Pair<Boolean, String> result = this.checkTargetPaths();
     if (Boolean.FALSE.equals(result.left)) {
       return result;
     }
-//     result = this.checkSourcePathsIfNotUsingQueryStatement();
+    result = this.checkSourcePathsIfNotUsingQueryStatement();
     if (Boolean.FALSE.equals(result.left)) {
       return result;
     }
+    return new Pair<>(true, null);
+  }
+
+  // endregion
+
+  @Override
+  public <R, C> R accept(StatementVisitor<R, C> visitor, C context) {
+    return visitor.visitCreateLogicalView(this, context);
+  }
 
   public boolean isCanSeeAuditDB() {
     return canSeeAuditDB;
@@ -296,13 +263,4 @@ import java.util.Objects;
   public void setCanSeeAuditDB(boolean canSeeAuditDB) {
     this.canSeeAuditDB = canSeeAuditDB;
   }
-//     return new Pair<>(true, null);
-//   }
-// 
-//   // endregion
-// 
-//   @Override
-//   public <R, C> R accept(StatementVisitor<R, C> visitor, C context) {
-//     return visitor.visitCreateLogicalView(this, context);
-//   }
-// }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java
index eebad32f354..a9b002bbd6d 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/ISchemaRegion.java
@@ -119,34 +119,34 @@ public interface ISchemaRegion {
   // endregion
 
   // region Interfaces for Timeseries operation
-//   /**
-//    * Create timeseries.
-//    *
-//    * @param plan a plan describes how to create the timeseries.
-//    * @param offset
-//    * @throws MetadataException
-//    */
+  /**
+   * Create timeseries.
+   *
+   * @param plan a plan describes how to create the timeseries.
+   * @param offset
+   * @throws MetadataException
+   */
   void createTimeSeries(final ICreateTimeSeriesPlan plan, final long offset)
       throws MetadataException;
 
-//   /**
-//    * Create aligned timeseries.
-//    *
-//    * @param plan a plan describes how to create the timeseries.
-//    * @throws MetadataException
-//    */
+  /**
+   * Create aligned timeseries.
+   *
+   * @param plan a plan describes how to create the timeseries.
+   * @throws MetadataException
+   */
   void createAlignedTimeSeries(final ICreateAlignedTimeSeriesPlan plan) throws MetadataException;
 
-//   /**
-//    * Check whether measurement exists.
-//    *
-//    * @param devicePath the path of device that you want to check
-//    * @param measurementList a list of measurements that you want to check
-//    * @param aliasList a list of alias that you want to check
-//    * @return returns a map contains index of the measurements or alias that threw the exception, and
-//    *     exception details. The exceptions describe whether the measurement or alias exists. For
-//    *     example, a MeasurementAlreadyExistException means this measurement exists.
-//    */
+  /**
+   * Check whether measurement exists.
+   *
+   * @param devicePath the path of device that you want to check
+   * @param measurementList a list of measurements that you want to check
+   * @param aliasList a list of alias that you want to check
+   * @return returns a map contains index of the measurements or alias that threw the exception, and
+   *     exception details. The exceptions describe whether the measurement or alias exists. For
+   *     example, a MeasurementAlreadyExistException means this measurement exists.
+   */
   Map<Integer, MetadataException> checkMeasurementExistence(
       final PartialPath devicePath,
       final List<String> measurementList,
@@ -210,7 +210,7 @@ public interface ISchemaRegion {
 
   // endregion
 
-//   // region Interfaces for Logical View
+  // region Interfaces for Logical View
   void createLogicalView(final ICreateLogicalViewPlan createLogicalViewPlan)
       throws MetadataException;
 
@@ -222,8 +222,8 @@ public interface ISchemaRegion {
 
   void alterLogicalView(final IAlterLogicalViewPlan alterLogicalViewPlan) throws MetadataException;
 
-//   // endregion
-// 
+  // endregion
+
   // region Interfaces for metadata info Query
 
   // region Interfaces for timeSeries, measurement and schema info Query
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanType.java
index bec218e6f18..9808a19143b 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanType.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanType.java
@@ -44,8 +44,8 @@ public enum SchemaRegionPlanType {
   PRE_DEACTIVATE_TEMPLATE((byte) 0),
   ROLLBACK_PRE_DEACTIVATE_TEMPLATE((byte) 1),
   DEACTIVATE_TEMPLATE((byte) 2),
-//   // logical view
-//   CREATE_LOGICAL_VIEW((byte) 66),
+  // logical view
+  CREATE_LOGICAL_VIEW((byte) 66),
   PRE_DELETE_LOGICAL_VIEW((byte) 67),
   ROLLBACK_PRE_DELETE_LOGICAL_VIEW((byte) 68),
   DELETE_LOGICAL_VIEW((byte) 69),
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanVisitor.java
index 9002982f501..b0514d7d542 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/SchemaRegionPlanVisitor.java
@@ -107,11 +107,11 @@ public abstract class SchemaRegionPlanVisitor<R, C> {
       final IDeactivateTemplatePlan deactivateTemplatePlan, final C context) {
     return visitSchemaRegionPlan(deactivateTemplatePlan, context);
   }
-// 
+
   public R visitCreateLogicalView(
       final ICreateLogicalViewPlan createLogicalViewPlan, final C context) {
-//     return visitSchemaRegionPlan(createLogicalViewPlan, context);
-//   }
+    return visitSchemaRegionPlan(createLogicalViewPlan, context);
+  }
 
   public R visitAlterLogicalView(
       final IAlterLogicalViewPlan alterLogicalViewPlan, final C context) {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
index 08a2d62ed3a..fbb407d3338 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
@@ -32,7 +32,7 @@ import org.apache.iotdb.commons.schema.node.role.IMeasurementMNode;
 import org.apache.iotdb.commons.schema.table.TsTable;
 import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema;
 import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.commons.utils.FileUtils;
 import org.apache.iotdb.commons.utils.PathUtils;
 import org.apache.iotdb.consensus.ConsensusFactory;
@@ -956,13 +956,13 @@ public class SchemaRegionMemoryImpl implements ISchemaRegion {
     }
   }
 
-//   @Override
+  @Override
   public void createLogicalView(final ICreateLogicalViewPlan plan) throws MetadataException {
-//     if (!regionStatistics.isAllowToCreateNewSeries()) {
+    if (!regionStatistics.isAllowToCreateNewSeries()) {
       throw new SeriesOverflowException(
           regionStatistics.getGlobalMemoryUsage(), regionStatistics.getGlobalSeriesNumber());
-//     }
-// 
+    }
+
     final List<PartialPath> pathList = plan.getViewPathList();
     final Map<PartialPath, ViewExpression> viewPathToSourceMap =
         plan.getViewPathToSourceExpressionMap();
@@ -973,11 +973,11 @@ public class SchemaRegionMemoryImpl implements ISchemaRegion {
     // write log
     if (!isRecovering) {
       writeToMLog(plan);
-//     }
-//     // update statistics
+    }
+    // update statistics
     regionStatistics.addView(1L);
-//   }
-// 
+  }
+
   @Override
   public long constructLogicalViewBlackList(PathPatternTree patternTree) throws MetadataException {
     long preDeletedNum = 0;
@@ -1906,17 +1906,17 @@ public class SchemaRegionMemoryImpl implements ISchemaRegion {
         return new RecoverOperationResult(e);
       }
     }
-// 
+
     @Override
-//     public RecoverOperationResult visitCreateLogicalView(
+    public RecoverOperationResult visitCreateLogicalView(
         final ICreateLogicalViewPlan createLogicalViewPlan, final SchemaRegionMemoryImpl context) {
-//       try {
-//         createLogicalView(createLogicalViewPlan);
-//         return RecoverOperationResult.SUCCESS;
+      try {
+        createLogicalView(createLogicalViewPlan);
+        return RecoverOperationResult.SUCCESS;
       } catch (final MetadataException e) {
-//         return new RecoverOperationResult(e);
-//       }
-//     }
+        return new RecoverOperationResult(e);
+      }
+    }
 
     @Override
     public RecoverOperationResult visitPreDeleteLogicalView(
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java
index 7f52fcad2c5..0e180b2029b 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionPBTreeImpl.java
@@ -940,7 +940,7 @@ public class SchemaRegionPBTreeImpl implements ISchemaRegion {
     }
   }
 
-//   @Override
+  @Override
   public void createLogicalView(ICreateLogicalViewPlan plan) throws MetadataException {
     while (!regionStatistics.isAllowToCreateNewSeries()) {
       ReleaseFlushMonitor.getInstance().waitIfReleasing();
@@ -961,8 +961,8 @@ public class SchemaRegionPBTreeImpl implements ISchemaRegion {
     } catch (IOException e) {
       throw new MetadataException(e);
     }
-//   }
-// 
+  }
+
   @Override
   public long constructLogicalViewBlackList(PathPatternTree patternTree) throws MetadataException {
     long preDeletedNum = 0;
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanDeserializer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanDeserializer.java
index 9a48b9e15fb..258f271cc9d 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanDeserializer.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanDeserializer.java
@@ -23,7 +23,7 @@ import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.path.MeasurementPath;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.path.PathDeserializeUtil;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeType;
 import org.apache.iotdb.db.queryengine.plan.relational.planner.node.schema.ConstructTableDevicesBlackListNode;
 import org.apache.iotdb.db.queryengine.plan.relational.planner.node.schema.CreateOrUpdateTableDeviceNode;
@@ -362,28 +362,28 @@ public class SchemaRegionPlanDeserializer implements IDeserializer<ISchemaRegion
       }
       return result;
     }
-// 
-//     @Override
-//     public ISchemaRegionPlan visitCreateLogicalView(
+
+    @Override
+    public ISchemaRegionPlan visitCreateLogicalView(
         final ICreateLogicalViewPlan createLogicalViewPlan, final ByteBuffer buffer) {
-// 
+
       final int viewSize = buffer.getInt();
       final Map<PartialPath, ViewExpression> viewPathToSourceMap = new HashMap<>();
-//       for (int i = 0; i < viewSize; i++) {
+      for (int i = 0; i < viewSize; i++) {
         final int byteSizeOfPath = buffer.getInt();
         final byte[] bytesOfPath = new byte[byteSizeOfPath];
-//         buffer.get(bytesOfPath);
-//         try {
+        buffer.get(bytesOfPath);
+        try {
           final PartialPath thisPath = new PartialPath(new String(bytesOfPath));
-//           ViewExpression thisExp = ViewExpression.deserialize(buffer);
-//           viewPathToSourceMap.put(thisPath, thisExp);
+          ViewExpression thisExp = ViewExpression.deserialize(buffer);
+          viewPathToSourceMap.put(thisPath, thisExp);
         } catch (final IllegalPathException e) {
-//           LOGGER.error("Cannot deserialize SchemaRegionPlan from buffer", e);
-//         }
-//       }
-//       createLogicalViewPlan.setViewPathToSourceExpressionMap(viewPathToSourceMap);
-//       return createLogicalViewPlan;
-//     }
+          LOGGER.error("Cannot deserialize SchemaRegionPlan from buffer", e);
+        }
+      }
+      createLogicalViewPlan.setViewPathToSourceExpressionMap(viewPathToSourceMap);
+      return createLogicalViewPlan;
+    }
 
     @Override
     public ISchemaRegionPlan visitPreDeleteLogicalView(
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanSerializer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanSerializer.java
index be8147589ef..63854468b34 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanSerializer.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanSerializer.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.schemaengine.schemaregion.logfile.visitor;
 
 import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
 import org.apache.iotdb.db.queryengine.plan.relational.planner.node.schema.ConstructTableDevicesBlackListNode;
 import org.apache.iotdb.db.queryengine.plan.relational.planner.node.schema.CreateOrUpdateTableDeviceNode;
@@ -421,32 +421,32 @@ public class SchemaRegionPlanSerializer implements ISerializer<ISchemaRegionPlan
         }
       }
     }
-// 
-//     @Override
-//     public SchemaRegionPlanSerializationResult visitCreateLogicalView(
+
+    @Override
+    public SchemaRegionPlanSerializationResult visitCreateLogicalView(
         final ICreateLogicalViewPlan createLogicalViewPlan,
         final DataOutputStream dataOutputStream) {
-//       try {
+      try {
         final int viewSize = createLogicalViewPlan.getViewSize();
-//         // serialize size of views
-//         dataOutputStream.writeInt(viewSize);
+        // serialize size of views
+        dataOutputStream.writeInt(viewSize);
         final List<PartialPath> viewPAthList = createLogicalViewPlan.getViewPathList();
         final Map<PartialPath, ViewExpression> viewPathToSourceMap =
-//             createLogicalViewPlan.getViewPathToSourceExpressionMap();
-//         for (int i = 0; i < viewSize; i++) {
+            createLogicalViewPlan.getViewPathToSourceExpressionMap();
+        for (int i = 0; i < viewSize; i++) {
           final PartialPath thisPath = viewPAthList.get(i);
           final ViewExpression thisExp = viewPathToSourceMap.get(thisPath);
-//           // for each view, serialize info of it
+          // for each view, serialize info of it
           final byte[] bytes = thisPath.getFullPath().getBytes();
-//           dataOutputStream.writeInt(bytes.length);
-//           dataOutputStream.write(bytes);
-//           ViewExpression.serialize(thisExp, dataOutputStream);
-//         }
-//         return SchemaRegionPlanSerializationResult.SUCCESS;
+          dataOutputStream.writeInt(bytes.length);
+          dataOutputStream.write(bytes);
+          ViewExpression.serialize(thisExp, dataOutputStream);
+        }
+        return SchemaRegionPlanSerializationResult.SUCCESS;
       } catch (final IOException e) {
-//         return new SchemaRegionPlanSerializationResult(e);
-//       }
-//     }
+        return new SchemaRegionPlanSerializationResult(e);
+      }
+    }
 
     @Override
     public SchemaRegionPlanSerializationResult visitPreDeleteLogicalView(
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanTxtSerializer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanTxtSerializer.java
index 379a27c260e..1dfb74b0b75 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanTxtSerializer.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/visitor/SchemaRegionPlanTxtSerializer.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.schemaengine.schemaregion.logfile.visitor;
 
 import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.schemaengine.schemaregion.ISchemaRegionPlan;
 import org.apache.iotdb.db.schemaengine.schemaregion.SchemaRegionPlanVisitor;
 import org.apache.iotdb.db.schemaengine.schemaregion.logfile.ISerializer;
@@ -247,25 +247,25 @@ public class SchemaRegionPlanTxtSerializer implements ISerializer<ISchemaRegionP
       templateSetInfo.forEach((k, v) -> stringBuilder.append(k).append(": ").append(v).append(";"));
       stringBuilder.append("}");
     }
-// 
-//     @Override
-//     public Void visitCreateLogicalView(
-//         ICreateLogicalViewPlan createLogicalViewPlan, StringBuilder stringBuilder) {
-//       int viewSize = createLogicalViewPlan.getViewSize();
-//       List<PartialPath> viewPathList = createLogicalViewPlan.getViewPathList();
-//       Map<PartialPath, ViewExpression> viewPathToSourceMap =
-//           createLogicalViewPlan.getViewPathToSourceExpressionMap();
-//       for (int i = 0; i < viewSize; i++) {
-//         PartialPath thisPath = viewPathList.get(i);
-//         ViewExpression thisExp = viewPathToSourceMap.get(thisPath);
-//         stringBuilder.append(thisPath).append(FIELD_SEPARATOR).append(thisExp.toString());
-//         if (i + 1 >= viewSize) {
-//           break;
-//         }
-//         stringBuilder.append(FIELD_SEPARATOR);
-//       }
-//       return null;
-//     }
+
+    @Override
+    public Void visitCreateLogicalView(
+        ICreateLogicalViewPlan createLogicalViewPlan, StringBuilder stringBuilder) {
+      int viewSize = createLogicalViewPlan.getViewSize();
+      List<PartialPath> viewPathList = createLogicalViewPlan.getViewPathList();
+      Map<PartialPath, ViewExpression> viewPathToSourceMap =
+          createLogicalViewPlan.getViewPathToSourceExpressionMap();
+      for (int i = 0; i < viewSize; i++) {
+        PartialPath thisPath = viewPathList.get(i);
+        ViewExpression thisExp = viewPathToSourceMap.get(thisPath);
+        stringBuilder.append(thisPath).append(FIELD_SEPARATOR).append(thisExp.toString());
+        if (i + 1 >= viewSize) {
+          break;
+        }
+        stringBuilder.append(FIELD_SEPARATOR);
+      }
+      return null;
+    }
 
     @Override
     public Void visitPreDeleteLogicalView(
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
index 72e9514f494..387d8c66431 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
@@ -30,8 +30,8 @@ import org.apache.iotdb.commons.schema.node.role.IDeviceMNode;
 import org.apache.iotdb.commons.schema.node.role.IMeasurementMNode;
 import org.apache.iotdb.commons.schema.node.utils.IMNodeFactory;
 import org.apache.iotdb.commons.schema.node.utils.IMNodeIterator;
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.exception.metadata.AliasAlreadyExistException;
 import org.apache.iotdb.db.exception.metadata.MNodeTypeMismatchException;
@@ -279,13 +279,6 @@ public class MTreeBelowSGMemoryImpl {
         }
       }
 
-//       if (device.isDevice()
-//           && device.getAsDeviceMNode().isAlignedNullable() != null
-//           && device.getAsDeviceMNode().isAligned()) {
-        throw new AlignedTimeseriesException(
-            "time series under this device is aligned, please use createAlignedTimeseries or change device.",
-            device.getFullPath());
-      }
       final IDeviceMNode<IMemMNode> entityMNode;
       if (device.isDevice()) {
         entityMNode = device.getAsDeviceMNode();
@@ -293,10 +286,11 @@ public class MTreeBelowSGMemoryImpl {
         entityMNode = store.setToEntity(device);
       }
 
-//       if (entityMNode.isAlignedNullable() == null) {
-//         entityMNode.setAligned(false);
-//       }
-// 
+      // create a non-aligned time series
+      if (entityMNode.isAlignedNullable() == null) {
+        entityMNode.setAligned(false);
+      }
+
       final IMeasurementMNode<IMemMNode> measurementMNode =
           nodeFactory.createMeasurementMNode(
               entityMNode,
@@ -371,14 +365,6 @@ public class MTreeBelowSGMemoryImpl {
         }
       }
 
-//       if (device.isDevice()
-//           && device.getAsDeviceMNode().isAlignedNullable() != null
-//           && !device.getAsDeviceMNode().isAligned()) {
-        throw new AlignedTimeseriesException(
-            "Time series under this device is not aligned, please use createTimeSeries or change device.",
-            devicePath.getFullPath());
-      }
-
       final IDeviceMNode<IMemMNode> entityMNode;
       if (device.isDevice()) {
         entityMNode = device.getAsDeviceMNode();
@@ -388,10 +374,10 @@ public class MTreeBelowSGMemoryImpl {
       }
 
       // create an aligned time series
-//       if (entityMNode.isAlignedNullable() == null) {
-//         entityMNode.setAligned(true);
-//       }
-// 
+      if (entityMNode.isAlignedNullable() == null) {
+        entityMNode.setAligned(true);
+      }
+
       for (int i = 0; i < measurements.size(); i++) {
         if (existingMeasurementIndexes.contains(i)) {
           continue;
@@ -585,17 +571,17 @@ public class MTreeBelowSGMemoryImpl {
     IMemMNode curNode = entityMNode.getAsMNode();
     if (!entityMNode.isUseTemplate()) {
       boolean hasMeasurement = false;
-//       boolean hasNonViewMeasurement = false;
+      boolean hasNonViewMeasurement = false;
       IMemMNode child;
       IMNodeIterator<IMemMNode> iterator = store.getChildrenIterator(curNode);
       while (iterator.hasNext()) {
         child = iterator.next();
         if (child.isMeasurement()) {
           hasMeasurement = true;
-//           if (!child.getAsMeasurementMNode().isLogicalView()) {
-//             hasNonViewMeasurement = true;
-//             break;
-//           }
+          if (!child.getAsMeasurementMNode().isLogicalView()) {
+            hasNonViewMeasurement = true;
+            break;
+          }
         }
       }
 
@@ -603,9 +589,9 @@ public class MTreeBelowSGMemoryImpl {
         synchronized (this) {
           curNode = store.setToInternal(entityMNode);
         }
-//       } else if (!hasNonViewMeasurement) {
-//         // has some measurement but they are all logical view
-//         entityMNode.setAligned(null);
+      } else if (!hasNonViewMeasurement) {
+        // has some measurement but they are all logical view
+        entityMNode.setAligned(null);
       }
     }
 
@@ -1375,8 +1361,8 @@ public class MTreeBelowSGMemoryImpl {
               }
 
               @Override
-//               public IMeasurementSchema getSchema() {
-//                 return node.getSchema();
+              public IMeasurementSchema getSchema() {
+                return node.getSchema();
               }
 
               @Override
@@ -1400,11 +1386,11 @@ public class MTreeBelowSGMemoryImpl {
                 return getParentOfNextMatchedNode().getAsDeviceMNode().isAligned();
               }
 
-//               @Override
-//               public boolean isLogicalView() {
-//                 return node.isLogicalView();
-//               }
-// 
+              @Override
+              public boolean isLogicalView() {
+                return node.isLogicalView();
+              }
+
               @Override
               public String getFullPath() {
                 return getPartialPathFromRootToNode(node.getAsMNode()).getFullPath();
@@ -1493,58 +1479,58 @@ public class MTreeBelowSGMemoryImpl {
   }
 
   // endregion
-// 
-//   // region interfaces for logical view
-//   public IMeasurementMNode<IMemMNode> createLogicalView(
+
+  // region interfaces for logical view
+  public IMeasurementMNode<IMemMNode> createLogicalView(
       final PartialPath path, final ViewExpression viewExpression) throws MetadataException {
-//     // check path
+    // check path
     final String[] nodeNames = path.getNodes();
-//     if (nodeNames.length <= 2) {
-//       throw new IllegalPathException(path.getFullPath());
-//     }
-//     MetaFormatUtils.checkTimeseries(path);
+    if (nodeNames.length <= 2) {
+      throw new IllegalPathException(path.getFullPath());
+    }
+    MetaFormatUtils.checkTimeseries(path);
     final PartialPath devicePath = path.getDevicePath();
     final IMemMNode deviceParent = checkAndAutoCreateInternalPath(devicePath);
-// 
-//     synchronized (this) {
+
+    synchronized (this) {
       final String leafName = path.getMeasurement();
       final IMeasurementMNode<IMemMNode> measurementMNode =
           nodeFactory.createLogicalViewMNode(
               null, leafName, new LogicalViewSchema(leafName, viewExpression));
       final IMemMNode device = checkAndAutoCreateDeviceNode(devicePath.getTailNode(), deviceParent);
-// 
-//       // no need to check alias, because logical view has no alias
-// 
-//       if (device.hasChild(leafName)) {
+
+      // no need to check alias, because logical view has no alias
+
+      if (device.hasChild(leafName)) {
         final IMemMNode node = device.getChild(leafName);
-//         if (node.isMeasurement()) {
-//           if (node.getAsMeasurementMNode().isPreDeleted()) {
-//             throw new MeasurementInBlackListException(path);
-//           } else {
-//             throw new MeasurementAlreadyExistException(
-//                 path.getFullPath(), node.getAsMeasurementMNode().getMeasurementPath());
-//           }
-//         } else {
-//           throw new PathAlreadyExistException(path.getFullPath());
-//         }
-//       }
-// 
+        if (node.isMeasurement()) {
+          if (node.getAsMeasurementMNode().isPreDeleted()) {
+            throw new MeasurementInBlackListException(path);
+          } else {
+            throw new MeasurementAlreadyExistException(
+                path.getFullPath(), node.getAsMeasurementMNode().getMeasurementPath());
+          }
+        } else {
+          throw new PathAlreadyExistException(path.getFullPath());
+        }
+      }
+
       final IDeviceMNode<IMemMNode> entityMNode;
-//       if (device.isDevice()) {
-//         entityMNode = device.getAsDeviceMNode();
-//       } else {
-//         entityMNode = store.setToEntity(device);
-//         // this parent has no measurement before. The leafName is his first child who is a logical
-//         // view.
-//         entityMNode.setAligned(null);
-//       }
-// 
+      if (device.isDevice()) {
+        entityMNode = device.getAsDeviceMNode();
+      } else {
+        entityMNode = store.setToEntity(device);
+        // this parent has no measurement before. The leafName is his first child who is a logical
+        // view.
+        entityMNode.setAligned(null);
+      }
+
       measurementMNode.setParent(entityMNode.getAsMNode());
-//       store.addChild(entityMNode.getAsMNode(), leafName, measurementMNode.getAsMNode());
-// 
-//       return measurementMNode;
-//     }
-//   }
+      store.addChild(entityMNode.getAsMNode(), leafName, measurementMNode.getAsMNode());
+
+      return measurementMNode;
+    }
+  }
 
   public List<PartialPath> constructLogicalViewBlackList(final PartialPath pathPattern)
       throws MetadataException {
@@ -1818,5 +1804,5 @@ public class MTreeBelowSGMemoryImpl {
     return true;
   }
 
-//   // endregion
+  // endregion
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/factory/MemMNodeFactory.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/factory/MemMNodeFactory.java
index 19416d049f0..19e24ed87b9 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/factory/MemMNodeFactory.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/factory/MemMNodeFactory.java
@@ -69,10 +69,10 @@ public class MemMNodeFactory implements IMNodeFactory<IMemMNode> {
   public IMemMNode createInternalMNode(IMemMNode parent, String name) {
     return new BasicInternalMNode(parent, name);
   }
-// 
-//   @Override
-//   public IMeasurementMNode<IMemMNode> createLogicalViewMNode(
+
+  @Override
+  public IMeasurementMNode<IMemMNode> createLogicalViewMNode(
       IDeviceMNode<IMemMNode> parent, String name, IMeasurementSchema measurementSchema) {
     throw new UnsupportedOperationException("View is not supported.");
-//   }
+  }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/impl/MeasurementMNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/impl/MeasurementMNode.java
index 5840350670a..a40cbe6bc0f 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/impl/MeasurementMNode.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/impl/MeasurementMNode.java
@@ -47,9 +47,9 @@ public class MeasurementMNode extends AbstractMeasurementMNode<IMemMNode, BasicM
   public IMNodeContainer<IMemMNode> getChildren() {
     return MemMNodeContainer.emptyMNodeContainer();
   }
-// 
-//   @Override
-//   public final boolean isLogicalView() {
-//     return false;
-//   }
+
+  @Override
+  public final boolean isLogicalView() {
+    return false;
+  }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/LogicalViewInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/LogicalViewInfo.java
index bd9158ea8da..a5ab55796e4 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/LogicalViewInfo.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/LogicalViewInfo.java
@@ -1,170 +1,170 @@
-// /*
-//  * 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.
-//  */
-// 
+/*
+ * 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.schemaengine.schemaregion.mtree.impl.mem.mnode.info;
-// 
-// import org.apache.iotdb.commons.exception.IllegalPathException;
+
+import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.exception.runtime.SchemaExecutionException;
 import org.apache.iotdb.commons.path.MeasurementPath;
-// import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.node.info.IMeasurementInfo;
-// import org.apache.iotdb.commons.schema.node.role.IMeasurementMNode;
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand;
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.schema.node.info.IMeasurementInfo;
+import org.apache.iotdb.commons.schema.node.role.IMeasurementMNode;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpressionType;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand;
 
 import org.apache.tsfile.enums.TSDataType;
 import org.apache.tsfile.write.schema.IMeasurementSchema;
-// 
-// /**
-//  * This structure is used in ViewMNode. It stores all information except the name of this view. The
-//  * name of the view is stored by ViewMNode.
-//  */
-// public class LogicalViewInfo implements IMeasurementInfo {
-// 
+
+/**
+ * This structure is used in ViewMNode. It stores all information except the name of this view. The
+ * name of the view is stored by ViewMNode.
+ */
+public class LogicalViewInfo implements IMeasurementInfo {
+
   /** tag/attribute's start offset in tag file */
   private long offset = -1;
 
-//   /** whether this measurement is pre deleted and considered in black list */
-//   private boolean preDeleted = false;
-// 
-//   private LogicalViewSchema schema;
-// 
-//   public LogicalViewInfo(LogicalViewSchema schema) {
-//     this.schema = schema;
-//   }
-// 
-//   // region logical view interfaces
-//   public boolean isAliasSeries() {
-//     if (this.getExpression() != null) {
-//       if (this.getExpression().isSourceForAliasSeries()) {
-//         return true;
-//       }
-//     }
-//     return false;
-//   }
-// 
+  /** whether this measurement is pre deleted and considered in black list */
+  private boolean preDeleted = false;
+
+  private LogicalViewSchema schema;
+
+  public LogicalViewInfo(LogicalViewSchema schema) {
+    this.schema = schema;
+  }
+
+  // region logical view interfaces
+  public boolean isAliasSeries() {
+    if (this.getExpression() != null) {
+      if (this.getExpression().isSourceForAliasSeries()) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   /**
    * @return return the path of alias series if this view is alias series; else return null.
    */
-//   public PartialPath getAliasSeriesPath() {
-//     if (this.isAliasSeries()) {
-//       if (this.getExpression().getExpressionType() == ViewExpressionType.TIMESERIES) {
-//         String pathString = ((TimeSeriesViewOperand) this.getExpression()).getPathString();
-//         try {
+  public PartialPath getAliasSeriesPath() {
+    if (this.isAliasSeries()) {
+      if (this.getExpression().getExpressionType() == ViewExpressionType.TIMESERIES) {
+        String pathString = ((TimeSeriesViewOperand) this.getExpression()).getPathString();
+        try {
           return new MeasurementPath(pathString);
-//         } catch (IllegalPathException e) {
-//           throw new RuntimeException(e);
-//         }
-//       }
-//     }
-//     return null;
-//   }
-// 
-//   public ViewExpression getExpression() {
-//     return this.schema.getExpression();
-//   }
-// 
-//   public void setExpression(ViewExpression expression) {
-//     this.schema.setExpression(expression);
-//   }
-
-//   // endregion
-// 
-//   // region IMeasurementInfo interfaces
-// 
-//   @Override
-//   public IMeasurementSchema getSchema() {
-//     return this.schema;
-//   }
-// 
-//   @Override
-//   public void setSchema(IMeasurementSchema schema) {
-//     if (schema.isLogicalView()) {
-//       this.schema = (LogicalViewSchema) schema;
-//     }
-//   }
-// 
-//   @Override
-//   public TSDataType getDataType() {
-//     return null;
-//   }
-// 
-//   @Override
-//   public String getAlias() {
-//     return null;
-//   }
-// 
-//   @Override
-//   public void setAlias(String alias) {
-//     // can not set alias for a logical view
+        } catch (IllegalPathException e) {
+          throw new RuntimeException(e);
+        }
+      }
+    }
+    return null;
+  }
+
+  public ViewExpression getExpression() {
+    return this.schema.getExpression();
+  }
+
+  public void setExpression(ViewExpression expression) {
+    this.schema.setExpression(expression);
+  }
+
+  // endregion
+
+  // region IMeasurementInfo interfaces
+
+  @Override
+  public IMeasurementSchema getSchema() {
+    return this.schema;
+  }
+
+  @Override
+  public void setSchema(IMeasurementSchema schema) {
+    if (schema.isLogicalView()) {
+      this.schema = (LogicalViewSchema) schema;
+    }
+  }
+
+  @Override
+  public TSDataType getDataType() {
+    return null;
+  }
+
+  @Override
+  public String getAlias() {
+    return null;
+  }
+
+  @Override
+  public void setAlias(String alias) {
+    // can not set alias for a logical view
     throw new UnsupportedOperationException("View doesn't support alias");
-//   }
-// 
-//   @Override
-//   public long getOffset() {
-//     // tag/attribute's start offset in tag file
+  }
+
+  @Override
+  public long getOffset() {
+    // tag/attribute's start offset in tag file
     return offset;
-//   }
-// 
-//   @Override
-//   public void setOffset(long offset) {
+  }
+
+  @Override
+  public void setOffset(long offset) {
     this.offset = offset;
-//   }
-// 
-//   @Override
-//   public boolean isPreDeleted() {
-//     return this.preDeleted;
-//   }
-// 
-//   @Override
-//   public void setPreDeleted(boolean preDeleted) {
-//     this.preDeleted = preDeleted;
-//   }
-// 
-//   /**
-//    * The memory occupied by an MeasurementInfo based occupation
-//    *
-//    * <ol>
-//    *   <li>object header, 8B
+  }
+
+  @Override
+  public boolean isPreDeleted() {
+    return this.preDeleted;
+  }
+
+  @Override
+  public void setPreDeleted(boolean preDeleted) {
+    this.preDeleted = preDeleted;
+  }
+
+  /**
+   * The memory occupied by an MeasurementInfo based occupation
+   *
+   * <ol>
+   *   <li>object header, 8B
    *   <li>offset, 8B
-//    *   <li>boolean preDeleted, 1B
-//    *   <li>estimated schema size, 32B
-//    *   <li>viewExpression
-//    * </ol>
-//    */
-//   @Override
-//   public int estimateSize() {
+   *   <li>boolean preDeleted, 1B
+   *   <li>estimated schema size, 32B
+   *   <li>viewExpression
+   * </ol>
+   */
+  @Override
+  public int estimateSize() {
     return 8 + 8 + 1 + 32 + ViewExpression.getSerializeSize(schema.getExpression());
-//   }
-// 
-//   @Override
-//   public void moveDataToNewMNode(IMeasurementMNode<?> newMNode) {
+  }
+
+  @Override
+  public void moveDataToNewMNode(IMeasurementMNode<?> newMNode) {
     if (newMNode.isLogicalView()) {
       newMNode.setSchema(this.schema);
       newMNode.setPreDeleted(preDeleted);
-//     }
+    }
     throw new SchemaExecutionException(
-//         new IllegalArgumentException(
-//             "Type of newMNode is not LogicalViewMNode! It's "
+        new IllegalArgumentException(
+            "Type of newMNode is not LogicalViewMNode! It's "
                 + newMNode.getMNodeType().toString()));
-//   }
-//   // endregion
-// }
+  }
+  // endregion
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/TreeDeviceInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/TreeDeviceInfo.java
index 5c16dc4eb2f..abfbd11e8a4 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/TreeDeviceInfo.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/info/TreeDeviceInfo.java
@@ -50,7 +50,7 @@ public class TreeDeviceInfo<N extends IMNode<N>> implements IDeviceInfo<N> {
   @SuppressWarnings("squid:S3077")
   private transient volatile Map<String, IMeasurementMNode<N>> aliasChildren = null;
 
-//   private volatile Boolean isAligned = false;
+  private volatile Boolean isAligned = false;
 
   @Override
   public void moveDataToNewMNode(final IDeviceMNode<N> newMNode) {
@@ -169,7 +169,7 @@ public class TreeDeviceInfo<N extends IMNode<N>> implements IDeviceInfo<N> {
   }
 
   @Override
-//   public Boolean isAligned() {
+  public Boolean isAligned() {
     return isAligned;
   }
 
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java
index c607a78eb24..71d78712afb 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/snapshot/MemMTreeSnapshotUtil.java
@@ -29,7 +29,7 @@ import org.apache.iotdb.commons.schema.node.role.IMeasurementMNode;
 import org.apache.iotdb.commons.schema.node.utils.IMNodeFactory;
 import org.apache.iotdb.commons.schema.node.utils.IMNodeIterator;
 import org.apache.iotdb.commons.schema.node.visitor.MNodeVisitor;
-// import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
+import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 import org.apache.iotdb.commons.utils.FileUtils;
 import org.apache.iotdb.db.schemaengine.rescon.MemSchemaRegionStatistics;
 import org.apache.iotdb.db.schemaengine.schemaregion.mtree.impl.mem.MemMTreeStore;
@@ -268,11 +268,11 @@ public class MemMTreeSnapshotUtil {
         node = deserializer.deserializeMeasurementMNode(inputStream);
         measurementProcess.accept(node.getAsMeasurementMNode());
         break;
-//       case LOGICAL_VIEW_MNODE_TYPE:
-//         childrenNum = 0;
-//         node = deserializer.deserializeLogicalViewMNode(inputStream);
-//         measurementProcess.accept(node.getAsMeasurementMNode());
-//         break;
+      case LOGICAL_VIEW_MNODE_TYPE:
+        childrenNum = 0;
+        node = deserializer.deserializeLogicalViewMNode(inputStream);
+        measurementProcess.accept(node.getAsMeasurementMNode());
+        break;
       case TABLE_MNODE_TYPE:
         childrenNum = ReadWriteIOUtils.readInt(inputStream);
         node = deserializer.deserializeTableDeviceMNode(inputStream);
@@ -383,9 +383,9 @@ public class MemMTreeSnapshotUtil {
           ReadWriteIOUtils.write(node.getAlias(), outputStream);
           ReadWriteIOUtils.write(node.getOffset(), outputStream);
           ReadWriteIOUtils.write(node.isPreDeleted(), outputStream);
-//         }
+        }
         return true;
-//       } catch (Exception e) {
+      } catch (Exception e) {
         logger.error(SERIALIZE_ERROR_INFO, e);
         return false;
       }
@@ -454,16 +454,16 @@ public class MemMTreeSnapshotUtil {
       node.setPreDeleted(ReadWriteIOUtils.readBool(inputStream));
       return node.getAsMNode();
     }
-// 
-//     public IMemMNode deserializeLogicalViewMNode(InputStream inputStream) throws IOException {
-//       String name = ReadWriteIOUtils.readString(inputStream);
-//       LogicalViewSchema logicalViewSchema = LogicalViewSchema.deserializeFrom(inputStream);
+
+    public IMemMNode deserializeLogicalViewMNode(InputStream inputStream) throws IOException {
+      String name = ReadWriteIOUtils.readString(inputStream);
+      LogicalViewSchema logicalViewSchema = LogicalViewSchema.deserializeFrom(inputStream);
       long tagOffset = ReadWriteIOUtils.readLong(inputStream);
-//       IMeasurementMNode<IMemMNode> node =
+      IMeasurementMNode<IMemMNode> node =
           nodeFactory.createLogicalViewMNode(null, name, logicalViewSchema);
       node.setOffset(tagOffset);
       node.setPreDeleted(ReadWriteIOUtils.readBool(inputStream));
-//       return node.getAsMNode();
-//     }
+      return node.getAsMNode();
+    }
   }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
index b8a4cbdae28..d5187e14c91 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
@@ -1436,8 +1436,8 @@ public class MTreeBelowSGCachedImpl {
                 return node.getAlias();
               }
 
-//               public IMeasurementSchema getSchema() {
-//                 return node.getSchema();
+              public IMeasurementSchema getSchema() {
+                return node.getSchema();
               }
 
               public Map<String, String> getTags() {
@@ -1458,11 +1458,11 @@ public class MTreeBelowSGCachedImpl {
                 return getParentOfNextMatchedNode().getAsDeviceMNode().isAligned();
               }
 
-//               @Override
-//               public boolean isLogicalView() {
-//                 return node.isLogicalView();
-//               }
-// 
+              @Override
+              public boolean isLogicalView() {
+                return node.isLogicalView();
+              }
+
               public String getFullPath() {
                 return getPartialPathFromRootToNode(node.getAsMNode()).getFullPath();
               }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/factory/CacheMNodeFactory.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/factory/CacheMNodeFactory.java
index aa28ebc4da2..92da4db1948 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/factory/CacheMNodeFactory.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/factory/CacheMNodeFactory.java
@@ -69,10 +69,10 @@ public class CacheMNodeFactory implements IMNodeFactory<ICachedMNode> {
   public ICachedMNode createInternalMNode(ICachedMNode parent, String name) {
     return new CachedBasicInternalMNode(parent, name);
   }
-// 
-//   @Override
-//   public IMeasurementMNode<ICachedMNode> createLogicalViewMNode(
+
+  @Override
+  public IMeasurementMNode<ICachedMNode> createLogicalViewMNode(
       IDeviceMNode<ICachedMNode> parent, String name, IMeasurementSchema measurementSchema) {
     throw new UnsupportedOperationException("View is not supported.");
-//   }
+  }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/impl/CachedMeasurementMNode.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/impl/CachedMeasurementMNode.java
index 251f13bb32e..fff9e6150b3 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/impl/CachedMeasurementMNode.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/impl/CachedMeasurementMNode.java
@@ -69,9 +69,9 @@ public class CachedMeasurementMNode extends AbstractMeasurementMNode<ICachedMNod
   public IMNodeContainer<ICachedMNode> getChildren() {
     return CachedMNodeContainer.emptyMNodeContainer();
   }
-// 
-//   @Override
-//   public final boolean isLogicalView() {
-//     return false;
-//   }
+
+  @Override
+  public final boolean isLogicalView() {
+    return false;
+  }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java
index 9fdb8f59fa6..45fe9015b1a 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/schemafile/MockSchemaFile.java
@@ -187,12 +187,12 @@ public class MockSchemaFile implements ISchemaFile {
       return result;
     } else if (node.isDatabase() && node.isDevice()) {
       ICachedMNode result = nodeFactory.createDatabaseDeviceMNode(null, node.getName());
-//       result.getAsDeviceMNode().setAligned(node.getAsDeviceMNode().isAlignedNullable());
+      result.getAsDeviceMNode().setAligned(node.getAsDeviceMNode().isAlignedNullable());
       cloneInternalMNodeData(node, result);
       return result;
     } else if (node.isDevice()) {
       ICachedMNode result = nodeFactory.createDeviceMNode(null, node.getName()).getAsMNode();
-//       result.getAsDeviceMNode().setAligned(node.getAsDeviceMNode().isAlignedNullable());
+      result.getAsDeviceMNode().setAligned(node.getAsDeviceMNode().isAlignedNullable());
       result
           .getAsDeviceMNode()
           .setSchemaTemplateId(node.getAsDeviceMNode().getSchemaTemplateIdWithState());
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/collector/MeasurementCollector.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/collector/MeasurementCollector.java
index 31f55e866eb..2220e1203cd 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/collector/MeasurementCollector.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/traverser/collector/MeasurementCollector.java
@@ -69,7 +69,7 @@ public abstract class MeasurementCollector<R, N extends IMNode<N>>
     MeasurementPath retPath =
         new MeasurementPath(
             getPartialPathFromRootToNode(currentNode.getAsMNode()), currentNode.getSchema());
-//     retPath.setUnderAlignedEntity(par.getAsDeviceMNode().isAlignedNullable());
+    retPath.setUnderAlignedEntity(par.getAsDeviceMNode().isAlignedNullable());
     return retPath;
   }
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/IDeviceSchemaInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/IDeviceSchemaInfo.java
index deb45a946ff..ed3c15cfcf0 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/IDeviceSchemaInfo.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/IDeviceSchemaInfo.java
@@ -23,7 +23,7 @@ import org.apache.tsfile.utils.Binary;
 
 public interface IDeviceSchemaInfo extends ISchemaInfo {
 
-//   Boolean isAligned();
+  Boolean isAligned();
 
   int getTemplateId();
 
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/ITimeSeriesSchemaInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/ITimeSeriesSchemaInfo.java
index 3152bd6c1ce..357e4150970 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/ITimeSeriesSchemaInfo.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/ITimeSeriesSchemaInfo.java
@@ -27,15 +27,15 @@ public interface ITimeSeriesSchemaInfo extends ISchemaInfo {
 
   String getAlias();
 
-//   IMeasurementSchema getSchema();
+  IMeasurementSchema getSchema();
 
   Map<String, String> getTags();
 
   Map<String, String> getAttributes();
 
   boolean isUnderAlignedDevice();
-// 
-//   boolean isLogicalView();
+
+  boolean isLogicalView();
 
   ITimeSeriesSchemaInfo snapshot();
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowDevicesResult.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowDevicesResult.java
index 69e9a014d76..ce805798715 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowDevicesResult.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowDevicesResult.java
@@ -34,7 +34,7 @@ import java.util.Objects;
 import java.util.function.Function;
 
 public class ShowDevicesResult extends ShowSchemaResult implements IDeviceSchemaInfo {
-//   private Boolean isAligned;
+  private Boolean isAligned;
   private int templateId;
 
   private Function<String, Binary> attributeProvider;
@@ -55,7 +55,7 @@ public class ShowDevicesResult extends ShowSchemaResult implements IDeviceSchema
     this.rawNodes = rawNodes;
   }
 
-//   public Boolean isAligned() {
+  public Boolean isAligned() {
     return isAligned;
   }
 
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowTimeSeriesResult.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowTimeSeriesResult.java
index a8e4f650c28..2861d267266 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowTimeSeriesResult.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/read/resp/info/impl/ShowTimeSeriesResult.java
@@ -33,7 +33,7 @@ public class ShowTimeSeriesResult extends ShowSchemaResult implements ITimeSerie
 
   private String alias;
 
-//   private IMeasurementSchema measurementSchema;
+  private IMeasurementSchema measurementSchema;
 
   private Map<String, String> tags;
   private Map<String, String> attributes;
@@ -41,13 +41,13 @@ public class ShowTimeSeriesResult extends ShowSchemaResult implements ITimeSerie
   private boolean isUnderAlignedDevice;
 
   public ShowTimeSeriesResult(
-//       String path,
+      String path,
       String alias,
-//       IMeasurementSchema measurementSchema,
+      IMeasurementSchema measurementSchema,
       Map<String, String> tags,
       Map<String, String> attributes,
       boolean isUnderAlignedDevice) {
-//     super(path);
+    super(path);
     this.alias = alias;
     this.measurementSchema = measurementSchema;
     this.tags = tags;
@@ -64,7 +64,7 @@ public class ShowTimeSeriesResult extends ShowSchemaResult implements ITimeSerie
   }
 
   @Override
-//   public IMeasurementSchema getSchema() {
+  public IMeasurementSchema getSchema() {
     return measurementSchema;
   }
 
@@ -83,11 +83,11 @@ public class ShowTimeSeriesResult extends ShowSchemaResult implements ITimeSerie
     return isUnderAlignedDevice;
   }
 
-//   @Override
-//   public boolean isLogicalView() {
-//     return this.measurementSchema.isLogicalView();
-//   }
-// 
+  @Override
+  public boolean isLogicalView() {
+    return this.measurementSchema.isLogicalView();
+  }
+
   @Override
   public ITimeSeriesSchemaInfo snapshot() {
     return this;
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPathType.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPathType.java
index 8587f732779..05edc211953 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPathType.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPathType.java
@@ -20,13 +20,13 @@
 package org.apache.iotdb.db.schemaengine.schemaregion.view;
 
 public enum ViewPathType {
-//   /** Example: root.db.d01.s01, root.db.d02.s01, root.db.d02.s02 */
+  /** Example: root.db.d01.s01, root.db.d02.s01, root.db.d02.s02 */
   FULL_PATH_LIST,
-//   /** Example: root.db(d01.s01, d02.s02, status) */
+  /** Example: root.db(d01.s01, d02.s02, status) */
   PATHS_GROUP,
-//   /** Example: SELECT s01, s02 FROM root.db.*; */
-//   QUERY_STATEMENT,
-// 
-//   /** Example: root.db.view(${2}_temperature) */
-//   BATCH_GENERATION,
+  /** Example: SELECT s01, s02 FROM root.db.*; */
+  QUERY_STATEMENT,
+
+  /** Example: root.db.view(${2}_temperature) */
+  BATCH_GENERATION,
 }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPaths.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPaths.java
index 1c0b08e07ab..73127f25c15 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPaths.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/ViewPaths.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.schemaengine.schemaregion.view;
 
 import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException;
-// import org.apache.iotdb.db.exception.metadata.view.ViewContainsAggregationException;
+import org.apache.iotdb.db.exception.metadata.view.UnsupportedViewException;
+import org.apache.iotdb.db.exception.metadata.view.ViewContainsAggregationException;
 import org.apache.iotdb.db.queryengine.plan.expression.Expression;
 import org.apache.iotdb.db.queryengine.plan.expression.leaf.TimeSeriesOperand;
 import org.apache.iotdb.db.queryengine.plan.expression.visitor.CollectAggregationExpressionsVisitor;
@@ -92,31 +92,31 @@ public class ViewPaths {
       }
     } else if (this.viewPathType == ViewPathType.QUERY_STATEMENT) {
       // no nothing. expressions should be set by setExpressionsList
-//     } else if (this.viewPathType == ViewPathType.BATCH_GENERATION) {
-//       // source paths has no intoItem. target paths should not be converted to expression.
+    } else if (this.viewPathType == ViewPathType.BATCH_GENERATION) {
+      // source paths has no intoItem. target paths should not be converted to expression.
     }
   }
 
-//   /**
-//    * Check all expression in this list, ensure that the views created using them are legal. Check
-//    * follows above rules: 1. A legal view can NOT contain aggregation functions.
-//    *
-//    * @return If all check passed, return true; else return false with failure message.
-//    */
-//   public static Pair<Boolean, UnsupportedViewException> checkExpressionList(
-//       List<Expression> expressionsList) {
-//     CollectAggregationExpressionsVisitor collectAggExpVisitor =
-//         new CollectAggregationExpressionsVisitor();
-// 
-//     for (Expression expression : expressionsList) {
-//       List<Expression> aggList = collectAggExpVisitor.process(expression, null);
+  /**
+   * Check all expression in this list, ensure that the views created using them are legal. Check
+   * follows above rules: 1. A legal view can NOT contain aggregation functions.
+   *
+   * @return If all check passed, return true; else return false with failure message.
+   */
+  public static Pair<Boolean, UnsupportedViewException> checkExpressionList(
+      List<Expression> expressionsList) {
+    CollectAggregationExpressionsVisitor collectAggExpVisitor =
+        new CollectAggregationExpressionsVisitor();
+
+    for (Expression expression : expressionsList) {
+      List<Expression> aggList = collectAggExpVisitor.process(expression, null);
       if (!aggList.isEmpty()) {
-//         return new Pair<>(false, new ViewContainsAggregationException(aggList.get(0).toString()));
-//       }
-//     }
-//     return new Pair<>(true, null);
-//   }
-// 
+        return new Pair<>(false, new ViewContainsAggregationException(aggList.get(0).toString()));
+      }
+    }
+    return new Pair<>(true, null);
+  }
+
   public void setExpressionsList(List<Expression> expressionsList) {
     this.expressionsList = expressionsList;
   }
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/GetSourcePathsVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/GetSourcePathsVisitor.java
index 31f87950e18..b60a33a8d2c 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/GetSourcePathsVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/GetSourcePathsVisitor.java
@@ -1,100 +1,100 @@
-// /*
-//  * 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.
-//  */
-// 
+/*
+ * 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.schemaengine.schemaregion.view.visitor;
-// 
-// import org.apache.iotdb.commons.exception.IllegalPathException;
-// import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand;
-// import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.TernaryViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.UnaryViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor;
-// 
-// import java.util.ArrayList;
-// import java.util.Collections;
-// import java.util.List;
-// 
-// /** Use this visitor to find all the paths of time series used in one expression. */
-// public class GetSourcePathsVisitor extends ViewExpressionVisitor<List<PartialPath>, Void> {
-// 
+
+import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand;
+import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ternary.TernaryViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.UnaryViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/** Use this visitor to find all the paths of time series used in one expression. */
+public class GetSourcePathsVisitor extends ViewExpressionVisitor<List<PartialPath>, Void> {
+
   public static List<PartialPath> getSourcePaths(ViewExpression viewExpression) {
     return new GetSourcePathsVisitor().process(viewExpression, null);
   }
 
-//   @Override
-//   public List<PartialPath> visitExpression(ViewExpression expression, Void context) {
-//     return new ArrayList<>();
-//   }
-// 
-//   @Override
-//   public List<PartialPath> visitTimeSeriesOperand(
-//       TimeSeriesViewOperand timeSeriesOperand, Void context) {
-//     String pathString = timeSeriesOperand.getPathString();
-//     try {
-//       PartialPath path = new PartialPath(pathString);
-//       return Collections.singletonList(path);
-//     } catch (IllegalPathException e) {
-//       // the path is illegal!
-//       throw new RuntimeException(e);
-//     }
-//   }
-// 
-//   @Override
-//   public List<PartialPath> visitUnaryExpression(
-//       UnaryViewExpression unaryViewExpression, Void context) {
-//     ViewExpression expression = unaryViewExpression.getExpression();
-//     return this.process(expression, null);
-//   }
-// 
-//   @Override
-//   public List<PartialPath> visitBinaryExpression(
-//       BinaryViewExpression binaryViewExpression, Void context) {
-//     List<PartialPath> result = new ArrayList<>();
-//     List<ViewExpression> expressionList = binaryViewExpression.getChildViewExpressions();
-//     for (ViewExpression expression : expressionList) {
-//       result.addAll(this.process(expression, null));
-//     }
-//     return result;
-//   }
-// 
-//   @Override
-//   public List<PartialPath> visitTernaryExpression(
-//       TernaryViewExpression ternaryViewExpression, Void context) {
-//     List<PartialPath> result = new ArrayList<>();
-//     List<ViewExpression> expressionList = ternaryViewExpression.getChildViewExpressions();
-//     for (ViewExpression expression : expressionList) {
-//       result.addAll(this.process(expression, null));
-//     }
-//     return result;
-//   }
-// 
-//   @Override
-//   public List<PartialPath> visitFunctionExpression(
-//       FunctionViewExpression functionViewExpression, Void context) {
-//     List<PartialPath> result = new ArrayList<>();
-//     List<ViewExpression> expressionList = functionViewExpression.getChildViewExpressions();
-//     for (ViewExpression expression : expressionList) {
-//       result.addAll(this.process(expression, null));
-//     }
-//     return result;
-//   }
-// }
+  @Override
+  public List<PartialPath> visitExpression(ViewExpression expression, Void context) {
+    return new ArrayList<>();
+  }
+
+  @Override
+  public List<PartialPath> visitTimeSeriesOperand(
+      TimeSeriesViewOperand timeSeriesOperand, Void context) {
+    String pathString = timeSeriesOperand.getPathString();
+    try {
+      PartialPath path = new PartialPath(pathString);
+      return Collections.singletonList(path);
+    } catch (IllegalPathException e) {
+      // the path is illegal!
+      throw new RuntimeException(e);
+    }
+  }
+
+  @Override
+  public List<PartialPath> visitUnaryExpression(
+      UnaryViewExpression unaryViewExpression, Void context) {
+    ViewExpression expression = unaryViewExpression.getExpression();
+    return this.process(expression, null);
+  }
+
+  @Override
+  public List<PartialPath> visitBinaryExpression(
+      BinaryViewExpression binaryViewExpression, Void context) {
+    List<PartialPath> result = new ArrayList<>();
+    List<ViewExpression> expressionList = binaryViewExpression.getChildViewExpressions();
+    for (ViewExpression expression : expressionList) {
+      result.addAll(this.process(expression, null));
+    }
+    return result;
+  }
+
+  @Override
+  public List<PartialPath> visitTernaryExpression(
+      TernaryViewExpression ternaryViewExpression, Void context) {
+    List<PartialPath> result = new ArrayList<>();
+    List<ViewExpression> expressionList = ternaryViewExpression.getChildViewExpressions();
+    for (ViewExpression expression : expressionList) {
+      result.addAll(this.process(expression, null));
+    }
+    return result;
+  }
+
+  @Override
+  public List<PartialPath> visitFunctionExpression(
+      FunctionViewExpression functionViewExpression, Void context) {
+    List<PartialPath> result = new ArrayList<>();
+    List<ViewExpression> expressionList = functionViewExpression.getChildViewExpressions();
+    for (ViewExpression expression : expressionList) {
+      result.addAll(this.process(expression, null));
+    }
+    return result;
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/TransformToExpressionVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/TransformToExpressionVisitor.java
index 2675538d751..8bedc236c27 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/TransformToExpressionVisitor.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/view/visitor/TransformToExpressionVisitor.java
@@ -1,60 +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.
-//  */
-// 
+/*
+ * 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.schemaengine.schemaregion.view.visitor;
-// 
-// import org.apache.iotdb.commons.exception.IllegalPathException;
-// import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ArithmeticBinaryViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.CompareBinaryViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicBinaryViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.LeafViewOperand;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand;
-// import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand;
-// import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ternary.TernaryViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.unary.UnaryViewExpression;
-// import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor;
+
+import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.BinaryViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.AdditionViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ArithmeticBinaryViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.DivisionViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.ModuloViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.MultiplicationViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.arithmetic.SubtractionViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.CompareBinaryViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.EqualToViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterEqualViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.GreaterThanViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessEqualViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.LessThanViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.compare.NonEqualViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicAndViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicBinaryViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.binary.logic.LogicOrViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.ConstantViewOperand;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.LeafViewOperand;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.NullViewOperand;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimeSeriesViewOperand;
+import org.apache.iotdb.commons.schema.view.viewExpression.leaf.TimestampViewOperand;
+import org.apache.iotdb.commons.schema.view.viewExpression.multi.FunctionViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ternary.BetweenViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.ternary.TernaryViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.InViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.IsNullViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.LikeViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.LogicNotViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.NegationViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.RegularViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.unary.UnaryViewExpression;
+import org.apache.iotdb.commons.schema.view.viewExpression.visitor.ViewExpressionVisitor;
 import org.apache.iotdb.db.queryengine.plan.expression.Expression;
 import org.apache.iotdb.db.queryengine.plan.expression.binary.AdditionExpression;
 import org.apache.iotdb.db.queryengine.plan.expression.binary.DivisionExpression;
@@ -75,260 +75,260 @@ import org.apache.iotdb.db.queryengine.plan.expression.leaf.TimeSeriesOperand;
 import org.apache.iotdb.db.queryengine.plan.expression.leaf.TimestampOperand;
 
 import org.apache.tsfile.utils.Pair;
-// 
-// import javax.ws.rs.NotSupportedException;
-// 
-// import java.util.ArrayList;
-// import java.util.List;
-// 
-// public class TransformToExpressionVisitor extends ViewExpressionVisitor<Expression, Void> {
-// 
-//   @Override
-//   public Expression process(ViewExpression viewExpression, Void context) {
-//     return viewExpression.accept(this, context);
-//   }
-// 
-//   @Override
-//   public Expression visitExpression(ViewExpression expression, Void context) {
-//     throw new RuntimeException(
-//         new NotSupportedException(
-//             "visitExpression in TransformToExpressionVisitor is not supported."));
-//   }
-// 
-//   // region leaf operand
-//   @Override
-//   public Expression visitLeafOperand(LeafViewOperand leafViewOperand, Void context) {
-//     throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
-//   }
-// 
-//   @Override
-//   public Expression visitConstantOperand(ConstantViewOperand constantOperand, Void context) {
+
+import javax.ws.rs.NotSupportedException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TransformToExpressionVisitor extends ViewExpressionVisitor<Expression, Void> {
+
+  @Override
+  public Expression process(ViewExpression viewExpression, Void context) {
+    return viewExpression.accept(this, context);
+  }
+
+  @Override
+  public Expression visitExpression(ViewExpression expression, Void context) {
+    throw new RuntimeException(
+        new NotSupportedException(
+            "visitExpression in TransformToExpressionVisitor is not supported."));
+  }
+
+  // region leaf operand
+  @Override
+  public Expression visitLeafOperand(LeafViewOperand leafViewOperand, Void context) {
+    throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
+  }
+
+  @Override
+  public Expression visitConstantOperand(ConstantViewOperand constantOperand, Void context) {
     return new ConstantOperand(constantOperand.getDataType(), constantOperand.getValueString());
-//   }
-// 
-//   @Override
-//   public Expression visitNullOperand(NullViewOperand nullOperand, Void context) {
+  }
+
+  @Override
+  public Expression visitNullOperand(NullViewOperand nullOperand, Void context) {
     return new NullOperand();
-//   }
-// 
-//   @Override
-//   public Expression visitTimeSeriesOperand(TimeSeriesViewOperand timeSeriesOperand, Void context) {
-//     try {
-//       PartialPath path = new PartialPath(timeSeriesOperand.getPathString());
+  }
+
+  @Override
+  public Expression visitTimeSeriesOperand(TimeSeriesViewOperand timeSeriesOperand, Void context) {
+    try {
+      PartialPath path = new PartialPath(timeSeriesOperand.getPathString());
       return new TimeSeriesOperand(path);
-//     } catch (IllegalPathException e) {
-//       throw new RuntimeException(e);
-//     }
-//   }
-// 
-//   @Override
-//   public Expression visitTimeStampOperand(TimestampViewOperand timestampOperand, Void context) {
+    } catch (IllegalPathException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  @Override
+  public Expression visitTimeStampOperand(TimestampViewOperand timestampOperand, Void context) {
     return new TimestampOperand();
-//   }
-
-//   // endregion
-// 
-//   // region Unary Expressions
-//   @Override
-//   public Expression visitUnaryExpression(UnaryViewExpression unaryViewExpression, Void context) {
-//     throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
-//   }
-// 
-//   @Override
-//   public Expression visitInExpression(InViewExpression inExpression, Void context) {
-//     Expression child = this.process(inExpression.getExpression(), context);
+  }
+
+  // endregion
+
+  // region Unary Expressions
+  @Override
+  public Expression visitUnaryExpression(UnaryViewExpression unaryViewExpression, Void context) {
+    throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
+  }
+
+  @Override
+  public Expression visitInExpression(InViewExpression inExpression, Void context) {
+    Expression child = this.process(inExpression.getExpression(), context);
     return new org.apache.iotdb.db.queryengine.plan.expression.unary.InExpression(
-//         child, inExpression.isNotIn(), inExpression.getValuesInLinkedHashSet());
-//   }
-// 
-//   @Override
-//   public Expression visitIsNullExpression(IsNullViewExpression isNullExpression, Void context) {
-//     Expression child = this.process(isNullExpression.getExpression(), context);
+        child, inExpression.isNotIn(), inExpression.getValuesInLinkedHashSet());
+  }
+
+  @Override
+  public Expression visitIsNullExpression(IsNullViewExpression isNullExpression, Void context) {
+    Expression child = this.process(isNullExpression.getExpression(), context);
     return new org.apache.iotdb.db.queryengine.plan.expression.unary.IsNullExpression(
-//         child, isNullExpression.isNot());
-//   }
-// 
-//   @Override
-//   public Expression visitLikeExpression(LikeViewExpression likeExpression, Void context) {
-//     Expression child = this.process(likeExpression.getExpression(), context);
+        child, isNullExpression.isNot());
+  }
+
+  @Override
+  public Expression visitLikeExpression(LikeViewExpression likeExpression, Void context) {
+    Expression child = this.process(likeExpression.getExpression(), context);
     return new org.apache.iotdb.db.queryengine.plan.expression.unary.LikeExpression(
         child, likeExpression.getPattern(), likeExpression.getEscape(), likeExpression.isNot());
-//   }
-// 
-//   @Override
-//   public Expression visitLogicNotExpression(
-//       LogicNotViewExpression logicNotExpression, Void context) {
-//     Expression child = this.process(logicNotExpression.getExpression(), context);
+  }
+
+  @Override
+  public Expression visitLogicNotExpression(
+      LogicNotViewExpression logicNotExpression, Void context) {
+    Expression child = this.process(logicNotExpression.getExpression(), context);
     return new org.apache.iotdb.db.queryengine.plan.expression.unary.LogicNotExpression(child);
-//   }
-// 
-//   @Override
-//   public Expression visitNegationExpression(
-//       NegationViewExpression negationExpression, Void context) {
-//     Expression child = this.process(negationExpression.getExpression(), context);
+  }
+
+  @Override
+  public Expression visitNegationExpression(
+      NegationViewExpression negationExpression, Void context) {
+    Expression child = this.process(negationExpression.getExpression(), context);
     return new org.apache.iotdb.db.queryengine.plan.expression.unary.NegationExpression(child);
-//   }
-// 
-//   @Override
-//   public Expression visitRegularExpression(RegularViewExpression regularExpression, Void context) {
-//     Expression child = this.process(regularExpression.getExpression(), context);
+  }
+
+  @Override
+  public Expression visitRegularExpression(RegularViewExpression regularExpression, Void context) {
+    Expression child = this.process(regularExpression.getExpression(), context);
     return new org.apache.iotdb.db.queryengine.plan.expression.unary.RegularExpression(
         child,
         regularExpression.getPatternString(),
         regularExpression.getPattern(),
         regularExpression.isNot());
-//   }
-
-//   // endregion
-// 
-//   @Override
-//   // region Binary Expressions
-//   public Expression visitBinaryExpression(BinaryViewExpression binaryViewExpression, Void context) {
-//     throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
-//   }
-// 
-//   private Pair<Expression, Expression> getExpressionsForBinaryExpression(
-//       BinaryViewExpression binaryViewExpression) {
-//     Expression left = this.process(binaryViewExpression.getLeftExpression(), null);
-//     Expression right = this.process(binaryViewExpression.getRightExpression(), null);
-//     return new Pair<>(left, right);
-//   }
-// 
-//   // region Binary : Arithmetic Binary Expression
-//   public Expression visitArithmeticBinaryExpression(
-//       ArithmeticBinaryViewExpression arithmeticBinaryExpression, Void context) {
-//     throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
-//   }
-// 
-//   public Expression visitAdditionExpression(
-//       AdditionViewExpression additionExpression, Void context) {
-//     Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(additionExpression);
+  }
+
+  // endregion
+
+  @Override
+  // region Binary Expressions
+  public Expression visitBinaryExpression(BinaryViewExpression binaryViewExpression, Void context) {
+    throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
+  }
+
+  private Pair<Expression, Expression> getExpressionsForBinaryExpression(
+      BinaryViewExpression binaryViewExpression) {
+    Expression left = this.process(binaryViewExpression.getLeftExpression(), null);
+    Expression right = this.process(binaryViewExpression.getRightExpression(), null);
+    return new Pair<>(left, right);
+  }
+
+  // region Binary : Arithmetic Binary Expression
+  public Expression visitArithmeticBinaryExpression(
+      ArithmeticBinaryViewExpression arithmeticBinaryExpression, Void context) {
+    throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
+  }
+
+  public Expression visitAdditionExpression(
+      AdditionViewExpression additionExpression, Void context) {
+    Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(additionExpression);
     return new AdditionExpression(pair.left, pair.right);
-//   }
-// 
-//   public Expression visitDivisionExpression(
-//       DivisionViewExpression divisionExpression, Void context) {
-//     Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(divisionExpression);
+  }
+
+  public Expression visitDivisionExpression(
+      DivisionViewExpression divisionExpression, Void context) {
+    Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(divisionExpression);
     return new DivisionExpression(pair.left, pair.right);
-//   }
-// 
-//   public Expression visitModuloExpression(ModuloViewExpression moduloExpression, Void context) {
-//     Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(moduloExpression);
+  }
+
+  public Expression visitModuloExpression(ModuloViewExpression moduloExpression, Void context) {
+    Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(moduloExpression);
     return new ModuloExpression(pair.left, pair.right);
-//   }
-// 
-//   public Expression visitMultiplicationExpression(
-//       MultiplicationViewExpression multiplicationExpression, Void context) {
-//     Pair<Expression, Expression> pair =
-//         this.getExpressionsForBinaryExpression(multiplicationExpression);
+  }
+
+  public Expression visitMultiplicationExpression(
+      MultiplicationViewExpression multiplicationExpression, Void context) {
+    Pair<Expression, Expression> pair =
+        this.getExpressionsForBinaryExpression(multiplicationExpression);
     return new MultiplicationExpression(pair.left, pair.right);
-//   }
-// 
-//   public Expression visitSubtractionExpression(
-//       SubtractionViewExpression subtractionExpression, Void context) {
-//     Pair<Expression, Expression> pair =
-//         this.getExpressionsForBinaryExpression(subtractionExpression);
+  }
+
+  public Expression visitSubtractionExpression(
+      SubtractionViewExpression subtractionExpression, Void context) {
+    Pair<Expression, Expression> pair =
+        this.getExpressionsForBinaryExpression(subtractionExpression);
     return new SubtractionExpression(pair.left, pair.right);
-//   }
-
-//   // endregion
-// 
-//   // region Binary: Compare Binary Expression
-//   public Expression visitCompareBinaryExpression(
-//       CompareBinaryViewExpression compareBinaryExpression, Void context) {
-//     throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
-//   }
-// 
-//   public Expression visitEqualToExpression(EqualToViewExpression equalToExpression, Void context) {
-//     Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(equalToExpression);
+  }
+
+  // endregion
+
+  // region Binary: Compare Binary Expression
+  public Expression visitCompareBinaryExpression(
+      CompareBinaryViewExpression compareBinaryExpression, Void context) {
+    throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
+  }
+
+  public Expression visitEqualToExpression(EqualToViewExpression equalToExpression, Void context) {
+    Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(equalToExpression);
     return new EqualToExpression(pair.left, pair.right);
-//   }
-// 
-//   public Expression visitGreaterEqualExpression(
-//       GreaterEqualViewExpression greaterEqualExpression, Void context) {
-//     Pair<Expression, Expression> pair =
-//         this.getExpressionsForBinaryExpression(greaterEqualExpression);
+  }
+
+  public Expression visitGreaterEqualExpression(
+      GreaterEqualViewExpression greaterEqualExpression, Void context) {
+    Pair<Expression, Expression> pair =
+        this.getExpressionsForBinaryExpression(greaterEqualExpression);
     return new GreaterEqualExpression(pair.left, pair.right);
-//   }
-// 
-//   public Expression visitGreaterThanExpression(
-//       GreaterThanViewExpression greaterThanExpression, Void context) {
-//     Pair<Expression, Expression> pair =
-//         this.getExpressionsForBinaryExpression(greaterThanExpression);
+  }
+
+  public Expression visitGreaterThanExpression(
+      GreaterThanViewExpression greaterThanExpression, Void context) {
+    Pair<Expression, Expression> pair =
+        this.getExpressionsForBinaryExpression(greaterThanExpression);
     return new GreaterThanExpression(pair.left, pair.right);
-//   }
-// 
-//   public Expression visitLessEqualExpression(
-//       LessEqualViewExpression lessEqualExpression, Void context) {
-//     Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(lessEqualExpression);
+  }
+
+  public Expression visitLessEqualExpression(
+      LessEqualViewExpression lessEqualExpression, Void context) {
+    Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(lessEqualExpression);
     return new LessEqualExpression(pair.left, pair.right);
-//   }
-// 
-//   public Expression visitLessThanExpression(
-//       LessThanViewExpression lessThanExpression, Void context) {
-//     Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(lessThanExpression);
+  }
+
+  public Expression visitLessThanExpression(
+      LessThanViewExpression lessThanExpression, Void context) {
+    Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(lessThanExpression);
     return new LessThanExpression(pair.left, pair.right);
-//   }
-// 
-//   public Expression visitNonEqualExpression(
-//       NonEqualViewExpression nonEqualExpression, Void context) {
-//     Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(nonEqualExpression);
+  }
+
+  public Expression visitNonEqualExpression(
+      NonEqualViewExpression nonEqualExpression, Void context) {
+    Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(nonEqualExpression);
     return new NonEqualExpression(pair.left, pair.right);
-//   }
-
-//   // endregion
-// 
-//   // region Binary : Logic Binary Expression
-//   public Expression visitLogicBinaryExpression(
-//       LogicBinaryViewExpression logicBinaryExpression, Void context) {
-//     throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
-//   }
-// 
-//   public Expression visitLogicAndExpression(
-//       LogicAndViewExpression logicAndExpression, Void context) {
-//     Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(logicAndExpression);
+  }
+
+  // endregion
+
+  // region Binary : Logic Binary Expression
+  public Expression visitLogicBinaryExpression(
+      LogicBinaryViewExpression logicBinaryExpression, Void context) {
+    throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
+  }
+
+  public Expression visitLogicAndExpression(
+      LogicAndViewExpression logicAndExpression, Void context) {
+    Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(logicAndExpression);
     return new LogicAndExpression(pair.left, pair.right);
-//   }
-// 
-//   public Expression visitLogicOrExpression(LogicOrViewExpression logicOrExpression, Void context) {
-//     Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(logicOrExpression);
+  }
+
+  public Expression visitLogicOrExpression(LogicOrViewExpression logicOrExpression, Void context) {
+    Pair<Expression, Expression> pair = this.getExpressionsForBinaryExpression(logicOrExpression);
     return new LogicOrExpression(pair.left, pair.right);
-//   }
-
-//   // endregion
-// 
-//   // endregion
-// 
-//   // region Ternary Expressions
-//   public Expression visitTernaryExpression(
-//       TernaryViewExpression ternaryViewExpression, Void context) {
-//     throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
-//   }
-// 
-//   public Expression visitBetweenExpression(
-//       BetweenViewExpression betweenViewExpression, Void context) {
-//     Expression first = this.process(betweenViewExpression.getFirstExpression(), null);
-//     Expression second = this.process(betweenViewExpression.getSecondExpression(), null);
-//     Expression third = this.process(betweenViewExpression.getThirdExpression(), null);
+  }
+
+  // endregion
+
+  // endregion
+
+  // region Ternary Expressions
+  public Expression visitTernaryExpression(
+      TernaryViewExpression ternaryViewExpression, Void context) {
+    throw new RuntimeException(new NotSupportedException("Can not construct abstract class."));
+  }
+
+  public Expression visitBetweenExpression(
+      BetweenViewExpression betweenViewExpression, Void context) {
+    Expression first = this.process(betweenViewExpression.getFirstExpression(), null);
+    Expression second = this.process(betweenViewExpression.getSecondExpression(), null);
+    Expression third = this.process(betweenViewExpression.getThirdExpression(), null);
     return new org.apache.iotdb.db.queryengine.plan.expression.ternary.BetweenExpression(
-//         first, second, third, betweenViewExpression.isNotBetween());
-//   }
-
-//   // endregion
-// 
-//   // region FunctionExpression
-//   public Expression visitFunctionExpression(
-//       FunctionViewExpression functionViewExpression, Void context) {
-//     List<ViewExpression> viewExpressionList = functionViewExpression.getExpressions();
-//     List<Expression> expressionList = new ArrayList<>();
-//     for (ViewExpression viewExpression : viewExpressionList) {
-//       expressionList.add(this.process(viewExpression, null));
-//     }
+        first, second, third, betweenViewExpression.isNotBetween());
+  }
+
+  // endregion
+
+  // region FunctionExpression
+  public Expression visitFunctionExpression(
+      FunctionViewExpression functionViewExpression, Void context) {
+    List<ViewExpression> viewExpressionList = functionViewExpression.getExpressions();
+    List<Expression> expressionList = new ArrayList<>();
+    for (ViewExpression viewExpression : viewExpressionList) {
+      expressionList.add(this.process(viewExpression, null));
+    }
     return new org.apache.iotdb.db.queryengine.plan.expression.multi.FunctionExpression(
-//         functionViewExpression.getFunctionName(),
-//         functionViewExpression.getFunctionAttributes(),
-//         expressionList);
-//   }
-//   // endregion
-// 
-// }
+        functionViewExpression.getFunctionName(),
+        functionViewExpression.getFunctionAttributes(),
+        expressionList);
+  }
+  // endregion
+
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/SchemaRegionWritePlanFactory.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/SchemaRegionWritePlanFactory.java
index ba6bd31bfb2..5fe5ec993cd 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/SchemaRegionWritePlanFactory.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/SchemaRegionWritePlanFactory.java
@@ -93,8 +93,8 @@ public class SchemaRegionWritePlanFactory {
         return new RollbackPreDeactivateTemplatePlanImpl();
       case DEACTIVATE_TEMPLATE:
         return new DeactivateTemplatePlanImpl();
-//       case CREATE_LOGICAL_VIEW:
-//         return new CreateLogicalViewPlanImpl();
+      case CREATE_LOGICAL_VIEW:
+        return new CreateLogicalViewPlanImpl();
       case PRE_DELETE_LOGICAL_VIEW:
         return new PreDeleteLogicalViewPlanImpl();
       case ROLLBACK_PRE_DELETE_LOGICAL_VIEW:
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/impl/view/CreateLogicalViewPlanImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/impl/view/CreateLogicalViewPlanImpl.java
index 6c0d7997863..8555b7b1831 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/impl/view/CreateLogicalViewPlanImpl.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/impl/view/CreateLogicalViewPlanImpl.java
@@ -1,76 +1,76 @@
-// /*
-//  * 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.
-//  */
-// 
+/*
+ * 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.schemaengine.schemaregion.write.req.impl.view;
-// 
-// import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.schemaengine.schemaregion.write.req.view.ICreateLogicalViewPlan;
-// 
-// import java.util.Collections;
-// import java.util.HashMap;
-// import java.util.List;
-// import java.util.Map;
-// 
-// public class CreateLogicalViewPlanImpl implements ICreateLogicalViewPlan {
-// 
-//   private PartialPath targetPath = null;
-//   private ViewExpression sourceExpression = null;
-// 
-//   public CreateLogicalViewPlanImpl() {}
-// 
-//   public CreateLogicalViewPlanImpl(PartialPath targetPath, ViewExpression sourceExpression) {
-//     this.targetPath = targetPath;
-//     this.sourceExpression = sourceExpression;
-//   }
-// 
-//   @Override
-//   public int getViewSize() {
-//     return 1;
-//   }
-// 
-//   @Override
-//   public Map<PartialPath, ViewExpression> getViewPathToSourceExpressionMap() {
-//     Map<PartialPath, ViewExpression> result = new HashMap<>();
-//     result.put(this.targetPath, this.sourceExpression);
-//     return result;
-//   }
-// 
-//   @Override
-//   public List<PartialPath> getViewPathList() {
-//     return Collections.singletonList(this.targetPath);
-//   }
-// 
-//   @Override
-//   public void setViewPathToSourceExpressionMap(
-//       Map<PartialPath, ViewExpression> viewPathToSourceExpressionMap) {
-//     for (Map.Entry<PartialPath, ViewExpression> entry : viewPathToSourceExpressionMap.entrySet()) {
-//       this.targetPath = entry.getKey();
-//       this.sourceExpression = entry.getValue();
-//     }
-//   }
-// 
-//   public PartialPath getTargetPath() {
-//     return this.targetPath;
-//   }
-// 
-//   public ViewExpression getSourceExpression() {
-//     return this.sourceExpression;
-//   }
-// }
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class CreateLogicalViewPlanImpl implements ICreateLogicalViewPlan {
+
+  private PartialPath targetPath = null;
+  private ViewExpression sourceExpression = null;
+
+  public CreateLogicalViewPlanImpl() {}
+
+  public CreateLogicalViewPlanImpl(PartialPath targetPath, ViewExpression sourceExpression) {
+    this.targetPath = targetPath;
+    this.sourceExpression = sourceExpression;
+  }
+
+  @Override
+  public int getViewSize() {
+    return 1;
+  }
+
+  @Override
+  public Map<PartialPath, ViewExpression> getViewPathToSourceExpressionMap() {
+    Map<PartialPath, ViewExpression> result = new HashMap<>();
+    result.put(this.targetPath, this.sourceExpression);
+    return result;
+  }
+
+  @Override
+  public List<PartialPath> getViewPathList() {
+    return Collections.singletonList(this.targetPath);
+  }
+
+  @Override
+  public void setViewPathToSourceExpressionMap(
+      Map<PartialPath, ViewExpression> viewPathToSourceExpressionMap) {
+    for (Map.Entry<PartialPath, ViewExpression> entry : viewPathToSourceExpressionMap.entrySet()) {
+      this.targetPath = entry.getKey();
+      this.sourceExpression = entry.getValue();
+    }
+  }
+
+  public PartialPath getTargetPath() {
+    return this.targetPath;
+  }
+
+  public ViewExpression getSourceExpression() {
+    return this.sourceExpression;
+  }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/view/ICreateLogicalViewPlan.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/view/ICreateLogicalViewPlan.java
index 75c79f9a832..3c94851c528 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/view/ICreateLogicalViewPlan.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/write/req/view/ICreateLogicalViewPlan.java
@@ -1,70 +1,70 @@
-// /*
-//  * 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.
-//  */
-// 
+/*
+ * 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.schemaengine.schemaregion.write.req.view;
-// 
-// import org.apache.iotdb.commons.path.PartialPath;
-// import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
+
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.schemaengine.schemaregion.ISchemaRegionPlan;
 import org.apache.iotdb.db.schemaengine.schemaregion.SchemaRegionPlanType;
 import org.apache.iotdb.db.schemaengine.schemaregion.SchemaRegionPlanVisitor;
-// 
-// import java.util.List;
-// import java.util.Map;
-// 
-// public interface ICreateLogicalViewPlan extends ISchemaRegionPlan {
-//   @Override
-//   default SchemaRegionPlanType getPlanType() {
-//     return SchemaRegionPlanType.CREATE_LOGICAL_VIEW;
-//   }
-// 
-//   @Override
-//   default <R, C> R accept(SchemaRegionPlanVisitor<R, C> visitor, C context) {
-//     return visitor.visitCreateLogicalView(this, context);
-//   }
-// 
-//   /**
-//    * Get how many views will be created.
-//    *
-//    * @return the number of views that will be created
-//    */
-//   int getViewSize();
-// 
+
+import java.util.List;
+import java.util.Map;
+
+public interface ICreateLogicalViewPlan extends ISchemaRegionPlan {
+  @Override
+  default SchemaRegionPlanType getPlanType() {
+    return SchemaRegionPlanType.CREATE_LOGICAL_VIEW;
+  }
+
+  @Override
+  default <R, C> R accept(SchemaRegionPlanVisitor<R, C> visitor, C context) {
+    return visitor.visitCreateLogicalView(this, context);
+  }
+
+  /**
+   * Get how many views will be created.
+   *
+   * @return the number of views that will be created
+   */
+  int getViewSize();
+
   /**
    * @return return a map, from view path (the targets) to source expression.
    */
-//   Map<PartialPath, ViewExpression> getViewPathToSourceExpressionMap();
-// 
+  Map<PartialPath, ViewExpression> getViewPathToSourceExpressionMap();
+
   /**
    * @return return a list of target paths (paths of views).
    */
-//   List<PartialPath> getViewPathList();
-// 
-//   /**
-//    * @param viewPathToSourceExpressionMap a map from view path (the targets) to source expression.
-//    */
-//   void setViewPathToSourceExpressionMap(
-//       Map<PartialPath, ViewExpression> viewPathToSourceExpressionMap);
-// 
-//   //  /**
-//   //   * @param partialPaths a list of partialPaths. Will be transformed into expressions then set
-//   // as source. (source timeseries or expressions in query statement)
-//   //   */
-//   //  void setSourceByPartialPath(List<PartialPath> partialPaths);
-// }
+  List<PartialPath> getViewPathList();
+
+  /**
+   * @param viewPathToSourceExpressionMap a map from view path (the targets) to source expression.
+   */
+  void setViewPathToSourceExpressionMap(
+      Map<PartialPath, ViewExpression> viewPathToSourceExpressionMap);
+
+  //  /**
+  //   * @param partialPaths a list of partialPaths. Will be transformed into expressions then set
+  // as source. (source timeseries or expressions in query statement)
+  //   */
+  //  void setSourceByPartialPath(List<PartialPath> partialPaths);
+}
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionBasicTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionBasicTest.java
index f1d8deadc31..601233d9d60 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionBasicTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionBasicTest.java
@@ -54,7 +54,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-// import java.util.LinkedList;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -234,27 +234,27 @@ public class SchemaRegionBasicTest extends AbstractSchemaRegionTest {
             .isEmpty());
   }
 
-//   @Test
+  @Test
   public void testCreateAlignedTimeSeries() throws Exception {
     final ISchemaRegion schemaRegion = getSchemaRegion("root.sg", 0);
-//     schemaRegion.createAlignedTimeSeries(
+    schemaRegion.createAlignedTimeSeries(
         SchemaRegionWritePlanFactory.getCreateAlignedTimeSeriesPlan(
-//             new PartialPath("root.sg.wf02.wt01"),
-//             Arrays.asList("temperature", "status"),
-//             Arrays.asList(TSDataType.valueOf("FLOAT"), TSDataType.valueOf("INT32")),
-//             Arrays.asList(TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
-//             Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY),
-//             null,
-//             null,
-//             null));
+            new PartialPath("root.sg.wf02.wt01"),
+            Arrays.asList("temperature", "status"),
+            Arrays.asList(TSDataType.valueOf("FLOAT"), TSDataType.valueOf("INT32")),
+            Arrays.asList(TSEncoding.valueOf("RLE"), TSEncoding.valueOf("RLE")),
+            Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY),
+            null,
+            null,
+            null));
     final Map<Integer, MetadataException> checkRes =
-//         schemaRegion.checkMeasurementExistence(
-//             new PartialPath("root.sg.wf02.wt01"), Arrays.asList("temperature", "status"), null);
-//     Assert.assertEquals(2, checkRes.size());
-//     Assert.assertTrue(checkRes.get(0) instanceof MeasurementAlreadyExistException);
-//     Assert.assertTrue(checkRes.get(1) instanceof MeasurementAlreadyExistException);
-//   }
-// 
+        schemaRegion.checkMeasurementExistence(
+            new PartialPath("root.sg.wf02.wt01"), Arrays.asList("temperature", "status"), null);
+    Assert.assertEquals(2, checkRes.size());
+    Assert.assertTrue(checkRes.get(0) instanceof MeasurementAlreadyExistException);
+    Assert.assertTrue(checkRes.get(1) instanceof MeasurementAlreadyExistException);
+  }
+
   @Test
   public void testCreateAlignedTimeSeriesWithMerge() throws Exception {
     final ISchemaRegion schemaRegion = getSchemaRegion("root.sg", 0);
@@ -565,169 +565,169 @@ public class SchemaRegionBasicTest extends AbstractSchemaRegionTest {
     Assert.assertEquals(1, schemas.size());
     Assert.assertEquals("root.sg.wf02.wt01.temperature", schemas.get(0).getFullPath());
   }
-// 
-//   @Test
+
+  @Test
   public void testGetAllTimeSeriesCount() throws Exception {
     final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0);
-// 
+
     SchemaRegionTestUtil.createSimpleTimeSeriesByList(
-//         schemaRegion,
-//         Arrays.asList(
-//             "root.laptop.d0",
-//             "root.laptop.d1.s1",
-//             "root.laptop.d1.s2.t1",
-//             "root.laptop.d1.s3",
-//             "root.laptop.d2.s1",
-//             "root.laptop.d2.s2"));
-// 
-//     // for Non prefix matched path
-//     Assert.assertEquals(
+        schemaRegion,
+        Arrays.asList(
+            "root.laptop.d0",
+            "root.laptop.d1.s1",
+            "root.laptop.d1.s2.t1",
+            "root.laptop.d1.s3",
+            "root.laptop.d2.s1",
+            "root.laptop.d2.s2"));
+
+    // for Non prefix matched path
+    Assert.assertEquals(
         6, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.**"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         6, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.**"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         1, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.*"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         4, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.*.*"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         5, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.*.**"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         1, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.*.*.t1"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         2, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.*.s1"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         3, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d1.**"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         2, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d1.*"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         1, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d2.s1"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         2, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d2.**"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         0, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop"), null, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         0, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d3.s1"), null, false));
-// 
-//     // for prefix matched path
-//     Assert.assertEquals(
+
+    // for prefix matched path
+    Assert.assertEquals(
         6, getAllTimeSeriesCount(schemaRegion, new PartialPath("root"), null, true));
     Assert.assertEquals(
         6, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop"), null, true));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         2, getAllTimeSeriesCount(schemaRegion, new PartialPath("root.laptop.d2"), null, true));
-//   }
-// 
-//   @Test
-//   public void testGetMeasurementCountGroupByLevel() throws Exception {
+  }
+
+  @Test
+  public void testGetMeasurementCountGroupByLevel() throws Exception {
     final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0);
-// 
+
     SchemaRegionTestUtil.createSimpleTimeSeriesByList(
-//         schemaRegion,
-//         Arrays.asList(
-//             "root.laptop.d0",
-//             "root.laptop.d1.s1",
-//             "root.laptop.d1.s2.t1",
-//             "root.laptop.d1.s3",
-//             "root.laptop.d2.s1",
-//             "root.laptop.d2.s2"));
-// 
+        schemaRegion,
+        Arrays.asList(
+            "root.laptop.d0",
+            "root.laptop.d1.s1",
+            "root.laptop.d1.s2.t1",
+            "root.laptop.d1.s3",
+            "root.laptop.d2.s1",
+            "root.laptop.d2.s2"));
+
     final Map<PartialPath, Long> expected = new HashMap<>();
-//     expected.put(new PartialPath("root"), (long) 6);
-//     Assert.assertEquals(
-//         expected,
+    expected.put(new PartialPath("root"), (long) 6);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(schemaRegion, new PartialPath("root.**"), 0, false));
-//     expected.clear();
-// 
-//     expected.put(new PartialPath("root.laptop"), (long) 1);
-//     Assert.assertEquals(
-//         expected,
+    expected.clear();
+
+    expected.put(new PartialPath("root.laptop"), (long) 1);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(schemaRegion, new PartialPath("root.laptop.*"), 1, false));
-//     expected.clear();
-// 
-//     expected.put(new PartialPath("root.laptop.d0"), (long) 1);
-//     Assert.assertEquals(
-//         expected,
+    expected.clear();
+
+    expected.put(new PartialPath("root.laptop.d0"), (long) 1);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(schemaRegion, new PartialPath("root.laptop.d0"), 2, false));
-//     expected.clear();
-// 
-//     expected.put(new PartialPath("root.laptop.d1"), (long) 2);
-//     Assert.assertEquals(
-//         expected,
+    expected.clear();
+
+    expected.put(new PartialPath("root.laptop.d1"), (long) 2);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(
             schemaRegion, new PartialPath("root.laptop.d1.*"), 2, false));
-//     expected.clear();
-// 
-//     expected.put(new PartialPath("root.laptop.d1"), (long) 3);
-//     Assert.assertEquals(
-//         expected,
+    expected.clear();
+
+    expected.put(new PartialPath("root.laptop.d1"), (long) 3);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(
             schemaRegion, new PartialPath("root.laptop.d1.**"), 2, false));
-//     expected.clear();
-// 
-//     expected.put(new PartialPath("root.laptop.d2"), (long) 2);
-//     Assert.assertEquals(
-//         expected,
+    expected.clear();
+
+    expected.put(new PartialPath("root.laptop.d2"), (long) 2);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(
             schemaRegion, new PartialPath("root.laptop.d2.*"), 2, false));
-//     expected.clear();
-// 
-//     expected.put(new PartialPath("root.laptop"), (long) 2);
-//     Assert.assertEquals(
-//         expected,
+    expected.clear();
+
+    expected.put(new PartialPath("root.laptop"), (long) 2);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(
             schemaRegion, new PartialPath("root.laptop.*.s1"), 1, false));
-//     expected.clear();
-// 
-//     expected.put(new PartialPath("root.laptop.d1"), (long) 1);
-//     expected.put(new PartialPath("root.laptop.d2"), (long) 1);
-//     Assert.assertEquals(
-//         expected,
+    expected.clear();
+
+    expected.put(new PartialPath("root.laptop.d1"), (long) 1);
+    expected.put(new PartialPath("root.laptop.d2"), (long) 1);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(
             schemaRegion, new PartialPath("root.laptop.*.s1"), 2, false));
-//     expected.clear();
-// 
-//     expected.put(new PartialPath("root.laptop"), (long) 1);
-//     Assert.assertEquals(
-//         expected,
+    expected.clear();
+
+    expected.put(new PartialPath("root.laptop"), (long) 1);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(
             schemaRegion, new PartialPath("root.laptop.*.s2"), 1, false));
-//     expected.clear();
-// 
-//     expected.put(new PartialPath("root.laptop.d1"), (long) 2);
-//     expected.put(new PartialPath("root.laptop.d2"), (long) 2);
-//     Assert.assertEquals(
-//         expected,
+    expected.clear();
+
+    expected.put(new PartialPath("root.laptop.d1"), (long) 2);
+    expected.put(new PartialPath("root.laptop.d2"), (long) 2);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(
             schemaRegion, new PartialPath("root.laptop.*.*"), 2, false));
-//     expected.clear();
-// 
-//     // for prefix matched path
-//     expected.put(new PartialPath("root"), (long) 6);
-//     Assert.assertEquals(
+    expected.clear();
+
+    // for prefix matched path
+    expected.put(new PartialPath("root"), (long) 6);
+    Assert.assertEquals(
         expected, getMeasurementCountGroupByLevel(schemaRegion, new PartialPath("root"), 0, true));
-//     expected.clear();
-// 
-//     expected.put(new PartialPath("root.laptop.d1"), (long) 3);
-//     Assert.assertEquals(
-//         expected,
+    expected.clear();
+
+    expected.put(new PartialPath("root.laptop.d1"), (long) 3);
+    Assert.assertEquals(
+        expected,
         getMeasurementCountGroupByLevel(schemaRegion, new PartialPath("root.laptop.d1"), 2, true));
-//     expected.clear();
-//   }
-// 
-//   @Test
-//   public void testGetDevicesNum() throws Exception {
+    expected.clear();
+  }
+
+  @Test
+  public void testGetDevicesNum() throws Exception {
     final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0);
-// 
+
     SchemaRegionTestUtil.createSimpleTimeSeriesByList(
-//         schemaRegion,
-//         Arrays.asList(
-//             "root.laptop.d0",
-//             "root.laptop.d1.s1",
-//             "root.laptop.d1.s2.t1",
-//             "root.laptop.d1.s3",
-//             "root.laptop.d2.s1",
-//             "root.laptop.d2.s2"));
-// 
+        schemaRegion,
+        Arrays.asList(
+            "root.laptop.d0",
+            "root.laptop.d1.s1",
+            "root.laptop.d1.s2.t1",
+            "root.laptop.d1.s3",
+            "root.laptop.d2.s1",
+            "root.laptop.d2.s2"));
+
     Assert.assertEquals(4, getDevicesNum(schemaRegion, new PartialPath("root.**"), false));
     Assert.assertEquals(1, getDevicesNum(schemaRegion, new PartialPath("root.laptop"), false));
     Assert.assertEquals(2, getDevicesNum(schemaRegion, new PartialPath("root.laptop.*"), false));
@@ -739,200 +739,200 @@ public class SchemaRegionBasicTest extends AbstractSchemaRegionTest {
     Assert.assertEquals(2, getDevicesNum(schemaRegion, new PartialPath("root.laptop.d*"), false));
     Assert.assertEquals(2, getDevicesNum(schemaRegion, new PartialPath("root.*.d*"), false));
     Assert.assertEquals(1, getDevicesNum(schemaRegion, new PartialPath("root.**.s2"), false));
-// 
-//     // for prefix matched path
+
+    // for prefix matched path
     Assert.assertEquals(4, getDevicesNum(schemaRegion, new PartialPath("root"), true));
     Assert.assertEquals(4, getDevicesNum(schemaRegion, new PartialPath("root.laptop"), true));
     Assert.assertEquals(3, getDevicesNum(schemaRegion, new PartialPath("root.laptop.d*"), true));
     Assert.assertEquals(1, getDevicesNum(schemaRegion, new PartialPath("root.laptop.d1.*"), true));
-//   }
-// 
-//   @Test
-//   public void testGetNodesListInGivenLevel() throws Exception {
+  }
+
+  @Test
+  public void testGetNodesListInGivenLevel() throws Exception {
     final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0);
-// 
+
     SchemaRegionTestUtil.createSimpleTimeSeriesByList(
-//         schemaRegion,
-//         Arrays.asList(
-//             "root.laptop.d0",
-//             "root.laptop.d1.s1",
-//             "root.laptop.d1.s2.t1",
-//             "root.laptop.d1.s3",
-//             "root.laptop.d2.s1",
-//             "root.laptop.d2.s2"));
-// 
-//     Assert.assertEquals(
+        schemaRegion,
+        Arrays.asList(
+            "root.laptop.d0",
+            "root.laptop.d1.s1",
+            "root.laptop.d1.s2.t1",
+            "root.laptop.d1.s3",
+            "root.laptop.d2.s1",
+            "root.laptop.d2.s2"));
+
+    Assert.assertEquals(
         new LinkedList<>(Collections.singletonList(new PartialPath("root"))),
         getNodesListInGivenLevel(schemaRegion, new PartialPath("root.**"), 0, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         new LinkedList<>(Collections.singletonList(new PartialPath("root.laptop"))),
         getNodesListInGivenLevel(schemaRegion, new PartialPath("root.**"), 1, false));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         new LinkedList<>(Collections.singletonList(new PartialPath("root.laptop"))),
         getNodesListInGivenLevel(schemaRegion, new PartialPath("root.laptop"), 1, false));
-//     Assert.assertEquals(
-//         new HashSet<>(
-//             Arrays.asList(
-//                 new PartialPath("root.laptop.d0"),
-//                 new PartialPath("root.laptop.d1"),
-//                 new PartialPath("root.laptop.d2"))),
-//         new HashSet<>(
+    Assert.assertEquals(
+        new HashSet<>(
+            Arrays.asList(
+                new PartialPath("root.laptop.d0"),
+                new PartialPath("root.laptop.d1"),
+                new PartialPath("root.laptop.d2"))),
+        new HashSet<>(
             getNodesListInGivenLevel(schemaRegion, new PartialPath("root.laptop.**"), 2, false)));
-//     Assert.assertEquals(
-//         new HashSet<>(
-//             Arrays.asList(
-//                 new PartialPath("root.laptop.d1.s1"),
-//                 new PartialPath("root.laptop.d1.s2"),
-//                 new PartialPath("root.laptop.d1.s3"),
-//                 new PartialPath("root.laptop.d2.s1"),
-//                 new PartialPath("root.laptop.d2.s2"))),
-//         new HashSet<>(
+    Assert.assertEquals(
+        new HashSet<>(
+            Arrays.asList(
+                new PartialPath("root.laptop.d1.s1"),
+                new PartialPath("root.laptop.d1.s2"),
+                new PartialPath("root.laptop.d1.s3"),
+                new PartialPath("root.laptop.d2.s1"),
+                new PartialPath("root.laptop.d2.s2"))),
+        new HashSet<>(
             getNodesListInGivenLevel(schemaRegion, new PartialPath("root.laptop.**"), 3, false)));
-//     Assert.assertEquals(
-//         new HashSet<>(
-//             Arrays.asList(
-//                 new PartialPath("root.laptop.d1.s1"), new PartialPath("root.laptop.d2.s1"))),
-//         new HashSet<>(
+    Assert.assertEquals(
+        new HashSet<>(
+            Arrays.asList(
+                new PartialPath("root.laptop.d1.s1"), new PartialPath("root.laptop.d2.s1"))),
+        new HashSet<>(
             getNodesListInGivenLevel(schemaRegion, new PartialPath("root.laptop.*.s1"), 3, false)));
-//     // Empty return
-//     Assert.assertEquals(
+    // Empty return
+    Assert.assertEquals(
         new HashSet<>(Collections.emptyList()),
-//         new HashSet<>(
+        new HashSet<>(
             getNodesListInGivenLevel(
                 schemaRegion, new PartialPath("root.laptop.notExists"), 1, false)));
-//   }
-// 
-//   @Test
-//   public void testGetChildNodePathInNextLevel() throws Exception {
+  }
+
+  @Test
+  public void testGetChildNodePathInNextLevel() throws Exception {
     final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0);
-// 
+
     SchemaRegionTestUtil.createSimpleTimeSeriesByList(
-//         schemaRegion,
-//         Arrays.asList(
-//             "root.laptop.d0",
-//             "root.laptop.d1.s1",
-//             "root.laptop.d1.s2.t1",
-//             "root.laptop.d1.s3",
-//             "root.laptop.d2.s1",
-//             "root.laptop.d2.s2"));
-// 
-//     Assert.assertEquals(
+        schemaRegion,
+        Arrays.asList(
+            "root.laptop.d0",
+            "root.laptop.d1.s1",
+            "root.laptop.d1.s2.t1",
+            "root.laptop.d1.s3",
+            "root.laptop.d2.s1",
+            "root.laptop.d2.s2"));
+
+    Assert.assertEquals(
         new HashSet<>(Collections.emptyList()),
         getChildNodePathInNextLevel(schemaRegion, new PartialPath("root.laptop.d0")));
-// 
-//     Assert.assertEquals(
-//         new HashSet<>(
-//             Arrays.asList(
+
+    Assert.assertEquals(
+        new HashSet<>(
+            Arrays.asList(
                 new ShowNodesResult("root.laptop.d1.s1", MNodeType.MEASUREMENT),
                 new ShowNodesResult("root.laptop.d1.s2", MNodeType.DEVICE),
                 new ShowNodesResult("root.laptop.d1.s3", MNodeType.MEASUREMENT))),
         getChildNodePathInNextLevel(schemaRegion, new PartialPath("root.laptop.d1")));
-// 
-//     Assert.assertEquals(
-//         new HashSet<>(
-//             Arrays.asList(
+
+    Assert.assertEquals(
+        new HashSet<>(
+            Arrays.asList(
                 new ShowNodesResult("root.laptop.d2.s1", MNodeType.MEASUREMENT),
                 new ShowNodesResult("root.laptop.d2.s2", MNodeType.MEASUREMENT))),
         getChildNodePathInNextLevel(schemaRegion, new PartialPath("root.laptop.d2")));
-// 
-//     Assert.assertEquals(
-//         new HashSet<>(
-//             Arrays.asList(
+
+    Assert.assertEquals(
+        new HashSet<>(
+            Arrays.asList(
                 new ShowNodesResult("root.laptop.d0", MNodeType.MEASUREMENT),
                 new ShowNodesResult("root.laptop.d1", MNodeType.DEVICE),
                 new ShowNodesResult("root.laptop.d2", MNodeType.DEVICE))),
         getChildNodePathInNextLevel(schemaRegion, new PartialPath("root.laptop")));
-// 
-//     Assert.assertEquals(
-//         new HashSet<>(
+
+    Assert.assertEquals(
+        new HashSet<>(
             Collections.singletonList(
                 new ShowNodesResult("root.laptop.d1.s2.t1", MNodeType.MEASUREMENT))),
         getChildNodePathInNextLevel(schemaRegion, new PartialPath("root.**.s2")));
-//   }
-// 
-//   @Test
-//   public void testGetMatchedDevices() throws Exception {
+  }
+
+  @Test
+  public void testGetMatchedDevices() throws Exception {
     final ISchemaRegion schemaRegion = getSchemaRegion("root.laptop", 0);
-// 
+
     SchemaRegionTestUtil.createSimpleTimeSeriesByList(
-//         schemaRegion,
-//         Arrays.asList(
-//             "root.laptop.d0",
-//             "root.laptop.d1.s1",
-//             "root.laptop.d1.s2.t1",
-//             "root.laptop.d1.s3",
-//             "root.laptop.d2.s1",
-//             "root.laptop.d2.s2"));
-// 
-//     // CASE 01. Query a timeseries, result should be empty set.
-//     Assert.assertEquals(
+        schemaRegion,
+        Arrays.asList(
+            "root.laptop.d0",
+            "root.laptop.d1.s1",
+            "root.laptop.d1.s2.t1",
+            "root.laptop.d1.s3",
+            "root.laptop.d2.s1",
+            "root.laptop.d2.s2"));
+
+    // CASE 01. Query a timeseries, result should be empty set.
+    Assert.assertEquals(
         Collections.emptyList(),
         SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.laptop.d0")));
-// 
-//     // CASE 02. Query an existing device.
-//     Assert.assertEquals(
+
+    // CASE 02. Query an existing device.
+    Assert.assertEquals(
         Collections.singletonList(new ShowDevicesResult("root.laptop.d1", false, -1)),
         SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.laptop.d1")));
-//     Assert.assertEquals(
+    Assert.assertEquals(
         Collections.singletonList(new ShowDevicesResult("root.laptop.d2", false, -1)),
         SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.laptop.d2")));
-// 
-//     // CASE 03. Query an existing device, which has a sub device
-//     Assert.assertEquals(
+
+    // CASE 03. Query an existing device, which has a sub device
+    Assert.assertEquals(
         Collections.singletonList(new ShowDevicesResult("root.laptop", false, -1)),
         SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.laptop")));
-// 
-//     // CASE 04. Query devices using '*'
-//     Assert.assertEquals(
+
+    // CASE 04. Query devices using '*'
+    Assert.assertEquals(
         Collections.singletonList(new ShowDevicesResult("root.laptop", false, -1)),
         SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.*")));
-// 
-//     // CASE 05. Query all devices using 'root.**'
+
+    // CASE 05. Query all devices using 'root.**'
     List<IDeviceSchemaInfo> expectedList =
-//         Arrays.asList(
+        Arrays.asList(
             new ShowDevicesResult("root.laptop", false, -1),
             new ShowDevicesResult("root.laptop.d1", false, -1),
             new ShowDevicesResult("root.laptop.d2", false, -1),
             new ShowDevicesResult("root.laptop.d1.s2", false, -1));
     List<IDeviceSchemaInfo> actualResult =
         SchemaRegionTestUtil.getMatchedDevices(schemaRegion, new PartialPath("root.**"));
-//     // Compare hash sets because the order does not matter.
+    // Compare hash sets because the order does not matter.
     HashSet<IDeviceSchemaInfo> expectedHashset = new HashSet<>(expectedList);
     HashSet<IDeviceSchemaInfo> actualHashset = new HashSet<>(actualResult);
-//     Assert.assertEquals(expectedHashset, actualHashset);
-// 
... 7739 lines suppressed ...