You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2022/12/24 10:39:45 UTC

[iotdb] branch master updated: Delete more stale query code (#8600)

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

hui 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 82ceb3586f Delete more stale query code (#8600)
82ceb3586f is described below

commit 82ceb3586f8792613127d90a88e150a8cf8db4df
Author: liuminghui233 <36...@users.noreply.github.com>
AuthorDate: Sat Dec 24 18:39:37 2022 +0800

    Delete more stale query code (#8600)
---
 .../apache/iotdb/db/qp/sql/InfluxDBSqlParser.g4    |   29 +-
 .../main/java/org/apache/iotdb/tool/ImportCsv.java |    8 +-
 .../org/apache/iotdb/db/auth/AuthorityChecker.java |    2 +-
 .../org/apache/iotdb/db/conf/IoTDBDescriptor.java  |    2 +-
 .../org/apache/iotdb/db/constant/SqlConstant.java  |   66 +
 .../db/engine/querycontext/QueryDataSource.java    |    2 +-
 .../iotdb/db/engine/storagegroup/DataRegion.java   |    2 +-
 .../db/engine/storagegroup/TsFileResource.java     |   14 +-
 .../exception/index/DistanceMetricException.java   |   28 -
 .../index/IllegalIndexParamException.java          |   28 -
 .../db/exception/index/IndexManagerException.java  |   34 -
 .../db/exception/index/IndexRuntimeException.java  |   32 -
 .../db/exception/index/QueryIndexException.java    |   29 -
 .../exception/query/LogicalOperatorException.java  |   54 -
 .../exception/query/LogicalOptimizeException.java  |   46 -
 .../db/exception/query/OutOfTTLException.java      |    2 +-
 .../exception/query/PathNumOverLimitException.java |   33 -
 .../query/UnSupportedFillTypeException.java        |   33 -
 .../iotdb/db/exception/sql/SQLParserException.java |   35 -
 .../exception/sql/StatementAnalyzeException.java   |   13 -
 .../iotdb/db/index/common/IndexConstant.java       |   36 -
 .../apache/iotdb/db/index/common/IndexType.java    |   78 --
 .../apache/iotdb/db/index/common/IndexUtils.java   |   35 -
 .../iotdb/db/localconfignode/LocalConfigNode.java  |    2 +-
 .../db/metadata/utils/ResourceByPathUtils.java     |  151 ---
 .../timerangeiterator/AggrWindowIterator.java      |    4 +-
 .../TimeRangeIteratorFactory.java                  |    2 +-
 .../constant => common}/DataNodeEndPoints.java     |    7 +-
 .../db/mpp/common/filter/BasicFilterType.java      |  189 ---
 .../db/mpp/common/filter/BasicFunctionFilter.java  |  191 ---
 .../mpp/common/filter/FilterDeserializeUtil.java   |   63 -
 .../iotdb/db/mpp/common/filter/FunctionFilter.java |   91 --
 .../iotdb/db/mpp/common/filter/InFilter.java       |  230 ----
 .../iotdb/db/mpp/common/filter/LikeFilter.java     |  152 ---
 .../iotdb/db/mpp/common/filter/QueryFilter.java    |  354 -----
 .../iotdb/db/mpp/common/filter/RegexpFilter.java   |  150 --
 .../execution/operator/source/SeriesScanUtil.java  |   17 +-
 .../org/apache/iotdb/db/mpp/plan/Coordinator.java  |    2 +-
 .../db/mpp/plan/analyze/ExpressionAnalyzer.java    |   10 +-
 .../iotdb/db/mpp/plan/constant/FilterConstant.java |  103 --
 .../db/mpp/plan/execution/QueryExecution.java      |    2 +-
 .../execution/config/sys/sync/ShowPipeTask.java    |    2 +-
 .../iotdb/db/mpp/plan/expression/ResultColumn.java |  146 --
 .../visitor/OldIntermediateLayerVisitor.java       |  461 -------
 .../iotdb/db/mpp/plan/parser/ASTVisitor.java       |  216 ++-
 .../plan/parser/SqlParseError.java}                |    7 +-
 .../db/mpp/plan/parser/StatementGenerator.java     |   13 +-
 .../plan/planner/MemoryDistributionCalculator.java |    2 +-
 .../db/mpp/plan/planner/OperatorTreeGenerator.java |    2 +-
 .../SimpleFragmentParallelPlanner.java             |    2 +-
 .../db/mpp/plan/rewriter/DnfFilterOptimizer.java   |  163 ---
 .../db/mpp/plan/rewriter/IFilterOptimizer.java     |   29 -
 .../plan/rewriter/MergeSingleFilterOptimizer.java  |  179 ---
 .../db/mpp/plan/rewriter/RemoveNotOptimizer.java   |  103 --
 .../iotdb/db/mpp/plan/statement/Statement.java     |    1 -
 .../{constant => statement}/StatementType.java     |    2 +-
 .../plan/statement/component/SelectComponent.java  |    2 +-
 .../plan/statement/crud/DeleteDataStatement.java   |    2 +-
 .../crud/InsertMultiTabletsStatement.java          |    2 +-
 .../plan/statement/crud/InsertRowStatement.java    |    2 +-
 .../crud/InsertRowsOfOneDeviceStatement.java       |    2 +-
 .../plan/statement/crud/InsertRowsStatement.java   |    2 +-
 .../mpp/plan/statement/crud/InsertStatement.java   |    2 +-
 .../plan/statement/crud/InsertTabletStatement.java |    2 +-
 .../plan/statement/crud/LoadTsFileStatement.java   |    2 +-
 .../db/mpp/plan/statement/crud/QueryStatement.java |    2 +-
 .../InternalCreateTimeSeriesStatement.java         |    2 +-
 .../statement/internal/SchemaFetchStatement.java   |    2 +-
 .../metadata/AlterTimeSeriesStatement.java         |    2 +-
 .../plan/statement/metadata/CountStatement.java    |    2 +-
 .../metadata/CreateAlignedTimeSeriesStatement.java |    2 +-
 .../metadata/CreateContinuousQueryStatement.java   |    2 +-
 .../metadata/CreateFunctionStatement.java          |    2 +-
 .../metadata/CreateMultiTimeSeriesStatement.java   |    2 +-
 .../metadata/CreateTimeSeriesStatement.java        |    2 +-
 .../statement/metadata/CreateTriggerStatement.java |    2 +-
 .../metadata/DeleteStorageGroupStatement.java      |    2 +-
 .../metadata/DeleteTimeSeriesStatement.java        |    2 +-
 .../metadata/DropContinuousQueryStatement.java     |    2 +-
 .../statement/metadata/DropFunctionStatement.java  |    2 +-
 .../statement/metadata/DropTriggerStatement.java   |    2 +-
 .../metadata/SetStorageGroupStatement.java         |    2 +-
 .../plan/statement/metadata/SetTTLStatement.java   |    2 +-
 .../metadata/ShowContinuousQueriesStatement.java   |    2 +-
 .../mpp/plan/statement/metadata/ShowStatement.java |    2 +-
 .../plan/statement/metadata/UnSetTTLStatement.java |    2 +-
 .../template/ActivateTemplateStatement.java        |    2 +-
 .../template/CreateSchemaTemplateStatement.java    |    2 +-
 .../template/DeactivateTemplateStatement.java      |    2 +-
 .../template/DropSchemaTemplateStatement.java      |    2 +-
 .../template/SetSchemaTemplateStatement.java       |    2 +-
 .../ShowNodesInSchemaTemplateStatement.java        |    2 +-
 .../template/ShowPathSetTemplateStatement.java     |    2 +-
 .../template/ShowPathsUsingTemplateStatement.java  |    2 +-
 .../template/ShowSchemaTemplateStatement.java      |    2 +-
 .../template/UnsetSchemaTemplateStatement.java     |    2 +-
 .../db/mpp/plan/statement/sys/AuthorStatement.java |    2 +-
 .../plan/statement/sys/ClearCacheStatement.java    |    2 +-
 .../db/mpp/plan/statement/sys/FlushStatement.java  |    2 +-
 .../statement/sys/LoadConfigurationStatement.java  |    2 +-
 .../db/mpp/plan/statement/sys/MergeStatement.java  |    2 +-
 .../statement/sys/SetSystemStatusStatement.java    |    2 +-
 .../sys/sync/CreatePipeSinkStatement.java          |    2 +-
 .../statement/sys/sync/CreatePipeStatement.java    |    2 +-
 .../statement/sys/sync/DropPipeSinkStatement.java  |    2 +-
 .../plan/statement/sys/sync/DropPipeStatement.java |    2 +-
 .../statement/sys/sync/StartPipeStatement.java     |    2 +-
 .../plan/statement/sys/sync/StopPipeStatement.java |    2 +-
 .../db/mpp/transformation/dag/udf/UDTFContext.java |    8 -
 ...fluxSQLConstant.java => InfluxSqlConstant.java} |   15 +-
 .../influxdb/function/InfluxFunctionFactory.java   |   24 +-
 .../function/aggregator/InfluxCountFunction.java   |    4 +-
 .../function/aggregator/InfluxMeanFunction.java    |    4 +-
 .../function/aggregator/InfluxMedianFunction.java  |    4 +-
 .../function/aggregator/InfluxModeFunction.java    |    4 +-
 .../function/aggregator/InfluxSpreadFunction.java  |    4 +-
 .../function/aggregator/InfluxStddevFunction.java  |    4 +-
 .../function/aggregator/InfluxSumFunction.java     |    4 +-
 .../function/selector/InfluxFirstFunction.java     |    4 +-
 .../function/selector/InfluxLastFunction.java      |    4 +-
 .../function/selector/InfluxMaxFunction.java       |    4 +-
 .../function/selector/InfluxMinFunction.java       |    4 +-
 .../influxdb/handler/AbstractQueryHandler.java     |  202 +--
 .../protocol/influxdb/handler/NewQueryHandler.java |   20 +-
 .../protocol/influxdb/input/InfluxLineParser.java  |    2 +-
 .../influxdb/operator/InfluxQueryOperator.java     |   38 -
 .../influxdb/parser/InfluxDBAstVisitor.java        |  321 +++++
 .../InfluxDBStatementGenerator.java}               |   25 +-
 .../protocol/influxdb/sql/InfluxDBSqlVisitor.java  |  298 ----
 .../influxdb/statement/InfluxQueryStatement.java   |   57 +
 .../InfluxSelectComponent.java                     |   21 +-
 .../db/protocol/influxdb/util/FilterUtils.java     |   20 +-
 .../db/protocol/mqtt/PayloadFormatManager.java     |   19 +-
 .../db/protocol/rest/handler/ExceptionHandler.java |    3 +-
 .../rest/handler/ExecuteStatementHandler.java      |    2 +-
 .../iotdb/db/qp/constant/FilterConstant.java       |  114 --
 .../apache/iotdb/db/qp/constant/SQLConstant.java   |  285 ----
 .../org/apache/iotdb/db/qp/logical/Operator.java   |  200 ---
 .../db/qp/logical/crud/BasicFunctionOperator.java  |  172 ---
 .../db/qp/logical/crud/BasicOperatorType.java      |  191 ---
 .../iotdb/db/qp/logical/crud/FilterOperator.java   |  295 ----
 .../iotdb/db/qp/logical/crud/FromComponent.java    |   41 -
 .../iotdb/db/qp/logical/crud/FunctionOperator.java |   48 -
 .../iotdb/db/qp/logical/crud/QueryOperator.java    |  106 --
 .../iotdb/db/qp/logical/crud/SelectComponent.java  |  139 --
 .../db/qp/logical/crud/SpecialClauseComponent.java |  162 ---
 .../iotdb/db/qp/logical/crud/WhereComponent.java   |   40 -
 .../iotdb/db/qp/utils/GroupByLevelController.java  |  327 -----
 .../db/query/control/QueryResourceManager.java     |   14 -
 .../apache/iotdb/db/query/filter/TsFileFilter.java |   31 -
 .../query/reader/series/AlignedSeriesReader.java   |  109 --
 .../reader/series/SeriesRawDataBatchReader.java    |  140 --
 .../iotdb/db/query/reader/series/SeriesReader.java | 1430 --------------------
 .../thrift/impl/NewInfluxDBServiceImpl.java        |   17 +-
 .../java/org/apache/iotdb/db/sync/SyncService.java |    2 +-
 .../apache/iotdb/db/tools/IoTDBDataDirViewer.java  |    2 +-
 .../iotdb/db/tools/TsFileResourcePrinter.java      |    2 +-
 .../db/tools/watermark/WatermarkDetector.java      |    9 +-
 .../iotdb/db/utils/AlignedValueIterator.java       |   59 -
 .../org/apache/iotdb/db/utils/CommonUtils.java     |   10 +-
 .../iotdb/db/{qp => }/utils/DateTimeUtils.java     |    2 +-
 .../apache/iotdb/db/utils/ErrorHandlingUtils.java  |    4 -
 .../org/apache/iotdb/db/utils/FileLoaderUtils.java |   15 -
 .../java/org/apache/iotdb/db/utils/FilesUtils.java |   43 -
 .../iotdb/db/utils/IExpressionDeserializeUtil.java |   51 -
 .../apache/iotdb/db/utils/QueryDataSetUtils.java   |  133 --
 .../org/apache/iotdb/db/utils/SchemaUtils.java     |   20 +-
 .../apache/iotdb/db/utils/TypeInferenceUtils.java  |   46 +-
 .../org/apache/iotdb/db/utils/ValueIterator.java   |   56 -
 .../timerangeiterator/AggrWindowIterator.java      |  165 ---
 .../timerangeiterator/ITimeRangeIterator.java      |   39 -
 .../timerangeiterator/PreAggrWindowIterator.java   |  158 ---
 .../PreAggrWindowWithNaturalMonthIterator.java     |  123 --
 .../TimeRangeIteratorFactory.java                  |   69 -
 .../FastCrossCompactionPerformerTest.java          |   71 +-
 .../ReadPointCompactionPerformerTest.java          |   66 +-
 ...eCrossSpaceCompactionWithFastPerformerTest.java |  163 +--
 ...sSpaceCompactionWithReadPointPerformerTest.java |  163 +--
 .../inner/InnerCompactionMoreDataTest.java         |   28 +-
 .../SizeTieredCompactionRecoverTest.java           |  230 ++--
 .../compaction/utils/CompactionCheckerUtils.java   |   24 +-
 .../iotdb/db/engine/storagegroup/TTLTest.java      |   31 +-
 .../influxdb/sql/InfluxDBLogicalGeneratorTest.java |   70 -
 .../sql/InfluxDBStatementGeneratorTest.java        |   87 ++
 .../org/apache/iotdb/db/qp/sql/ASTVisitorTest.java |   10 +-
 .../db/qp/utils/DatetimeQueryDataSetUtilsTest.java |    2 +
 .../apache/iotdb/db/utils/EnvironmentUtils.java    |    3 +
 .../org/apache/iotdb/db/utils/SchemaUtilsTest.java |   12 +-
 .../iotdb/db/utils/TimeRangeIteratorTest.java      |  298 ----
 189 files changed, 1353 insertions(+), 9686 deletions(-)

diff --git a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/InfluxDBSqlParser.g4 b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/InfluxDBSqlParser.g4
index 381f3e2979..230b6f1346 100644
--- a/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/InfluxDBSqlParser.g4
+++ b/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/InfluxDBSqlParser.g4
@@ -51,20 +51,18 @@ expression
    ;
 
 whereClause
-    : WHERE orExpression
-    ;
-
-orExpression
-    : andExpression (OPERATOR_OR andExpression)*
-    ;
-
-andExpression
-    : predicate (OPERATOR_AND predicate)*
+    : WHERE predicate
     ;
 
 predicate
-    : (TIME | TIMESTAMP | nodeName ) comparisonOperator constant
-    | OPERATOR_NOT? LR_BRACKET orExpression RR_BRACKET
+    : LR_BRACKET predicateInBracket=predicate RR_BRACKET
+    | constant
+    | time=(TIME | TIMESTAMP)
+    | nodeName
+    | OPERATOR_NOT predicateAfterUnaryOperator=predicate
+    | leftPredicate=predicate (OPERATOR_GT | OPERATOR_GTE | OPERATOR_LT | OPERATOR_LTE | OPERATOR_SEQ | OPERATOR_NEQ) rightPredicate=predicate
+    | leftPredicate=predicate OPERATOR_AND rightPredicate=predicate
+    | leftPredicate=predicate OPERATOR_OR rightPredicate=predicate
     ;
 
 fromClause
@@ -96,15 +94,6 @@ functionAttribute
     : COMMA functionAttributeKey=STRING_LITERAL OPERATOR_SEQ functionAttributeValue=STRING_LITERAL
     ;
 
-comparisonOperator
-    : type = OPERATOR_GT
-    | type = OPERATOR_GTE
-    | type = OPERATOR_LT
-    | type = OPERATOR_LTE
-    | type = OPERATOR_SEQ
-    | type = OPERATOR_NEQ
-    ;
-
 // Expression & Predicate
 
 dateExpression
diff --git a/cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java b/cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
index d009125b83..90b5b94348 100644
--- a/cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
+++ b/cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.tool;
 
 import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.utils.PathUtils;
+import org.apache.iotdb.db.constant.SqlConstant;
 import org.apache.iotdb.db.mpp.common.header.ColumnHeaderConstant;
-import org.apache.iotdb.db.qp.constant.SQLConstant;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.exception.ArgsErrorException;
 import org.apache.iotdb.isession.SessionDataSet;
 import org.apache.iotdb.rpc.IoTDBConnectionException;
@@ -930,8 +930,8 @@ public class ImportCsv extends AbstractCsvTool {
   }
 
   private static boolean isBoolean(String s) {
-    return s.equalsIgnoreCase(SQLConstant.BOOLEAN_TRUE)
-        || s.equalsIgnoreCase(SQLConstant.BOOLEAN_FALSE);
+    return s.equalsIgnoreCase(SqlConstant.BOOLEAN_TRUE)
+        || s.equalsIgnoreCase(SqlConstant.BOOLEAN_FALSE);
   }
 
   private static boolean isConvertFloatPrecisionLack(String s) {
diff --git a/server/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java b/server/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
index f5fe25bbc6..d240b3e545 100644
--- a/server/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
+++ b/server/src/main/java/org/apache/iotdb/db/auth/AuthorityChecker.java
@@ -25,8 +25,8 @@ import org.apache.iotdb.commons.conf.CommonDescriptor;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.utils.AuthUtils;
 import org.apache.iotdb.db.conf.OperationType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.sys.AuthorStatement;
 import org.apache.iotdb.db.query.control.clientsession.IClientSession;
 import org.apache.iotdb.rpc.RpcUtils;
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index 678c26da0f..b4b4708028 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -37,9 +37,9 @@ import org.apache.iotdb.db.engine.compaction.constant.InnerSequenceCompactionSel
 import org.apache.iotdb.db.engine.compaction.constant.InnerUnseqCompactionPerformer;
 import org.apache.iotdb.db.engine.compaction.constant.InnerUnsequenceCompactionSelector;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
 import org.apache.iotdb.db.rescon.SystemInfo;
 import org.apache.iotdb.db.service.metrics.IoTDBInternalReporter;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.db.utils.datastructure.TVListSortAlgorithm;
 import org.apache.iotdb.db.wal.WALManager;
 import org.apache.iotdb.db.wal.utils.WALMode;
diff --git a/server/src/main/java/org/apache/iotdb/db/constant/SqlConstant.java b/server/src/main/java/org/apache/iotdb/db/constant/SqlConstant.java
new file mode 100644
index 0000000000..b41481d739
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/constant/SqlConstant.java
@@ -0,0 +1,66 @@
+/*
+ * 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.constant;
+
+import org.apache.iotdb.commons.path.PartialPath;
+
+/** this class contains several constants used in SQL. */
+public class SqlConstant {
+
+  protected SqlConstant() {
+    // forbidding instantiation
+  }
+
+  private static final String[] SINGLE_ROOT_ARRAY = {"root", "**"};
+  private static final String[] SINGLE_TIME_ARRAY = {"time"};
+  public static final PartialPath TIME_PATH = new PartialPath(SINGLE_TIME_ARRAY);
+  public static final String RESERVED_TIME = "time";
+  public static final String NOW_FUNC = "now()";
+
+  public static final String ROOT = "root";
+  public static final String QUOTE = "'";
+  public static final String DQUOTE = "\"";
+  public static final String BOOLEAN_TRUE = "true";
+  public static final String BOOLEAN_FALSE = "false";
+  public static final String BOOLEAN_TRUE_NUM = "1";
+  public static final String BOOLEAN_FALSE_NUM = "0";
+
+  // names of aggregations
+  public static final String MIN_TIME = "min_time";
+  public static final String MAX_TIME = "max_time";
+  public static final String MAX_VALUE = "max_value";
+  public static final String MIN_VALUE = "min_value";
+  public static final String EXTREME = "extreme";
+  public static final String FIRST_VALUE = "first_value";
+  public static final String LAST_VALUE = "last_value";
+  public static final String COUNT = "count";
+  public static final String AVG = "avg";
+  public static final String SUM = "sum";
+
+  public static final String LAST = "last";
+
+  public static String[] getSingleRootArray() {
+    return SINGLE_ROOT_ARRAY;
+  }
+
+  public static boolean isReservedPath(PartialPath pathStr) {
+    return pathStr.equals(TIME_PATH);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/querycontext/QueryDataSource.java b/server/src/main/java/org/apache/iotdb/db/engine/querycontext/QueryDataSource.java
index 63db473dc1..ce66828b20 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/querycontext/QueryDataSource.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/querycontext/QueryDataSource.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.engine.querycontext;
 
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.tsfile.read.filter.TimeFilter;
 import org.apache.iotdb.tsfile.read.filter.basic.Filter;
 import org.apache.iotdb.tsfile.read.filter.operator.AndFilter;
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
index 353f546c92..32bc40dae1 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
@@ -76,7 +76,6 @@ import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowNode;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowsNode;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowsOfOneDeviceNode;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertTabletNode;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
 import org.apache.iotdb.db.query.context.QueryContext;
 import org.apache.iotdb.db.query.control.FileReaderManager;
 import org.apache.iotdb.db.rescon.TsFileResourceManager;
@@ -85,6 +84,7 @@ import org.apache.iotdb.db.sync.SyncService;
 import org.apache.iotdb.db.sync.sender.manager.ISyncManager;
 import org.apache.iotdb.db.tools.settle.TsFileAndModSettleTool;
 import org.apache.iotdb.db.utils.CopyOnReadLinkedList;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.db.utils.UpgradeUtils;
 import org.apache.iotdb.db.wal.WALManager;
 import org.apache.iotdb.db.wal.node.IWALNode;
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
index a73ada0e33..2ada09d2c8 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
@@ -35,9 +35,8 @@ import org.apache.iotdb.db.engine.storagegroup.timeindex.V012FileTimeIndex;
 import org.apache.iotdb.db.engine.upgrade.UpgradeTask;
 import org.apache.iotdb.db.exception.PartitionViolationException;
 import org.apache.iotdb.db.metadata.utils.ResourceByPathUtils;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
-import org.apache.iotdb.db.query.filter.TsFileFilter;
 import org.apache.iotdb.db.service.UpgradeSevice;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.file.metadata.IChunkMetadata;
 import org.apache.iotdb.tsfile.file.metadata.ITimeSeriesMetadata;
@@ -700,16 +699,7 @@ public class TsFileResource {
   }
 
   /** @return true if the device is contained in the TsFile */
-  public boolean isSatisfied(
-      String deviceId, Filter timeFilter, TsFileFilter fileFilter, boolean isSeq, boolean debug) {
-    if (fileFilter != null && fileFilter.fileNotSatisfy(this)) {
-      if (debug) {
-        DEBUG_LOGGER.info(
-            "Path: {} file {} is not satisfied because of fileFilter!", deviceId, file);
-      }
-      return false;
-    }
-
+  public boolean isSatisfied(String deviceId, Filter timeFilter, boolean isSeq, boolean debug) {
     if (!mayContainsDevice(deviceId)) {
       if (debug) {
         DEBUG_LOGGER.info(
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/index/DistanceMetricException.java b/server/src/main/java/org/apache/iotdb/db/exception/index/DistanceMetricException.java
deleted file mode 100644
index f1180a78a8..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/exception/index/DistanceMetricException.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.index;
-
-public class DistanceMetricException extends IndexRuntimeException {
-
-  private static final long serialVersionUID = -2772568110478978387L;
-
-  public DistanceMetricException(String message) {
-    super(message);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/index/IllegalIndexParamException.java b/server/src/main/java/org/apache/iotdb/db/exception/index/IllegalIndexParamException.java
deleted file mode 100644
index 4d01db83a4..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/exception/index/IllegalIndexParamException.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.index;
-
-public class IllegalIndexParamException extends IndexRuntimeException {
-
-  private static final long serialVersionUID = -5037203268436084405L;
-
-  public IllegalIndexParamException(String message) {
-    super(message);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/index/IndexManagerException.java b/server/src/main/java/org/apache/iotdb/db/exception/index/IndexManagerException.java
deleted file mode 100644
index c86e4a9948..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/exception/index/IndexManagerException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.index;
-
-import org.apache.iotdb.commons.exception.IoTDBException;
-import org.apache.iotdb.db.exception.query.QueryProcessException;
-
-public class IndexManagerException extends QueryProcessException {
-
-  private static final long serialVersionUID = 1233035822169501915L;
-
-  public IndexManagerException(String message) {
-    super(message);
-  }
-
-  public IndexManagerException(IoTDBException e) {
-    super(e);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/index/IndexRuntimeException.java b/server/src/main/java/org/apache/iotdb/db/exception/index/IndexRuntimeException.java
deleted file mode 100644
index 6cc5403758..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/exception/index/IndexRuntimeException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.index;
-
-public class IndexRuntimeException extends RuntimeException {
-
-  private static final long serialVersionUID = 5946611722012179976L;
-
-  public IndexRuntimeException(String message, Throwable cause) {
-    super(message, cause);
-  }
-
-  public IndexRuntimeException(String message) {
-    super(message);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/index/QueryIndexException.java b/server/src/main/java/org/apache/iotdb/db/exception/index/QueryIndexException.java
deleted file mode 100644
index 7b8b8cf1d2..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/exception/index/QueryIndexException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.index;
-
-import org.apache.iotdb.db.exception.query.QueryProcessException;
-
-public class QueryIndexException extends QueryProcessException {
-
-  private static final long serialVersionUID = 9019233783504576296L;
-
-  public QueryIndexException(String message, int errorCode) {
-    super(message, errorCode);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/query/LogicalOperatorException.java b/server/src/main/java/org/apache/iotdb/db/exception/query/LogicalOperatorException.java
deleted file mode 100644
index 5a52ce6b02..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/exception/query/LogicalOperatorException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.query;
-
-import org.apache.iotdb.commons.exception.IoTDBException;
-import org.apache.iotdb.rpc.TSStatusCode;
-
-/**
- * This exception is thrown while meeting error in transforming logical operator to physical plan.
- */
-public class LogicalOperatorException extends QueryProcessException {
-
-  private static final long serialVersionUID = 7573857366601268706L;
-
-  public LogicalOperatorException() {
-    super(
-        "Error format in SQL statement, please check whether SQL statement is correct.",
-        TSStatusCode.LOGICAL_OPERATOR_ERROR.getStatusCode());
-  }
-
-  public LogicalOperatorException(String message) {
-    super(message, TSStatusCode.LOGICAL_OPERATOR_ERROR.getStatusCode());
-  }
-
-  public LogicalOperatorException(String message, int errorCode) {
-    super(message, errorCode);
-  }
-
-  public LogicalOperatorException(String type, String message) {
-    super(
-        String.format("Unsupported type: [%s]. %s", type, message),
-        TSStatusCode.LOGICAL_OPERATOR_ERROR.getStatusCode());
-  }
-
-  public LogicalOperatorException(IoTDBException e) {
-    super(e);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/query/LogicalOptimizeException.java b/server/src/main/java/org/apache/iotdb/db/exception/query/LogicalOptimizeException.java
deleted file mode 100644
index 1316338987..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/exception/query/LogicalOptimizeException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.query;
-
-import org.apache.iotdb.commons.exception.IoTDBException;
-import org.apache.iotdb.db.qp.constant.FilterConstant;
-import org.apache.iotdb.db.qp.constant.FilterConstant.FilterType;
-import org.apache.iotdb.rpc.TSStatusCode;
-
-/** This exception is thrown while meeting error in optimizing logical operator. */
-public class LogicalOptimizeException extends LogicalOperatorException {
-
-  private static final long serialVersionUID = -7098092782689670064L;
-
-  public LogicalOptimizeException(String message) {
-    super(message, TSStatusCode.LOGICAL_OPTIMIZE_ERROR.getStatusCode());
-  }
-
-  public LogicalOptimizeException(String filterOperator, FilterType filterType) {
-    super(
-        String.format(
-            "Unknown token in [%s]: [%s], [%s].",
-            filterOperator, filterType, FilterConstant.filterNames.get(filterType)),
-        TSStatusCode.LOGICAL_OPTIMIZE_ERROR.getStatusCode());
-  }
-
-  public LogicalOptimizeException(IoTDBException e) {
-    super(e);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/query/OutOfTTLException.java b/server/src/main/java/org/apache/iotdb/db/exception/query/OutOfTTLException.java
index ed769e0c8d..d2144f07b4 100644
--- a/server/src/main/java/org/apache/iotdb/db/exception/query/OutOfTTLException.java
+++ b/server/src/main/java/org/apache/iotdb/db/exception/query/OutOfTTLException.java
@@ -21,7 +21,7 @@
 package org.apache.iotdb.db.exception.query;
 
 import org.apache.iotdb.db.exception.WriteProcessException;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
 
 public class OutOfTTLException extends WriteProcessException {
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/query/PathNumOverLimitException.java b/server/src/main/java/org/apache/iotdb/db/exception/query/PathNumOverLimitException.java
deleted file mode 100644
index 27f208f99f..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/exception/query/PathNumOverLimitException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.query;
-
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-
-public class PathNumOverLimitException extends QueryProcessException {
-
-  public PathNumOverLimitException() {
-    super(
-        String.format(
-            "Too many paths in one query! Currently allowed max deduplicated path number is %d. "
-                + "Please use slimit or adjust max_deduplicated_path_num in iotdb-common.properties.",
-            IoTDBDescriptor.getInstance().getConfig().getMaxQueryDeduplicatedPathNum()));
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/query/UnSupportedFillTypeException.java b/server/src/main/java/org/apache/iotdb/db/exception/query/UnSupportedFillTypeException.java
deleted file mode 100644
index 05cdca67d0..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/exception/query/UnSupportedFillTypeException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.query;
-
-import org.apache.iotdb.rpc.TSStatusCode;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-
-public class UnSupportedFillTypeException extends QueryProcessException {
-
-  private static final long serialVersionUID = 2166251102397630376L;
-
-  public UnSupportedFillTypeException(TSDataType dataType) {
-    super(
-        String.format("Unsupported linear fill data type: [%s]", dataType),
-        TSStatusCode.UNSUPPORTED_FILL_TYPE.getStatusCode());
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/sql/SQLParserException.java b/server/src/main/java/org/apache/iotdb/db/exception/sql/SQLParserException.java
deleted file mode 100644
index 0820a11650..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/exception/sql/SQLParserException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.sql;
-
-public class SQLParserException extends RuntimeException {
-  private static final long serialVersionUID = 3249707655860110299L;
-
-  public SQLParserException() {
-    super("Error format in SQL statement, please check whether SQL statement is correct.");
-  }
-
-  public SQLParserException(String message) {
-    super(message);
-  }
-
-  public SQLParserException(String type, String message) {
-    super(String.format("Unsupported type: [%s]. " + message, type));
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/exception/sql/StatementAnalyzeException.java b/server/src/main/java/org/apache/iotdb/db/exception/sql/StatementAnalyzeException.java
index 0dd8b25134..3ca1e397c3 100644
--- a/server/src/main/java/org/apache/iotdb/db/exception/sql/StatementAnalyzeException.java
+++ b/server/src/main/java/org/apache/iotdb/db/exception/sql/StatementAnalyzeException.java
@@ -19,25 +19,12 @@
 
 package org.apache.iotdb.db.exception.sql;
 
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant;
-
 public class StatementAnalyzeException extends RuntimeException {
 
   public StatementAnalyzeException(String message) {
     super(message);
   }
 
-  public StatementAnalyzeException(String filterOperator, FilterConstant.FilterType filterType) {
-    super(
-        String.format(
-            "Unknown token in [%s]: [%s], [%s].",
-            filterOperator, filterType, FilterConstant.filterNames.get(filterType)));
-  }
-
-  public StatementAnalyzeException(String type, String message) {
-    super(String.format("Unsupported type: [%s]. %s", type, message));
-  }
-
   public StatementAnalyzeException(Exception cause) {
     super(cause);
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/index/common/IndexConstant.java b/server/src/main/java/org/apache/iotdb/db/index/common/IndexConstant.java
deleted file mode 100644
index d971aa7f90..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/index/common/IndexConstant.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.index.common;
-
-public class IndexConstant {
-
-  // whole matching
-  public static final int NON_SET_TOP_K = -1;
-  public static final String TOP_K = "TOP_K";
-
-  public static final String PATTERN = "PATTERN";
-  public static final String THRESHOLD = "THRESHOLD";
-
-  // RTree PAA parameters
-  public static final String PAA_DIM = "PAA_DIM";
-
-  // ELB: calc param
-  public static final String BLOCK_SIZE = "BLOCK_SIZE";
-
-  private IndexConstant() {}
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/index/common/IndexType.java b/server/src/main/java/org/apache/iotdb/db/index/common/IndexType.java
deleted file mode 100644
index 359b5422b4..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/index/common/IndexType.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.index.common;
-
-import org.apache.iotdb.tsfile.exception.NotImplementedException;
-
-public enum IndexType {
-  NO_INDEX,
-  RTREE_PAA,
-  ELB_INDEX,
-  KV_INDEX;
-
-  /**
-   * judge the index type.
-   *
-   * @param i an integer used to determine index type
-   * @return index type
-   */
-  public static IndexType deserialize(short i) {
-    switch (i) {
-      case 0:
-        return NO_INDEX;
-      case 1:
-        return RTREE_PAA;
-      case 2:
-        return ELB_INDEX;
-      case 3:
-        return KV_INDEX;
-      default:
-        throw new NotImplementedException("Given index is not implemented");
-    }
-  }
-
-  public static int getSerializedSize() {
-    return Short.BYTES;
-  }
-
-  /**
-   * judge the index deserialize type.
-   *
-   * @return the integer used to determine index type
-   */
-  public short serialize() {
-    switch (this) {
-      case NO_INDEX:
-        return 0;
-      case RTREE_PAA:
-        return 1;
-      case ELB_INDEX:
-        return 2;
-      case KV_INDEX:
-        return 3;
-      default:
-        throw new NotImplementedException("Given index is not implemented");
-    }
-  }
-
-  public static IndexType getIndexType(String indexTypeString) {
-    String normalized = indexTypeString.toUpperCase();
-    return IndexType.valueOf(normalized);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/index/common/IndexUtils.java b/server/src/main/java/org/apache/iotdb/db/index/common/IndexUtils.java
deleted file mode 100644
index 98809f0eef..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/index/common/IndexUtils.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.index.common;
-
-public class IndexUtils {
-
-  public static String removeQuotation(String v) {
-    int start = 0;
-    int end = v.length();
-    if (v.startsWith("'") || v.startsWith("\"")) {
-      start = 1;
-    }
-    if (v.endsWith("'") || v.endsWith("\"")) {
-      end = v.length() - 1;
-    }
-    return v.substring(start, end);
-  }
-
-  private IndexUtils() {}
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java b/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java
index df3bc380a0..143ff4cc31 100644
--- a/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java
@@ -76,7 +76,7 @@ import org.apache.iotdb.db.metadata.schemaregion.SchemaEngine;
 import org.apache.iotdb.db.metadata.storagegroup.IStorageGroupSchemaManager;
 import org.apache.iotdb.db.metadata.storagegroup.StorageGroupSchemaManager;
 import org.apache.iotdb.db.metadata.utils.MetaUtils;
-import org.apache.iotdb.db.mpp.plan.constant.DataNodeEndPoints;
+import org.apache.iotdb.db.mpp.common.DataNodeEndPoints;
 import org.apache.iotdb.db.mpp.plan.statement.AuthorType;
 import org.apache.iotdb.db.mpp.plan.statement.sys.AuthorStatement;
 import org.apache.iotdb.db.mpp.plan.statement.sys.sync.CreatePipeSinkStatement;
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/utils/ResourceByPathUtils.java b/server/src/main/java/org/apache/iotdb/db/metadata/utils/ResourceByPathUtils.java
index f13b173bce..fedf352383 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/utils/ResourceByPathUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/utils/ResourceByPathUtils.java
@@ -21,7 +21,6 @@ package org.apache.iotdb.db.metadata.utils;
 import org.apache.iotdb.commons.path.AlignedPath;
 import org.apache.iotdb.commons.path.MeasurementPath;
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.commons.utils.TestOnly;
 import org.apache.iotdb.db.engine.memtable.AlignedWritableMemChunk;
 import org.apache.iotdb.db.engine.memtable.AlignedWritableMemChunkGroup;
 import org.apache.iotdb.db.engine.memtable.IMemTable;
@@ -31,16 +30,12 @@ import org.apache.iotdb.db.engine.modification.Deletion;
 import org.apache.iotdb.db.engine.modification.Modification;
 import org.apache.iotdb.db.engine.modification.ModificationFile;
 import org.apache.iotdb.db.engine.querycontext.AlignedReadOnlyMemChunk;
-import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
 import org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
 import org.apache.iotdb.db.metadata.idtable.entry.DeviceIDFactory;
 import org.apache.iotdb.db.metadata.idtable.entry.IDeviceID;
 import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.query.filter.TsFileFilter;
-import org.apache.iotdb.db.query.reader.series.AlignedSeriesReader;
-import org.apache.iotdb.db.query.reader.series.SeriesReader;
 import org.apache.iotdb.db.utils.QueryUtils;
 import org.apache.iotdb.db.utils.datastructure.TVList;
 import org.apache.iotdb.tsfile.file.metadata.AlignedChunkMetadata;
@@ -53,7 +48,6 @@ import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
 import org.apache.iotdb.tsfile.file.metadata.statistics.Statistics;
 import org.apache.iotdb.tsfile.read.common.TimeRange;
-import org.apache.iotdb.tsfile.read.filter.basic.Filter;
 import org.apache.iotdb.tsfile.utils.Pair;
 import org.apache.iotdb.tsfile.write.schema.IMeasurementSchema;
 import org.apache.iotdb.tsfile.write.schema.VectorMeasurementSchema;
@@ -64,7 +58,6 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import static org.apache.iotdb.commons.path.AlignedPath.VECTOR_PLACEHOLDER;
 
@@ -83,33 +76,6 @@ public abstract class ResourceByPathUtils {
     throw new UnsupportedOperationException("Should call exact sub class!");
   }
 
-  public abstract SeriesReader createSeriesReader(
-      Set<String> allSensors,
-      TSDataType dataType,
-      QueryContext context,
-      QueryDataSource dataSource,
-      Filter timeFilter,
-      Filter valueFilter,
-      TsFileFilter fileFilter,
-      boolean ascending);
-
-  @TestOnly
-  public abstract SeriesReader createSeriesReader(
-      Set<String> allSensors,
-      TSDataType dataType,
-      QueryContext context,
-      List<TsFileResource> seqFileResource,
-      List<TsFileResource> unseqFileResource,
-      Filter timeFilter,
-      Filter valueFilter,
-      boolean ascending);
-
-  public abstract TsFileResource createTsFileResource(
-      List<ReadOnlyMemChunk> readOnlyMemChunk,
-      List<IChunkMetadata> chunkMetadataList,
-      TsFileResource originTsFileResource)
-      throws IOException;
-
   public abstract ITimeSeriesMetadata generateTimeSeriesMetadata(
       List<ReadOnlyMemChunk> readOnlyMemChunk, List<IChunkMetadata> chunkMetadataList)
       throws IOException;
@@ -144,64 +110,6 @@ class AlignedResourceByPathUtils extends ResourceByPathUtils {
     this.partialPath = (AlignedPath) partialPath;
   }
 
-  @Override
-  public AlignedSeriesReader createSeriesReader(
-      Set<String> allSensors,
-      TSDataType dataType,
-      QueryContext context,
-      QueryDataSource dataSource,
-      Filter timeFilter,
-      Filter valueFilter,
-      TsFileFilter fileFilter,
-      boolean ascending) {
-    return new AlignedSeriesReader(
-        partialPath,
-        allSensors,
-        dataType,
-        context,
-        dataSource,
-        timeFilter,
-        valueFilter,
-        fileFilter,
-        ascending);
-  }
-
-  @Override
-  @TestOnly
-  public AlignedSeriesReader createSeriesReader(
-      Set<String> allSensors,
-      TSDataType dataType,
-      QueryContext context,
-      List<TsFileResource> seqFileResource,
-      List<TsFileResource> unseqFileResource,
-      Filter timeFilter,
-      Filter valueFilter,
-      boolean ascending) {
-    return new AlignedSeriesReader(
-        partialPath,
-        allSensors,
-        dataType,
-        context,
-        seqFileResource,
-        unseqFileResource,
-        timeFilter,
-        valueFilter,
-        ascending);
-  }
-
-  @Override
-  public TsFileResource createTsFileResource(
-      List<ReadOnlyMemChunk> readOnlyMemChunk,
-      List<IChunkMetadata> chunkMetadataList,
-      TsFileResource originTsFileResource)
-      throws IOException {
-    TsFileResource tsFileResource =
-        new TsFileResource(partialPath, readOnlyMemChunk, chunkMetadataList, originTsFileResource);
-    tsFileResource.setTimeSeriesMetadata(
-        partialPath, generateTimeSeriesMetadata(readOnlyMemChunk, chunkMetadataList));
-    return tsFileResource;
-  }
-
   /**
    * Because the unclosed tsfile don't have TimeSeriesMetadata and memtables in the memory don't
    * have chunkMetadata, but query will use these, so we need to generate it for them.
@@ -398,65 +306,6 @@ class MeasurementResourceByPathUtils extends ResourceByPathUtils {
     this.partialPath = (MeasurementPath) partialPath;
   }
 
-  @Override
-  public SeriesReader createSeriesReader(
-      Set<String> allSensors,
-      TSDataType dataType,
-      QueryContext context,
-      QueryDataSource dataSource,
-      Filter timeFilter,
-      Filter valueFilter,
-      TsFileFilter fileFilter,
-      boolean ascending) {
-    return new SeriesReader(
-        partialPath,
-        allSensors,
-        dataType,
-        context,
-        dataSource,
-        timeFilter,
-        valueFilter,
-        fileFilter,
-        ascending);
-  }
-
-  @Override
-  @TestOnly
-  public SeriesReader createSeriesReader(
-      Set<String> allSensors,
-      TSDataType dataType,
-      QueryContext context,
-      List<TsFileResource> seqFileResource,
-      List<TsFileResource> unseqFileResource,
-      Filter timeFilter,
-      Filter valueFilter,
-      boolean ascending) {
-    allSensors.add(partialPath.getMeasurement());
-    return new SeriesReader(
-        partialPath,
-        allSensors,
-        dataType,
-        context,
-        seqFileResource,
-        unseqFileResource,
-        timeFilter,
-        valueFilter,
-        ascending);
-  }
-
-  @Override
-  public TsFileResource createTsFileResource(
-      List<ReadOnlyMemChunk> readOnlyMemChunk,
-      List<IChunkMetadata> chunkMetadataList,
-      TsFileResource originTsFileResource)
-      throws IOException {
-    TsFileResource tsFileResource =
-        new TsFileResource(partialPath, readOnlyMemChunk, chunkMetadataList, originTsFileResource);
-    tsFileResource.setTimeSeriesMetadata(
-        partialPath, generateTimeSeriesMetadata(readOnlyMemChunk, chunkMetadataList));
-    return tsFileResource;
-  }
-
   /**
    * Because the unclosed tsfile don't have TimeSeriesMetadata and memtables in the memory don't
    * have chunkMetadata, but query will use these, so we need to generate it for them.
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/timerangeiterator/AggrWindowIterator.java b/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/timerangeiterator/AggrWindowIterator.java
index e66ca4c528..8a2c9a6b06 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/timerangeiterator/AggrWindowIterator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/timerangeiterator/AggrWindowIterator.java
@@ -19,10 +19,10 @@
 
 package org.apache.iotdb.db.mpp.aggregation.timerangeiterator;
 
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.tsfile.read.common.TimeRange;
 
-import static org.apache.iotdb.db.qp.utils.DateTimeUtils.MS_TO_MONTH;
+import static org.apache.iotdb.db.utils.DateTimeUtils.MS_TO_MONTH;
 
 /**
  * This class iteratively generates aggregated time windows.
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/timerangeiterator/TimeRangeIteratorFactory.java b/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/timerangeiterator/TimeRangeIteratorFactory.java
index a86a513936..6ba2138956 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/timerangeiterator/TimeRangeIteratorFactory.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/aggregation/timerangeiterator/TimeRangeIteratorFactory.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.db.mpp.aggregation.timerangeiterator;
 
-import static org.apache.iotdb.db.qp.utils.DateTimeUtils.MS_TO_MONTH;
+import static org.apache.iotdb.db.utils.DateTimeUtils.MS_TO_MONTH;
 
 public class TimeRangeIteratorFactory {
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/constant/DataNodeEndPoints.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/DataNodeEndPoints.java
similarity index 93%
rename from server/src/main/java/org/apache/iotdb/db/mpp/plan/constant/DataNodeEndPoints.java
rename to server/src/main/java/org/apache/iotdb/db/mpp/common/DataNodeEndPoints.java
index 5e8ec756a9..c01fe15946 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/constant/DataNodeEndPoints.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/DataNodeEndPoints.java
@@ -17,12 +17,17 @@
  * under the License.
  */
 
-package org.apache.iotdb.db.mpp.plan.constant;
+package org.apache.iotdb.db.mpp.common;
 
 import org.apache.iotdb.common.rpc.thrift.TEndPoint;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 
 public class DataNodeEndPoints {
+
+  private DataNodeEndPoints() {
+    // forbidding instantiation
+  }
+
   public static final TEndPoint LOCAL_HOST_DATA_BLOCK_ENDPOINT =
       new TEndPoint(
           IoTDBDescriptor.getInstance().getConfig().getInternalAddress(),
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/BasicFilterType.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/BasicFilterType.java
deleted file mode 100644
index 99092ed639..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/BasicFilterType.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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.mpp.common.filter;
-
-import org.apache.iotdb.db.exception.sql.SQLParserException;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant.FilterType;
-import org.apache.iotdb.tsfile.read.common.Path;
-import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
-import org.apache.iotdb.tsfile.read.expression.impl.GlobalTimeExpression;
-import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
-import org.apache.iotdb.tsfile.read.filter.TimeFilter;
-import org.apache.iotdb.tsfile.read.filter.ValueFilter;
-import org.apache.iotdb.tsfile.read.filter.basic.Filter;
-
-import static org.apache.iotdb.commons.conf.IoTDBConstant.TIME;
-
-/** all basic operator in filter. */
-public enum BasicFilterType {
-  EQ {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.eq((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.eq(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.eq(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.eq(value);
-    }
-  },
-  LTEQ {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.ltEq((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.ltEq(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.ltEq(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.ltEq(value);
-    }
-  },
-  LT {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.lt((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.lt(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.lt(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.lt(value);
-    }
-  },
-  GTEQ {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.gtEq((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.gtEq(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.gtEq(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.gtEq(value);
-    }
-  },
-  GT {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.gt((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.gt(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.gt(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.gt(value);
-    }
-  },
-  NOTEQUAL {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.notEq((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.notEq(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.notEq(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.notEq(value);
-    }
-  };
-
-  /**
-   * BasicFilterType Constructor.
-   *
-   * @param filterType token in Int Type
-   * @return basic operator type
-   */
-  public static BasicFilterType getBasicOpBySymbol(FilterType filterType)
-      throws SQLParserException {
-    switch (filterType) {
-      case EQUAL:
-        return EQ;
-      case LESSTHANOREQUALTO:
-        return LTEQ;
-      case LESSTHAN:
-        return LT;
-      case GREATERTHANOREQUALTO:
-        return GTEQ;
-      case GREATERTHAN:
-        return GT;
-      case NOTEQUAL:
-        return NOTEQUAL;
-      default:
-        throw new SQLParserException(
-            "unsupported type:{}" + FilterConstant.filterNames.get(filterType));
-    }
-  }
-
-  public abstract <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value);
-
-  public abstract <T extends Comparable<T>> Filter getValueFilter(T tsPrimitiveType);
-
-  public abstract Filter getTimeFilter(long value);
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/BasicFunctionFilter.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/BasicFunctionFilter.java
deleted file mode 100644
index 6193508ef7..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/BasicFunctionFilter.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.mpp.common.filter;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.sql.SQLParserException;
-import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant.FilterType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
-import org.apache.iotdb.tsfile.utils.Binary;
-import org.apache.iotdb.tsfile.utils.Pair;
-import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
-import org.apache.iotdb.tsfile.utils.StringContainer;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.nio.ByteBuffer;
-import java.util.Map;
-import java.util.Objects;
-
-/** basic operator includes = < > >= <= !=. */
-public class BasicFunctionFilter extends FunctionFilter {
-
-  protected String value;
-  private final Logger logger = LoggerFactory.getLogger(BasicFunctionFilter.class);
-  private BasicFilterType funcToken;
-
-  /**
-   * BasicFunctionFilter Constructor.
-   *
-   * @param filterType filter Type
-   * @param path path
-   * @param value value
-   * @throws SQLParserException SQL Parser Exception
-   */
-  public BasicFunctionFilter(FilterType filterType, PartialPath path, String value)
-      throws SQLParserException {
-    super(filterType);
-    funcToken = BasicFilterType.getBasicOpBySymbol(filterType);
-    this.singlePath = path;
-    this.value = value;
-    isLeaf = true;
-    isSingle = true;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  @Override
-  public void reverseFunc() {
-    FilterType filterType = FilterConstant.filterReverseWords.get(this.filterType);
-    setFilterType(filterType);
-    funcToken = BasicFilterType.getBasicOpBySymbol(filterType);
-  }
-
-  @Override
-  protected Pair<IUnaryExpression, String> transformToSingleQueryFilter(
-      Map<PartialPath, TSDataType> pathTSDataTypeHashMap)
-      throws StatementAnalyzeException, MetadataException {
-    TSDataType type = pathTSDataTypeHashMap.get(singlePath);
-    if (type == null) {
-      throw new MetadataException(
-          "given seriesPath:{" + singlePath.getFullPath() + "} don't exist in metadata");
-    }
-    IUnaryExpression ret;
-
-    switch (type) {
-      case INT32:
-        ret = funcToken.getUnaryExpression(singlePath, Integer.valueOf(value));
-        break;
-      case INT64:
-        ret = funcToken.getUnaryExpression(singlePath, Long.valueOf(value));
-        break;
-      case BOOLEAN:
-        ret = funcToken.getUnaryExpression(singlePath, Boolean.valueOf(value));
-        break;
-      case FLOAT:
-        ret = funcToken.getUnaryExpression(singlePath, Float.valueOf(value));
-        break;
-      case DOUBLE:
-        ret = funcToken.getUnaryExpression(singlePath, Double.valueOf(value));
-        break;
-      case TEXT:
-        if (funcToken.equals(BasicFilterType.EQ) || funcToken.equals(BasicFilterType.NOTEQUAL)) {
-          ret =
-              funcToken.getUnaryExpression(
-                  singlePath,
-                  (value.startsWith("'") && value.endsWith("'"))
-                          || (value.startsWith("\"") && value.endsWith("\""))
-                      ? new Binary(value.substring(1, value.length() - 1))
-                      : new Binary(value));
-        } else {
-          throw new StatementAnalyzeException(
-              "For Basic operator,TEXT type only support EQUAL or NOTEQUAL operator");
-        }
-        break;
-      default:
-        throw new StatementAnalyzeException(type.toString(), "");
-    }
-
-    return new Pair<>(ret, singlePath.getFullPath());
-  }
-
-  @Override
-  public String showTree(int spaceNum) {
-    StringContainer sc = new StringContainer();
-    for (int i = 0; i < spaceNum; i++) {
-      sc.addTail("  ");
-    }
-    sc.addTail(singlePath.getFullPath(), getFilterSymbol(), value, ", single\n");
-    return sc.toString();
-  }
-
-  @Override
-  public BasicFunctionFilter copy() {
-    BasicFunctionFilter ret;
-    try {
-      ret = new BasicFunctionFilter(this.filterType, singlePath.clone(), value);
-    } catch (SQLParserException e) {
-      logger.error("error copy:", e);
-      return null;
-    }
-    ret.isLeaf = isLeaf;
-    ret.isSingle = isSingle;
-    ret.pathSet = pathSet;
-    return ret;
-  }
-
-  @Override
-  public String toString() {
-    return "[" + singlePath.getFullPath() + getFilterSymbol() + value + "]";
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    BasicFunctionFilter that = (BasicFunctionFilter) o;
-    return Objects.equals(singlePath, that.singlePath)
-        && Objects.equals(value, that.value)
-        && funcToken == that.funcToken;
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(super.hashCode(), singlePath, value, funcToken);
-  }
-
-  public void serialize(ByteBuffer byteBuffer) {
-    FilterTypes.BasicFunction.serialize(byteBuffer);
-    super.serializeWithoutType(byteBuffer);
-    ReadWriteIOUtils.write(value, byteBuffer);
-    ReadWriteIOUtils.write(funcToken.ordinal(), byteBuffer);
-  }
-
-  public static BasicFunctionFilter deserialize(ByteBuffer byteBuffer) {
-    QueryFilter queryFilter = QueryFilter.deserialize(byteBuffer);
-    BasicFunctionFilter basicFunctionFilter =
-        new BasicFunctionFilter(
-            queryFilter.filterType,
-            queryFilter.singlePath,
-            ReadWriteIOUtils.readString(byteBuffer));
-    basicFunctionFilter.funcToken = BasicFilterType.values()[ReadWriteIOUtils.readInt(byteBuffer)];
-    return basicFunctionFilter;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/FilterDeserializeUtil.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/FilterDeserializeUtil.java
deleted file mode 100644
index 5388e5b522..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/FilterDeserializeUtil.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.mpp.common.filter;
-
-import java.nio.ByteBuffer;
-
-public class FilterDeserializeUtil {
-
-  public static QueryFilter deserialize(ByteBuffer buffer) {
-    byte filterType = buffer.get();
-    switch (filterType) {
-      case 0:
-        return QueryFilter.deserialize(buffer);
-      case 1:
-        return FunctionFilter.deserialize(buffer);
-      case 2:
-        return BasicFunctionFilter.deserialize(buffer);
-      case 3:
-        return InFilter.deserialize(buffer);
-      case 4:
-        return LikeFilter.deserialize(buffer);
-      case 5:
-        return RegexpFilter.deserialize(buffer);
-      default:
-        throw new IllegalArgumentException("Invalid filter type: " + filterType);
-    }
-  }
-}
-
-enum FilterTypes {
-  Query((byte) 0),
-  Function((byte) 1),
-  BasicFunction((byte) 2),
-  In((byte) 3),
-  Like((byte) 4),
-  Regexp((byte) 5);
-
-  private final byte filterType;
-
-  FilterTypes(byte filterType) {
-    this.filterType = filterType;
-  }
-
-  public void serialize(ByteBuffer buffer) {
-    buffer.put(filterType);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/FunctionFilter.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/FunctionFilter.java
deleted file mode 100644
index 13e0aeb315..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/FunctionFilter.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.mpp.common.filter;
-
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.commons.path.PathDeserializeUtil;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant.FilterType;
-import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * This class presents series condition which is general(e.g. numerical comparison) or defined by
- * user. Function is used for bottom operator.<br>
- * FunctionFilter has a {@code seriesPath}, and other filter condition.
- */
-public class FunctionFilter extends QueryFilter {
-
-  private static final Logger logger = LoggerFactory.getLogger(FunctionFilter.class);
-
-  public FunctionFilter(FilterType filterType) {
-    super(filterType);
-  }
-
-  /** reverse func. */
-  public void reverseFunc() {
-    // Implemented by subclass
-  }
-
-  @Override
-  public void addChildOperator(QueryFilter op) {
-    logger.error("cannot add child to leaf FilterOperator, now it's FunctionOperator");
-  }
-
-  @Override
-  public void serialize(ByteBuffer byteBuffer) {
-    FilterTypes.Function.serialize(byteBuffer);
-    super.serializeWithoutType(byteBuffer);
-  }
-
-  public static FunctionFilter deserialize(ByteBuffer byteBuffer) {
-    int filterTypeIndex = ReadWriteIOUtils.readInt(byteBuffer);
-    int childSize = ReadWriteIOUtils.readInt(byteBuffer);
-    List<QueryFilter> queryFilters = new ArrayList<>();
-    for (int i = 0; i < childSize; i++) {
-      queryFilters.add(FilterDeserializeUtil.deserialize(byteBuffer));
-    }
-    boolean isLeaf = ReadWriteIOUtils.readBool(byteBuffer);
-    boolean isSingle = ReadWriteIOUtils.readBool(byteBuffer);
-    PartialPath singlePath = null;
-    if (isSingle) {
-      singlePath = (PartialPath) PathDeserializeUtil.deserialize(byteBuffer);
-    }
-    int pathSetSize = ReadWriteIOUtils.readInt(byteBuffer);
-    Set<PartialPath> pathSet = new HashSet<>();
-    for (int i = 0; i < pathSetSize; i++) {
-      pathSet.add((PartialPath) PathDeserializeUtil.deserialize(byteBuffer));
-    }
-
-    FunctionFilter queryFilter = new FunctionFilter(FilterType.values()[filterTypeIndex]);
-    queryFilter.setChildren(queryFilters);
-    queryFilter.setPathSet(pathSet);
-    queryFilter.setSinglePath(singlePath);
-    queryFilter.isLeaf = isLeaf;
-    queryFilter.isSingle = isSingle;
-    return queryFilter;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/InFilter.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/InFilter.java
deleted file mode 100644
index ec59b08dec..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/InFilter.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * 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.mpp.common.filter;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant.FilterType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.Path;
-import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
-import org.apache.iotdb.tsfile.read.expression.impl.GlobalTimeExpression;
-import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
-import org.apache.iotdb.tsfile.read.filter.TimeFilter;
-import org.apache.iotdb.tsfile.read.filter.ValueFilter;
-import org.apache.iotdb.tsfile.read.filter.basic.Filter;
-import org.apache.iotdb.tsfile.utils.Binary;
-import org.apache.iotdb.tsfile.utils.Pair;
-import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
-import org.apache.iotdb.tsfile.utils.StringContainer;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-/** operator 'in' & 'not in' */
-public class InFilter extends FunctionFilter {
-
-  private boolean not;
-  protected Set<String> values;
-
-  /**
-   * In Filter Constructor.
-   *
-   * @param filterType filter Type
-   * @param path path
-   * @param values values
-   */
-  public InFilter(FilterType filterType, PartialPath path, boolean not, Set<String> values) {
-    super(filterType);
-    this.singlePath = path;
-    this.values = values;
-    this.not = not;
-    isLeaf = true;
-    isSingle = true;
-  }
-
-  public Set<String> getValues() {
-    return values;
-  }
-
-  public boolean getNot() {
-    return not;
-  }
-
-  @Override
-  public void reverseFunc() {
-    not = !not;
-  }
-
-  @Override
-  @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning
-  protected Pair<IUnaryExpression, String> transformToSingleQueryFilter(
-      Map<PartialPath, TSDataType> pathTSDataTypeHashMap)
-      throws StatementAnalyzeException, MetadataException {
-    TSDataType type = pathTSDataTypeHashMap.get(singlePath);
-    if (type == null) {
-      throw new MetadataException(
-          "given seriesPath:{" + singlePath.getFullPath() + "} don't exist in metadata");
-    }
-    IUnaryExpression ret;
-
-    switch (type) {
-      case INT32:
-        Set<Integer> integerValues = new HashSet<>();
-        for (String val : values) {
-          integerValues.add(Integer.valueOf(val));
-        }
-        ret = In.getUnaryExpression(singlePath, integerValues, not);
-        break;
-      case INT64:
-        Set<Long> longValues = new HashSet<>();
-        for (String val : values) {
-          longValues.add(Long.valueOf(val));
-        }
-        ret = In.getUnaryExpression(singlePath, longValues, not);
-        break;
-      case BOOLEAN:
-        Set<Boolean> booleanValues = new HashSet<>();
-        for (String val : values) {
-          booleanValues.add(Boolean.valueOf(val));
-        }
-        ret = In.getUnaryExpression(singlePath, booleanValues, not);
-        break;
-      case FLOAT:
-        Set<Float> floatValues = new HashSet<>();
-        for (String val : values) {
-          floatValues.add(Float.parseFloat(val));
-        }
-        ret = In.getUnaryExpression(singlePath, floatValues, not);
-        break;
-      case DOUBLE:
-        Set<Double> doubleValues = new HashSet<>();
-        for (String val : values) {
-          doubleValues.add(Double.parseDouble(val));
-        }
-        ret = In.getUnaryExpression(singlePath, doubleValues, not);
-        break;
-      case TEXT:
-        Set<Binary> binaryValues = new HashSet<>();
-        for (String val : values) {
-          binaryValues.add(
-              (val.startsWith("'") && val.endsWith("'"))
-                      || (val.startsWith("\"") && val.endsWith("\""))
-                  ? new Binary(val.substring(1, val.length() - 1))
-                  : new Binary(val));
-        }
-        ret = In.getUnaryExpression(singlePath, binaryValues, not);
-        break;
-      default:
-        throw new StatementAnalyzeException(type.toString(), "");
-    }
-
-    return new Pair<>(ret, singlePath.getFullPath());
-  }
-
-  @Override
-  public String showTree(int spaceNum) {
-    StringContainer sc = new StringContainer();
-    for (int i = 0; i < spaceNum; i++) {
-      sc.addTail("  ");
-    }
-    sc.addTail(singlePath.getFullPath(), getFilterSymbol(), not, values, ", single\n");
-    return sc.toString();
-  }
-
-  @Override
-  public InFilter copy() {
-    InFilter ret = new InFilter(this.filterType, singlePath.clone(), not, new HashSet<>(values));
-    ret.isLeaf = isLeaf;
-    ret.isSingle = isSingle;
-    ret.pathSet = pathSet;
-    return ret;
-  }
-
-  @Override
-  public String toString() {
-    List<String> valuesList = new ArrayList<>(values);
-    Collections.sort(valuesList);
-    return "[" + singlePath.getFullPath() + getFilterSymbol() + not + valuesList + "]";
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    InFilter that = (InFilter) o;
-    return Objects.equals(singlePath, that.singlePath)
-        && values.containsAll(that.values)
-        && values.size() == that.values.size()
-        && not == that.not;
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(super.hashCode(), singlePath, not, values);
-  }
-
-  private static class In {
-
-    public static <T extends Comparable<T>> IUnaryExpression getUnaryExpression(
-        Path path, Set<T> values, boolean not) {
-      if (path != null && path.toString().equals("time")) {
-        return new GlobalTimeExpression(TimeFilter.in((Set<Long>) values, not));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.in(values, not));
-      }
-    }
-
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.notEq(value);
-    }
-  }
-
-  public void serialize(ByteBuffer byteBuffer) {
-    FilterTypes.In.serialize(byteBuffer);
-    super.serializeWithoutType(byteBuffer);
-    ReadWriteIOUtils.write(not, byteBuffer);
-    ReadWriteIOUtils.write(values.size(), byteBuffer);
-    for (String value : values) {
-      ReadWriteIOUtils.write(value, byteBuffer);
-    }
-  }
-
-  public static InFilter deserialize(ByteBuffer byteBuffer) {
-    QueryFilter queryFilter = QueryFilter.deserialize(byteBuffer);
-    boolean not = ReadWriteIOUtils.readBool(byteBuffer);
-    int size = ReadWriteIOUtils.readInt(byteBuffer);
-    Set<String> values = new HashSet<>();
-    for (int i = 0; i < size; i++) {
-      values.add(ReadWriteIOUtils.readString(byteBuffer));
-    }
-    return new InFilter(queryFilter.filterType, queryFilter.singlePath, not, values);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/LikeFilter.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/LikeFilter.java
deleted file mode 100644
index 1b73eb4659..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/LikeFilter.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.mpp.common.filter;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant.FilterType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
-import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
-import org.apache.iotdb.tsfile.read.filter.ValueFilter;
-import org.apache.iotdb.tsfile.read.filter.basic.Filter;
-import org.apache.iotdb.tsfile.utils.Pair;
-import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
-import org.apache.iotdb.tsfile.utils.StringContainer;
-
-import java.nio.ByteBuffer;
-import java.util.Map;
-import java.util.Objects;
-
-import static org.apache.iotdb.tsfile.file.metadata.enums.TSDataType.TEXT;
-
-/** fuzzy query structure LikeFilter. */
-public class LikeFilter extends FunctionFilter {
-
-  protected String value;
-
-  public LikeFilter(FilterType filterType, PartialPath path, String value) {
-    super(filterType);
-    this.singlePath = path;
-    this.value = value;
-    isLeaf = true;
-    isSingle = true;
-  }
-
-  @Override
-  protected Pair<IUnaryExpression, String> transformToSingleQueryFilter(
-      Map<PartialPath, TSDataType> pathTSDataTypeHashMap)
-      throws StatementAnalyzeException, MetadataException {
-    TSDataType type = pathTSDataTypeHashMap.get(singlePath);
-    if (type == null) {
-      throw new MetadataException(
-          "given seriesPath:{" + singlePath.getFullPath() + "} don't exist in metadata");
-    }
-    IUnaryExpression ret;
-    if (type != TEXT) {
-      throw new StatementAnalyzeException(type.toString(), "Only TEXT is supported in 'Like'");
-    } else if (value.startsWith("\"") && value.endsWith("\"")) {
-      throw new StatementAnalyzeException(value, "Please use single quotation marks");
-    } else {
-      ret =
-          Like.getUnaryExpression(
-              singlePath,
-              (value.startsWith("'") && value.endsWith("'"))
-                  ? value.substring(1, value.length() - 1)
-                  : value);
-    }
-    return new Pair<>(ret, singlePath.getFullPath());
-  }
-
-  private static class Like {
-    public static <T extends Comparable<T>> IUnaryExpression getUnaryExpression(
-        PartialPath path, String value) {
-      return new SingleSeriesExpression(path, ValueFilter.like(value));
-    }
-
-    public <T extends Comparable<T>> Filter getValueFilter(String value) {
-      return ValueFilter.like(value);
-    }
-  }
-
-  @Override
-  public String showTree(int spaceNum) {
-    StringContainer sc = new StringContainer();
-    for (int i = 0; i < spaceNum; i++) {
-      sc.addTail("  ");
-    }
-    sc.addTail(singlePath.getFullPath(), getFilterSymbol(), value, ", single\n");
-    return sc.toString();
-  }
-
-  @Override
-  public LikeFilter copy() {
-    LikeFilter ret = new LikeFilter(this.filterType, singlePath.clone(), value);
-    ret.isLeaf = isLeaf;
-    ret.isSingle = isSingle;
-    ret.pathSet = pathSet;
-    return ret;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    if (!super.equals(o)) {
-      return false;
-    }
-    LikeFilter that = (LikeFilter) o;
-    return Objects.equals(value, that.value);
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(super.hashCode(), singlePath, value);
-  }
-
-  @Override
-  public String toString() {
-    return "[" + singlePath.getFullPath() + getFilterSymbol() + value + "]";
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public void serialize(ByteBuffer byteBuffer) {
-    FilterTypes.Like.serialize(byteBuffer);
-    super.serializeWithoutType(byteBuffer);
-    ReadWriteIOUtils.write(value, byteBuffer);
-  }
-
-  public static LikeFilter deserialize(ByteBuffer byteBuffer) {
-    QueryFilter queryFilter = QueryFilter.deserialize(byteBuffer);
-    LikeFilter likeFilter =
-        new LikeFilter(
-            queryFilter.filterType,
-            queryFilter.singlePath,
-            ReadWriteIOUtils.readString(byteBuffer));
-    return likeFilter;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/QueryFilter.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/QueryFilter.java
deleted file mode 100644
index f958a48b2c..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/QueryFilter.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * 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.mpp.common.filter;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.commons.path.PathDeserializeUtil;
-import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant.FilterType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.expression.IExpression;
-import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
-import org.apache.iotdb.tsfile.read.expression.impl.BinaryExpression;
-import org.apache.iotdb.tsfile.read.filter.factory.FilterFactory;
-import org.apache.iotdb.tsfile.utils.Pair;
-import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
-import org.apache.iotdb.tsfile.utils.StringContainer;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This class is for filter in where clause. It may consist of more than two child filters, but if
- * it's not a leaf filter, the relation is the same among all of its children (AND or OR), which is
- * identified by tokenType.
- */
-public class QueryFilter implements Comparable<QueryFilter> {
-
-  protected FilterType filterType;
-
-  private List<QueryFilter> childOperators = new ArrayList<>();
-  // leaf filter operator means it doesn't have left and right child filterOperator. Leaf filter
-  // should set FunctionOperator.
-  protected boolean isLeaf = false;
-  // isSingle being true means all recursive children of this filter belong to one seriesPath.
-  boolean isSingle = false;
-  // if isSingle = false, singlePath must be null
-  PartialPath singlePath = null;
-  // all paths involved in this filter
-  Set<PartialPath> pathSet;
-
-  public QueryFilter() {}
-
-  public QueryFilter(FilterType filterType) {
-    this.filterType = filterType;
-  }
-
-  public QueryFilter(FilterType filterType, boolean isSingle) {
-    this.filterType = filterType;
-    this.isSingle = isSingle;
-  }
-
-  public FilterType getFilterType() {
-    return filterType;
-  }
-
-  public void setFilterType(FilterType filterType) {
-    this.filterType = filterType;
-  }
-
-  public String getFilterName() {
-    return FilterConstant.filterNames.get(filterType);
-  }
-
-  public String getFilterSymbol() {
-    return FilterConstant.filterSymbol.get(filterType);
-  }
-
-  public List<QueryFilter> getChildren() {
-    return childOperators;
-  }
-
-  public void setChildren(List<QueryFilter> children) {
-    this.childOperators = children;
-  }
-
-  public void setIsSingle(boolean b) {
-    this.isSingle = b;
-  }
-
-  public PartialPath getSinglePath() {
-    return singlePath;
-  }
-
-  public void setSinglePath(PartialPath singlePath) {
-    this.singlePath = singlePath;
-  }
-
-  public void addChildOperator(QueryFilter op) {
-    childOperators.add(op);
-  }
-
-  public void setPathSet(Set<PartialPath> pathSet) {
-    this.pathSet = pathSet;
-  }
-
-  public Set<PartialPath> getPathSet() {
-    return pathSet;
-  }
-
-  /**
-   * For a filter operator, if isSingle, call transformToSingleQueryFilter.<br>
-   * FilterOperator cannot be leaf.
-   *
-   * @return QueryFilter in TsFile
-   * @param pathTSDataTypeHashMap
-   */
-  public IExpression transformToExpression(Map<PartialPath, TSDataType> pathTSDataTypeHashMap)
-      throws StatementAnalyzeException {
-    if (isSingle) {
-      Pair<IUnaryExpression, String> ret;
-      try {
-        ret = transformToSingleQueryFilter(pathTSDataTypeHashMap);
-      } catch (MetadataException e) {
-        throw new StatementAnalyzeException("Meet error when transformToSingleQueryFilter");
-      }
-      return ret.left;
-    } else {
-      if (childOperators.isEmpty()) {
-        throw new StatementAnalyzeException(
-            String.valueOf(filterType), "this filter is not leaf, but it's empty");
-      }
-      IExpression retFilter = childOperators.get(0).transformToExpression(pathTSDataTypeHashMap);
-      IExpression currentFilter;
-      for (int i = 1; i < childOperators.size(); i++) {
-        currentFilter = childOperators.get(i).transformToExpression(pathTSDataTypeHashMap);
-        switch (filterType) {
-          case KW_AND:
-            retFilter = BinaryExpression.and(retFilter, currentFilter);
-            break;
-          case KW_OR:
-            retFilter = BinaryExpression.or(retFilter, currentFilter);
-            break;
-          default:
-            throw new StatementAnalyzeException(
-                String.valueOf(filterType), "Maybe it means " + getFilterName());
-        }
-      }
-      return retFilter;
-    }
-  }
-
-  /**
-   * it will be used in BasicFunction Operator.
-   *
-   * @return - pair.left: UnaryQueryFilter constructed by its one child; pair.right: Path
-   *     represented by this child.
-   * @throws MetadataException exception in filter transforming
-   * @param pathTSDataTypeHashMap
-   */
-  protected Pair<IUnaryExpression, String> transformToSingleQueryFilter(
-      Map<PartialPath, TSDataType> pathTSDataTypeHashMap)
-      throws StatementAnalyzeException, MetadataException {
-    if (childOperators.isEmpty()) {
-      throw new StatementAnalyzeException(
-          String.valueOf(filterType),
-          "TransformToSingleFilter: this filter is not a leaf, but it's empty.");
-    }
-    Pair<IUnaryExpression, String> currentPair =
-        childOperators.get(0).transformToSingleQueryFilter(pathTSDataTypeHashMap);
-
-    IUnaryExpression retFilter = currentPair.left;
-    String path = currentPair.right;
-
-    for (int i = 1; i < childOperators.size(); i++) {
-      currentPair = childOperators.get(i).transformToSingleQueryFilter(pathTSDataTypeHashMap);
-      if (!path.equals(currentPair.right)) {
-        throw new StatementAnalyzeException(
-            "TransformToSingleFilter: paths among children are not inconsistent: one is: "
-                + path
-                + ", another is: "
-                + currentPair.right);
-      }
-      switch (filterType) {
-        case KW_AND:
-          retFilter.setFilter(
-              FilterFactory.and(retFilter.getFilter(), currentPair.left.getFilter()));
-          break;
-        case KW_OR:
-          retFilter.setFilter(
-              FilterFactory.or(retFilter.getFilter(), currentPair.left.getFilter()));
-          break;
-        default:
-          throw new StatementAnalyzeException(
-              String.valueOf(filterType), "Maybe it means " + getFilterName());
-      }
-    }
-    return new Pair<>(retFilter, path);
-  }
-
-  /** a filter with null path is no smaller than any other filter. */
-  @Override
-  public int compareTo(QueryFilter fil) {
-    if (singlePath == null && fil.singlePath == null) {
-      return 0;
-    }
-    if (singlePath == null) {
-      return 1;
-    }
-    if (fil.singlePath == null) {
-      return -1;
-    }
-    return fil.singlePath.getFullPath().compareTo(singlePath.getFullPath());
-  }
-
-  @Override
-  public boolean equals(Object fil) {
-    if (!(fil instanceof QueryFilter)) {
-      return false;
-    }
-    // if child is leaf, will execute BasicFunctionOperator.equals()
-    QueryFilter operator = (QueryFilter) fil;
-    return this.filterType == operator.filterType
-        && this.getChildren().equals(operator.getChildren());
-  }
-
-  @Override
-  public int hashCode() {
-    return getFilterSymbol().hashCode();
-  }
-
-  public boolean isLeaf() {
-    return isLeaf;
-  }
-
-  public boolean isSingle() {
-    return isSingle;
-  }
-
-  public String showTree() {
-    return showTree(0);
-  }
-
-  public String showTree(int spaceNum) {
-    StringContainer sc = new StringContainer();
-    for (int i = 0; i < spaceNum; i++) {
-      sc.addTail("  ");
-    }
-    sc.addTail(getFilterName());
-    if (isSingle) {
-      sc.addTail("[single:", getSinglePath().getFullPath(), "]");
-    }
-    sc.addTail("\n");
-    for (QueryFilter filter : childOperators) {
-      sc.addTail(filter.showTree(spaceNum + 1));
-    }
-    return sc.toString();
-  }
-
-  @Override
-  public String toString() {
-    StringContainer sc = new StringContainer();
-    sc.addTail("[", FilterConstant.filterNames.get(filterType));
-    if (isSingle) {
-      sc.addTail("[single:", getSinglePath().getFullPath(), "]");
-    }
-    sc.addTail(" ");
-    for (QueryFilter filter : childOperators) {
-      sc.addTail(filter.toString());
-    }
-    sc.addTail("]");
-    return sc.toString();
-  }
-
-  public QueryFilter copy() {
-    QueryFilter ret = new QueryFilter(this.filterType);
-    ret.isLeaf = isLeaf;
-    ret.isSingle = isSingle;
-    if (singlePath != null) {
-      ret.singlePath = singlePath.clone();
-    }
-    for (QueryFilter filterOperator : this.childOperators) {
-      ret.addChildOperator(filterOperator.copy());
-    }
-    return ret;
-  }
-
-  public void serialize(ByteBuffer byteBuffer) {
-    FilterTypes.Query.serialize(byteBuffer);
-    serializeWithoutType(byteBuffer);
-  }
-
-  protected void serializeWithoutType(ByteBuffer byteBuffer) {
-    ReadWriteIOUtils.write(filterType.ordinal(), byteBuffer);
-    ReadWriteIOUtils.write(childOperators.size(), byteBuffer);
-    for (QueryFilter queryFilter : childOperators) {
-      queryFilter.serialize(byteBuffer);
-    }
-    ReadWriteIOUtils.write(isLeaf, byteBuffer);
-    ReadWriteIOUtils.write(isSingle, byteBuffer);
-    if (isSingle) {
-      singlePath.serialize(byteBuffer);
-    }
-    if (pathSet == null) {
-      ReadWriteIOUtils.write(-1, byteBuffer);
-    } else {
-      ReadWriteIOUtils.write(pathSet.size(), byteBuffer);
-      for (PartialPath partialPath : pathSet) {
-        partialPath.serialize(byteBuffer);
-      }
-    }
-  }
-
-  public static QueryFilter deserialize(ByteBuffer byteBuffer) {
-    int filterTypeIndex = ReadWriteIOUtils.readInt(byteBuffer);
-    int childSize = ReadWriteIOUtils.readInt(byteBuffer);
-    List<QueryFilter> queryFilters = new ArrayList<>();
-    for (int i = 0; i < childSize; i++) {
-      queryFilters.add(FilterDeserializeUtil.deserialize(byteBuffer));
-    }
-    boolean isLeaf = ReadWriteIOUtils.readBool(byteBuffer);
-    boolean isSingle = ReadWriteIOUtils.readBool(byteBuffer);
-    PartialPath singlePath = null;
-    if (isSingle) {
-      singlePath = (PartialPath) PathDeserializeUtil.deserialize(byteBuffer);
-    }
-    int pathSetSize = ReadWriteIOUtils.readInt(byteBuffer);
-    Set<PartialPath> pathSet = null;
-    if (pathSetSize != -1) {
-      pathSet = new HashSet<>();
-    }
-    for (int i = 0; i < pathSetSize; i++) {
-      pathSet.add((PartialPath) PathDeserializeUtil.deserialize(byteBuffer));
-    }
-
-    QueryFilter queryFilter = new QueryFilter(FilterType.values()[filterTypeIndex], isSingle);
-    queryFilter.setChildren(queryFilters);
-    queryFilter.setPathSet(pathSet);
-    queryFilter.setSinglePath(singlePath);
-    queryFilter.isLeaf = isLeaf;
-    return queryFilter;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/RegexpFilter.java b/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/RegexpFilter.java
deleted file mode 100644
index 77938ce289..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/common/filter/RegexpFilter.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.mpp.common.filter;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant.FilterType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
-import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
-import org.apache.iotdb.tsfile.read.filter.ValueFilter;
-import org.apache.iotdb.tsfile.read.filter.basic.Filter;
-import org.apache.iotdb.tsfile.utils.Pair;
-import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
-import org.apache.iotdb.tsfile.utils.StringContainer;
-
-import java.nio.ByteBuffer;
-import java.util.Map;
-import java.util.Objects;
-
-import static org.apache.iotdb.tsfile.file.metadata.enums.TSDataType.TEXT;
-
-/** fuzzy query structure RegexpFilter. */
-public class RegexpFilter extends FunctionFilter {
-
-  protected String value;
-
-  public RegexpFilter(FilterType filterType, PartialPath path, String value) {
-    super(filterType);
-    this.singlePath = path;
-    this.value = value;
-    isLeaf = true;
-    isSingle = true;
-  }
-
-  @Override
-  protected Pair<IUnaryExpression, String> transformToSingleQueryFilter(
-      Map<PartialPath, TSDataType> pathTSDataTypeHashMap)
-      throws StatementAnalyzeException, MetadataException {
-    TSDataType type = pathTSDataTypeHashMap.get(singlePath);
-    if (type == null) {
-      throw new MetadataException(
-          "given seriesPath:{" + singlePath.getFullPath() + "} don't exist in metadata");
-    }
-    IUnaryExpression ret;
-    if (type != TEXT) {
-      throw new StatementAnalyzeException(type.toString(), "Only TEXT is supported in 'Regexp'");
-    } else if (value.startsWith("\"") && value.endsWith("\"")) {
-      throw new StatementAnalyzeException(value, "Please use single quotation marks");
-    } else {
-      ret =
-          Regexp.getUnaryExpression(
-              singlePath,
-              (value.startsWith("'") && value.endsWith("'"))
-                  ? value.substring(1, value.length() - 1)
-                  : value);
-    }
-    return new Pair<>(ret, singlePath.getFullPath());
-  }
-
-  private static class Regexp {
-    public static <T extends Comparable<T>> IUnaryExpression getUnaryExpression(
-        PartialPath path, String value) {
-      return new SingleSeriesExpression(path, ValueFilter.regexp(value));
-    }
-
-    public <T extends Comparable<T>> Filter getValueFilter(String value) {
-      return ValueFilter.regexp(value);
-    }
-  }
-
-  @Override
-  public String showTree(int spaceNum) {
-    StringContainer sc = new StringContainer();
-    for (int i = 0; i < spaceNum; i++) {
-      sc.addTail("  ");
-    }
-    sc.addTail(singlePath.getFullPath(), value, ", single\n");
-    return sc.toString();
-  }
-
-  @Override
-  public RegexpFilter copy() {
-    RegexpFilter ret = new RegexpFilter(this.filterType, singlePath.clone(), value);
-    ret.isLeaf = isLeaf;
-    ret.isSingle = isSingle;
-    ret.pathSet = pathSet;
-    return ret;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    if (!super.equals(o)) {
-      return false;
-    }
-    RegexpFilter that = (RegexpFilter) o;
-    return Objects.equals(value, that.value);
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(super.hashCode(), singlePath, value);
-  }
-
-  @Override
-  public String toString() {
-    return "[" + singlePath.getFullPath() + value + "]";
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public void serialize(ByteBuffer byteBuffer) {
-    FilterTypes.Regexp.serialize(byteBuffer);
-    super.serializeWithoutType(byteBuffer);
-    ReadWriteIOUtils.write(value, byteBuffer);
-  }
-
-  public static RegexpFilter deserialize(ByteBuffer byteBuffer) {
-    QueryFilter queryFilter = QueryFilter.deserialize(byteBuffer);
-    String value = ReadWriteIOUtils.readString(byteBuffer);
-    RegexpFilter regexpFilter =
-        new RegexpFilter(queryFilter.filterType, queryFilter.singlePath, value);
-    return regexpFilter;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/SeriesScanUtil.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/SeriesScanUtil.java
index 22fd2cbabc..aa8cbab007 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/SeriesScanUtil.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/source/SeriesScanUtil.java
@@ -55,7 +55,6 @@ import java.util.Objects;
 import java.util.PriorityQueue;
 import java.util.Set;
 import java.util.function.ToLongFunction;
-import java.util.stream.Collectors;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
@@ -70,7 +69,7 @@ public class SeriesScanUtil {
   protected final TSDataType dataType;
 
   // inner class of SeriesReader for order purpose
-  private TimeOrderUtils orderUtils;
+  private final TimeOrderUtils orderUtils;
 
   /*
    * There is at most one is not null between timeFilter and valueFilter
@@ -930,12 +929,6 @@ public class SeriesScanUtil {
     throw new IOException("No more batch data");
   }
 
-  private LinkedList<TsFileResource> sortUnSeqFileResources(List<TsFileResource> tsFileResources) {
-    return tsFileResources.stream()
-        .sorted(orderUtils.comparingLong(tsFileResource -> orderUtils.getOrderTime(tsFileResource)))
-        .collect(Collectors.toCollection(LinkedList::new));
-  }
-
   /**
    * unpack all overlapped seq/unseq files and find the first TimeSeriesMetadata
    *
@@ -1255,7 +1248,7 @@ public class SeriesScanUtil {
       while (dataSource.hasNextSeqResource(curSeqFileIndex, getAscending())) {
         TsFileResource tsFileResource = dataSource.getSeqResourceByIndex(curSeqFileIndex);
         if (tsFileResource != null
-            && tsFileResource.isSatisfied(seriesPath.getDevice(), timeFilter, null, true, false)) {
+            && tsFileResource.isSatisfied(seriesPath.getDevice(), timeFilter, true, false)) {
           break;
         }
         curSeqFileIndex--;
@@ -1268,7 +1261,7 @@ public class SeriesScanUtil {
       while (dataSource.hasNextUnseqResource(curUnseqFileIndex)) {
         TsFileResource tsFileResource = dataSource.getUnseqResourceByIndex(curUnseqFileIndex);
         if (tsFileResource != null
-            && tsFileResource.isSatisfied(seriesPath.getDevice(), timeFilter, null, false, false)) {
+            && tsFileResource.isSatisfied(seriesPath.getDevice(), timeFilter, false, false)) {
           break;
         }
         curUnseqFileIndex++;
@@ -1371,7 +1364,7 @@ public class SeriesScanUtil {
       while (dataSource.hasNextSeqResource(curSeqFileIndex, getAscending())) {
         TsFileResource tsFileResource = dataSource.getSeqResourceByIndex(curSeqFileIndex);
         if (tsFileResource != null
-            && tsFileResource.isSatisfied(seriesPath.getDevice(), timeFilter, null, true, false)) {
+            && tsFileResource.isSatisfied(seriesPath.getDevice(), timeFilter, true, false)) {
           break;
         }
         curSeqFileIndex++;
@@ -1384,7 +1377,7 @@ public class SeriesScanUtil {
       while (dataSource.hasNextUnseqResource(curUnseqFileIndex)) {
         TsFileResource tsFileResource = dataSource.getUnseqResourceByIndex(curUnseqFileIndex);
         if (tsFileResource != null
-            && tsFileResource.isSatisfied(seriesPath.getDevice(), timeFilter, null, false, false)) {
+            && tsFileResource.isSatisfied(seriesPath.getDevice(), timeFilter, false, false)) {
           break;
         }
         curUnseqFileIndex++;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/Coordinator.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/Coordinator.java
index 4940a4f538..a9cacb3e1f 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/Coordinator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/Coordinator.java
@@ -26,13 +26,13 @@ import org.apache.iotdb.commons.conf.IoTDBConstant;
 import org.apache.iotdb.db.client.DataNodeClientPoolFactory;
 import org.apache.iotdb.db.conf.IoTDBConfig;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.mpp.common.DataNodeEndPoints;
 import org.apache.iotdb.db.mpp.common.MPPQueryContext;
 import org.apache.iotdb.db.mpp.common.QueryId;
 import org.apache.iotdb.db.mpp.common.SessionInfo;
 import org.apache.iotdb.db.mpp.execution.QueryIdGenerator;
 import org.apache.iotdb.db.mpp.plan.analyze.IPartitionFetcher;
 import org.apache.iotdb.db.mpp.plan.analyze.schema.ISchemaFetcher;
-import org.apache.iotdb.db.mpp.plan.constant.DataNodeEndPoints;
 import org.apache.iotdb.db.mpp.plan.execution.ExecutionResult;
 import org.apache.iotdb.db.mpp.plan.execution.IQueryExecution;
 import org.apache.iotdb.db.mpp.plan.execution.QueryExecution;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ExpressionAnalyzer.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ExpressionAnalyzer.java
index 91410320f8..a23b13855b 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ExpressionAnalyzer.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ExpressionAnalyzer.java
@@ -24,6 +24,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.PathPatternTree;
+import org.apache.iotdb.db.constant.SqlConstant;
 import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.mpp.common.header.ColumnHeader;
 import org.apache.iotdb.db.mpp.common.schematree.ISchemaTree;
@@ -41,7 +42,6 @@ import org.apache.iotdb.db.mpp.plan.expression.ternary.TernaryExpression;
 import org.apache.iotdb.db.mpp.plan.expression.unary.InExpression;
 import org.apache.iotdb.db.mpp.plan.expression.unary.UnaryExpression;
 import org.apache.iotdb.db.mpp.plan.statement.component.ResultColumn;
-import org.apache.iotdb.db.qp.constant.SQLConstant;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.read.filter.TimeFilter;
@@ -274,7 +274,7 @@ public class ExpressionAnalyzer {
     } else if (expression instanceof TimeSeriesOperand) {
       PartialPath rawPath = ((TimeSeriesOperand) expression).getPath();
       List<PartialPath> actualPaths = new ArrayList<>();
-      if (rawPath.getFullPath().startsWith(SQLConstant.ROOT + TsFileConstant.PATH_SEPARATOR)) {
+      if (rawPath.getFullPath().startsWith(SqlConstant.ROOT + TsFileConstant.PATH_SEPARATOR)) {
         actualPaths.add(rawPath);
         patternTree.appendPathPattern(rawPath);
       } else {
@@ -343,7 +343,7 @@ public class ExpressionAnalyzer {
     } else if (expression instanceof TimeSeriesOperand) {
       PartialPath rawPath = ((TimeSeriesOperand) expression).getPath();
       List<PartialPath> actualPaths = new ArrayList<>();
-      if (rawPath.getFullPath().startsWith(SQLConstant.ROOT + TsFileConstant.PATH_SEPARATOR)) {
+      if (rawPath.getFullPath().startsWith(SqlConstant.ROOT + TsFileConstant.PATH_SEPARATOR)) {
         actualPaths.add(rawPath);
       } else {
         for (PartialPath prefixPath : prefixPaths) {
@@ -391,7 +391,7 @@ public class ExpressionAnalyzer {
       }
     } else if (predicate instanceof TimeSeriesOperand) {
       PartialPath rawPath = ((TimeSeriesOperand) predicate).getPath();
-      if (rawPath.getFullPath().startsWith(SQLConstant.ROOT + TsFileConstant.PATH_SEPARATOR)) {
+      if (rawPath.getFullPath().startsWith(SqlConstant.ROOT + TsFileConstant.PATH_SEPARATOR)) {
         patternTree.appendPathPattern(rawPath);
         return;
       }
@@ -549,7 +549,7 @@ public class ExpressionAnalyzer {
     } else if (predicate instanceof TimeSeriesOperand) {
       PartialPath filterPath = ((TimeSeriesOperand) predicate).getPath();
       List<PartialPath> concatPaths = new ArrayList<>();
-      if (!filterPath.getFirstNode().equals(SQLConstant.ROOT)) {
+      if (!filterPath.getFirstNode().equals(SqlConstant.ROOT)) {
         prefixPaths.forEach(prefix -> concatPaths.add(prefix.concatPath(filterPath)));
       } else {
         // do nothing in the case of "where root.d1.s1 > 5"
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/constant/FilterConstant.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/constant/FilterConstant.java
deleted file mode 100644
index 6f70f3c46f..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/constant/FilterConstant.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.mpp.plan.constant;
-
-import org.apache.iotdb.db.qp.sql.SqlLexer;
-
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.Map;
-
-public class FilterConstant {
-
-  public static final Map<Integer, FilterType> lexerToFilterType = new HashMap<>();
-  public static final Map<FilterType, String> filterSymbol = new EnumMap<>(FilterType.class);
-  public static final Map<FilterType, String> filterNames = new EnumMap<>(FilterType.class);
-  public static final Map<FilterType, FilterType> filterReverseWords =
-      new EnumMap<>(FilterType.class);
-
-  public enum FilterType {
-    KW_AND,
-    KW_OR,
-    KW_NOT,
-
-    EQUAL,
-    NOTEQUAL,
-    LESSTHANOREQUALTO,
-    LESSTHAN,
-    GREATERTHANOREQUALTO,
-    GREATERTHAN,
-    IN,
-    REGEXP,
-    LIKE
-  }
-
-  static {
-    lexerToFilterType.put(SqlLexer.OPERATOR_DEQ, FilterType.EQUAL);
-    lexerToFilterType.put(SqlLexer.OPERATOR_SEQ, FilterType.EQUAL);
-    lexerToFilterType.put(SqlLexer.OPERATOR_NEQ, FilterType.NOTEQUAL);
-    lexerToFilterType.put(SqlLexer.OPERATOR_LTE, FilterType.LESSTHANOREQUALTO);
-    lexerToFilterType.put(SqlLexer.OPERATOR_LT, FilterType.LESSTHAN);
-    lexerToFilterType.put(SqlLexer.OPERATOR_GTE, FilterType.GREATERTHANOREQUALTO);
-    lexerToFilterType.put(SqlLexer.OPERATOR_GT, FilterType.GREATERTHAN);
-    lexerToFilterType.put(SqlLexer.OPERATOR_IN, FilterType.IN);
-    lexerToFilterType.put(SqlLexer.REGEXP, FilterType.REGEXP);
-    lexerToFilterType.put(SqlLexer.LIKE, FilterType.LIKE);
-  }
-
-  static {
-    filterSymbol.put(FilterType.KW_AND, "&");
-    filterSymbol.put(FilterType.KW_OR, "|");
-    filterSymbol.put(FilterType.KW_NOT, "!");
-    filterSymbol.put(FilterType.EQUAL, "=");
-    filterSymbol.put(FilterType.NOTEQUAL, "<>");
-    filterSymbol.put(FilterType.LESSTHANOREQUALTO, "<=");
-    filterSymbol.put(FilterType.LESSTHAN, "<");
-    filterSymbol.put(FilterType.GREATERTHANOREQUALTO, ">=");
-    filterSymbol.put(FilterType.GREATERTHAN, ">");
-    filterSymbol.put(FilterType.LIKE, "%");
-  }
-
-  static {
-    filterNames.put(FilterType.KW_AND, "and");
-    filterNames.put(FilterType.KW_OR, "or");
-    filterNames.put(FilterType.KW_NOT, "not");
-    filterNames.put(FilterType.EQUAL, "equal");
-    filterNames.put(FilterType.NOTEQUAL, "not_equal");
-    filterNames.put(FilterType.LESSTHANOREQUALTO, "lessthan_or_equalto");
-    filterNames.put(FilterType.LESSTHAN, "lessthan");
-    filterNames.put(FilterType.GREATERTHANOREQUALTO, "greaterthan_or_equalto");
-    filterNames.put(FilterType.GREATERTHAN, "greaterthan");
-    filterNames.put(FilterType.IN, "in");
-    filterNames.put(FilterType.REGEXP, "regexp");
-    filterNames.put(FilterType.LIKE, "like");
-  }
-
-  static {
-    filterReverseWords.put(FilterType.KW_AND, FilterType.KW_OR);
-    filterReverseWords.put(FilterType.KW_OR, FilterType.KW_AND);
-    filterReverseWords.put(FilterType.EQUAL, FilterType.NOTEQUAL);
-    filterReverseWords.put(FilterType.NOTEQUAL, FilterType.EQUAL);
-    filterReverseWords.put(FilterType.LESSTHAN, FilterType.GREATERTHANOREQUALTO);
-    filterReverseWords.put(FilterType.GREATERTHANOREQUALTO, FilterType.LESSTHAN);
-    filterReverseWords.put(FilterType.LESSTHANOREQUALTO, FilterType.GREATERTHAN);
-    filterReverseWords.put(FilterType.GREATERTHAN, FilterType.LESSTHANOREQUALTO);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
index 2c87021c56..d4a40f0df0 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
@@ -80,7 +80,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Throwables.throwIfUnchecked;
-import static org.apache.iotdb.db.mpp.plan.constant.DataNodeEndPoints.isSameNode;
+import static org.apache.iotdb.db.mpp.common.DataNodeEndPoints.isSameNode;
 
 /**
  * QueryExecution stores all the status of a query which is being prepared or running inside the MPP
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/sys/sync/ShowPipeTask.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/sys/sync/ShowPipeTask.java
index 7d4b46c2e2..06ec0cdb78 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/sys/sync/ShowPipeTask.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/config/sys/sync/ShowPipeTask.java
@@ -28,7 +28,7 @@ import org.apache.iotdb.db.mpp.plan.execution.config.ConfigTaskResult;
 import org.apache.iotdb.db.mpp.plan.execution.config.IConfigTask;
 import org.apache.iotdb.db.mpp.plan.execution.config.executor.IConfigTaskExecutor;
 import org.apache.iotdb.db.mpp.plan.statement.sys.sync.ShowPipeStatement;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.read.common.block.TsBlockBuilder;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/expression/ResultColumn.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/expression/ResultColumn.java
deleted file mode 100644
index 03048e477a..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/expression/ResultColumn.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.mpp.plan.expression;
-
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
-
-import java.nio.ByteBuffer;
-
-/**
- * {@code ResultColumn} is used to represent a result column of a query.
- *
- * <p>Assume that we have time series in db as follows: <br>
- * [ root.sg.d.a, root.sg.d.b, root.sg.e.a, root.sg.e.b ]
- *
- * <ul>
- *   Example 1: select a, a + b, udf(udf(b)) from root.sg.d, root.sg.e;
- *   <li>Step 1: constructed by ASTVisitor in StatementGenerator: <br>
- *       result columns: <br>
- *       [a, a + b, udf(udf(b))]
- *   <li>Step 2: concatenated with prefix paths:<br>
- *       result columns: <br>
- *       [root.sg.d.a, root.sg.e.a, root.sg.d.a + root.sg.d.b, root.sg.d.a + root.sg.e.b,
- *       root.sg.e.a + root.sg.d.b, root.sg.e.a + root.sg.e.b, udf(udf(root.sg.d.b)),
- *       udf(udf(root.sg.e.b))]
- *   <li>Step 3: remove wildcards:<br>
- *       result columns: <br>
- *       [root.sg.d.a, root.sg.e.a, root.sg.d.a + root.sg.d.b, root.sg.d.a + root.sg.e.b,
- *       root.sg.e.a + root.sg.d.b, root.sg.e.a + root.sg.e.b, udf(udf(root.sg.d.b)),
- *       udf(udf(root.sg.e.b))]
- * </ul>
- *
- * <ul>
- *   Example 2: select *, a + *, udf(udf(*)) from root.sg.d;
- *   <li>Step 1: constructed by ASTVisitor in StatementGenerator: <br>
- *       result columns: <br>
- *       [*, a + * , udf(udf(*))]
- *   <li>Step 2: concatenated with prefix paths:<br>
- *       result columns: <br>
- *       [root.sg.d.*, root.sg.d.a + root.sg.d.*, udf(udf(root.sg.d.*))]
- *   <li>Step 3: remove wildcards:<br>
- *       result columns: <br>
- *       [root.sg.d.a, root.sg.d.b, root.sg.d.a + root.sg.d.a, root.sg.d.a + root.sg.d.b,
- *       udf(udf(root.sg.d.a)), udf(udf(root.sg.d.b))]
- * </ul>
- */
-public class ResultColumn {
-
-  private final Expression expression;
-  private final String alias;
-
-  private TSDataType dataType;
-
-  public ResultColumn(Expression expression, String alias) {
-    this.expression = expression;
-    this.alias = alias;
-  }
-
-  public ResultColumn(Expression expression) {
-    this.expression = expression;
-    alias = null;
-  }
-
-  public ResultColumn(ByteBuffer byteBuffer) {
-    expression = Expression.deserialize(byteBuffer);
-    alias = ReadWriteIOUtils.readString(byteBuffer);
-    dataType = TSDataType.deserializeFrom(byteBuffer);
-  }
-
-  public Expression getExpression() {
-    return expression;
-  }
-
-  public boolean hasAlias() {
-    return alias != null;
-  }
-
-  public String getAlias() {
-    return alias;
-  }
-
-  public String getResultColumnName() {
-    return alias != null ? alias : expression.getExpressionString();
-  }
-
-  public String getExpressionString() {
-    return expression.getExpressionString();
-  }
-
-  public void setDataType(TSDataType dataType) {
-    this.dataType = dataType;
-  }
-
-  public TSDataType getDataType() {
-    return dataType;
-  }
-
-  @Override
-  public String toString() {
-    return "ResultColumn{" + "expression=" + expression + ", alias='" + alias + '\'' + '}';
-  }
-
-  @Override
-  public final int hashCode() {
-    return alias == null ? getResultColumnName().hashCode() : alias.hashCode();
-  }
-
-  @Override
-  public final boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-
-    if (!(o instanceof ResultColumn)) {
-      return false;
-    }
-    return getResultColumnName().equals(((ResultColumn) o).getResultColumnName());
-  }
-
-  public static void serialize(ResultColumn resultColumn, ByteBuffer byteBuffer) {
-    Expression.serialize(resultColumn.expression, byteBuffer);
-    ReadWriteIOUtils.write(resultColumn.alias, byteBuffer);
-    resultColumn.dataType.serializeTo(byteBuffer);
-  }
-
-  public static ResultColumn deserialize(ByteBuffer byteBuffer) {
-    return new ResultColumn(byteBuffer);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/expression/visitor/OldIntermediateLayerVisitor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/expression/visitor/OldIntermediateLayerVisitor.java
deleted file mode 100644
index a136c71af4..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/expression/visitor/OldIntermediateLayerVisitor.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * 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.mpp.plan.expression.visitor;
-
-import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.mpp.plan.expression.binary.BinaryExpression;
-import org.apache.iotdb.db.mpp.plan.expression.leaf.ConstantOperand;
-import org.apache.iotdb.db.mpp.plan.expression.leaf.TimeSeriesOperand;
-import org.apache.iotdb.db.mpp.plan.expression.leaf.TimestampOperand;
-import org.apache.iotdb.db.mpp.plan.expression.multi.FunctionExpression;
-import org.apache.iotdb.db.mpp.plan.expression.ternary.BetweenExpression;
-import org.apache.iotdb.db.mpp.plan.expression.ternary.TernaryExpression;
-import org.apache.iotdb.db.mpp.plan.expression.unary.InExpression;
-import org.apache.iotdb.db.mpp.plan.expression.unary.IsNullExpression;
-import org.apache.iotdb.db.mpp.plan.expression.unary.LikeExpression;
-import org.apache.iotdb.db.mpp.plan.expression.unary.RegularExpression;
-import org.apache.iotdb.db.mpp.plan.expression.unary.UnaryExpression;
-import org.apache.iotdb.db.mpp.transformation.api.LayerPointReader;
-import org.apache.iotdb.db.mpp.transformation.dag.input.QueryDataSetInputLayer;
-import org.apache.iotdb.db.mpp.transformation.dag.intermediate.ConstantIntermediateLayer;
-import org.apache.iotdb.db.mpp.transformation.dag.intermediate.IntermediateLayer;
-import org.apache.iotdb.db.mpp.transformation.dag.intermediate.MultiInputColumnIntermediateLayer;
-import org.apache.iotdb.db.mpp.transformation.dag.intermediate.SingleInputColumnMultiReferenceIntermediateLayer;
-import org.apache.iotdb.db.mpp.transformation.dag.intermediate.SingleInputColumnSingleReferenceIntermediateLayer;
-import org.apache.iotdb.db.mpp.transformation.dag.memory.LayerMemoryAssigner;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.Transformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.ArithmeticAdditionTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.ArithmeticDivisionTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.ArithmeticModuloTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.ArithmeticMultiplicationTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.ArithmeticSubtractionTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.CompareEqualToTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.CompareGreaterEqualTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.CompareGreaterThanTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.CompareLessEqualTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.CompareLessThanTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.CompareNonEqualTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.LogicAndTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.binary.LogicOrTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.multi.MappableUDFQueryRowTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.multi.UDFQueryRowTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.multi.UDFQueryRowWindowTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.multi.UDFQueryTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.ternary.BetweenTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.unary.ArithmeticNegationTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.unary.InTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.unary.IsNullTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.unary.LogicNotTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.unary.RegularTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.transformer.unary.TransparentTransformer;
-import org.apache.iotdb.db.mpp.transformation.dag.udf.UDTFContext;
-import org.apache.iotdb.db.mpp.transformation.dag.udf.UDTFExecutor;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.udf.api.customizer.strategy.AccessStrategy;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-@Deprecated
-// remove after finishing MPP
-public class OldIntermediateLayerVisitor
-    extends ExpressionVisitor<
-        IntermediateLayer, OldIntermediateLayerVisitor.OldIntermediateLayerVisitorContext> {
-
-  @Override
-  public IntermediateLayer visitExpression(
-      Expression expression, OldIntermediateLayerVisitorContext context) {
-    throw new UnsupportedOperationException(
-        "Unsupported statement type: " + expression.getClass().getName());
-  }
-
-  @Override
-  public IntermediateLayer visitUnaryExpression(
-      UnaryExpression unaryExpression, OldIntermediateLayerVisitorContext context) {
-    if (!context.expressionIntermediateLayerMap.containsKey(unaryExpression)) {
-      float memoryBudgetInMB = context.memoryAssigner.assign();
-
-      IntermediateLayer parentLayerPointReader =
-          this.process(unaryExpression.getExpression(), context);
-      Transformer transformer =
-          getConcreteUnaryTransformer(
-              unaryExpression, parentLayerPointReader.constructPointReader());
-      context.expressionDataTypeMap.put(unaryExpression, transformer.getDataType());
-
-      // SingleInputColumnMultiReferenceIntermediateLayer doesn't support ConstantLayerPointReader
-      // yet. And since a ConstantLayerPointReader won't produce too much IO,
-      // SingleInputColumnSingleReferenceIntermediateLayer could be a better choice.
-      context.expressionIntermediateLayerMap.put(
-          unaryExpression,
-          context.memoryAssigner.getReference(unaryExpression) == 1
-                  || unaryExpression.isConstantOperand()
-              ? new SingleInputColumnSingleReferenceIntermediateLayer(
-                  unaryExpression, context.queryId, memoryBudgetInMB, transformer)
-              : new SingleInputColumnMultiReferenceIntermediateLayer(
-                  unaryExpression, context.queryId, memoryBudgetInMB, transformer));
-    }
-
-    return context.expressionIntermediateLayerMap.get(unaryExpression);
-  }
-
-  @Override
-  public IntermediateLayer visitBinaryExpression(
-      BinaryExpression binaryExpression, OldIntermediateLayerVisitorContext context) {
-    if (!context.expressionIntermediateLayerMap.containsKey(binaryExpression)) {
-      float memoryBudgetInMB = context.memoryAssigner.assign();
-
-      IntermediateLayer leftParentIntermediateLayer =
-          this.process(binaryExpression.getLeftExpression(), context);
-      IntermediateLayer rightParentIntermediateLayer =
-          this.process(binaryExpression.getRightExpression(), context);
-
-      Transformer transformer =
-          getConcreteBinaryTransformer(
-              binaryExpression,
-              leftParentIntermediateLayer.constructPointReader(),
-              rightParentIntermediateLayer.constructPointReader());
-
-      context.expressionDataTypeMap.put(binaryExpression, transformer.getDataType());
-
-      // SingleInputColumnMultiReferenceIntermediateLayer doesn't support ConstantLayerPointReader
-      // yet. And since a ConstantLayerPointReader won't produce too much IO,
-      // SingleInputColumnSingleReferenceIntermediateLayer could be a better choice.
-      context.expressionIntermediateLayerMap.put(
-          binaryExpression,
-          context.memoryAssigner.getReference(binaryExpression) == 1
-                  || binaryExpression.isConstantOperand()
-              ? new SingleInputColumnSingleReferenceIntermediateLayer(
-                  binaryExpression, context.queryId, memoryBudgetInMB, transformer)
-              : new SingleInputColumnMultiReferenceIntermediateLayer(
-                  binaryExpression, context.queryId, memoryBudgetInMB, transformer));
-    }
-
-    return context.expressionIntermediateLayerMap.get(binaryExpression);
-  }
-
-  @Override
-  public IntermediateLayer visitTernaryExpression(
-      TernaryExpression ternaryExpression, OldIntermediateLayerVisitorContext context) {
-    if (!context.expressionIntermediateLayerMap.containsKey(ternaryExpression)) {
-      float memoryBudgetInMB = context.memoryAssigner.assign();
-
-      IntermediateLayer firstParentIntermediateLayer =
-          this.process(ternaryExpression.getFirstExpression(), context);
-      IntermediateLayer secondParentIntermediateLayer =
-          this.process(ternaryExpression.getSecondExpression(), context);
-      IntermediateLayer thirdParentIntermediateLayer =
-          this.process(ternaryExpression.getThirdExpression(), context);
-      Transformer transformer =
-          getConcreteTernaryTransformer(
-              ternaryExpression,
-              firstParentIntermediateLayer.constructPointReader(),
-              secondParentIntermediateLayer.constructPointReader(),
-              thirdParentIntermediateLayer.constructPointReader());
-
-      context.expressionDataTypeMap.put(ternaryExpression, transformer.getDataType());
-
-      // SingleInputColumnMultiReferenceIntermediateLayer doesn't support ConstantLayerPointReader
-      // yet. And since a ConstantLayerPointReader won't produce too much IO,
-      // SingleInputColumnSingleReferenceIntermediateLayer could be a better choice.
-      context.expressionIntermediateLayerMap.put(
-          ternaryExpression,
-          context.memoryAssigner.getReference(ternaryExpression) == 1
-                  || ternaryExpression.isConstantOperand()
-              ? new SingleInputColumnSingleReferenceIntermediateLayer(
-                  ternaryExpression, context.queryId, memoryBudgetInMB, transformer)
-              : new SingleInputColumnMultiReferenceIntermediateLayer(
-                  ternaryExpression, context.queryId, memoryBudgetInMB, transformer));
-    }
-
-    return context.expressionIntermediateLayerMap.get(ternaryExpression);
-  }
-
-  @Override
-  public IntermediateLayer visitFunctionExpression(
-      FunctionExpression functionExpression, OldIntermediateLayerVisitorContext context) {
-    if (!context.expressionIntermediateLayerMap.containsKey(functionExpression)) {
-      float memoryBudgetInMB = context.memoryAssigner.assign();
-      Transformer transformer;
-      if (functionExpression.isBuiltInAggregationFunctionExpression()) {
-        transformer =
-            new TransparentTransformer(
-                context.rawTimeSeriesInputLayer.constructValuePointReader(
-                    functionExpression.getInputColumnIndex()));
-      } else {
-        try {
-          IntermediateLayer udfInputIntermediateLayer =
-              constructUdfInputIntermediateLayer(functionExpression, context);
-          transformer = getUdfTransformer(functionExpression, context, udfInputIntermediateLayer);
-        } catch (QueryProcessException | IOException e) {
-          throw new RuntimeException(e);
-        }
-      }
-      context.expressionDataTypeMap.put(functionExpression, transformer.getDataType());
-      context.expressionIntermediateLayerMap.put(
-          functionExpression,
-          context.memoryAssigner.getReference(functionExpression) == 1
-              ? new SingleInputColumnSingleReferenceIntermediateLayer(
-                  functionExpression, context.queryId, memoryBudgetInMB, transformer)
-              : new SingleInputColumnMultiReferenceIntermediateLayer(
-                  functionExpression, context.queryId, memoryBudgetInMB, transformer));
-    }
-
-    return context.expressionIntermediateLayerMap.get(functionExpression);
-  }
-
-  @Override
-  public IntermediateLayer visitTimeStampOperand(
-      TimestampOperand timestampOperand, OldIntermediateLayerVisitorContext context) {
-    if (!context.expressionIntermediateLayerMap.containsKey(timestampOperand)) {
-      float memoryBudgetInMB = context.memoryAssigner.assign();
-
-      LayerPointReader parentLayerPointReader =
-          context.rawTimeSeriesInputLayer.constructTimePointReader();
-
-      context.expressionDataTypeMap.put(timestampOperand, parentLayerPointReader.getDataType());
-      context.expressionIntermediateLayerMap.put(
-          timestampOperand,
-          context.memoryAssigner.getReference(timestampOperand) == 1
-              ? new SingleInputColumnSingleReferenceIntermediateLayer(
-                  timestampOperand, context.queryId, memoryBudgetInMB, parentLayerPointReader)
-              : new SingleInputColumnMultiReferenceIntermediateLayer(
-                  timestampOperand, context.queryId, memoryBudgetInMB, parentLayerPointReader));
-    }
-
-    return context.expressionIntermediateLayerMap.get(timestampOperand);
-  }
-
-  @Override
-  public IntermediateLayer visitTimeSeriesOperand(
-      TimeSeriesOperand timeSeriesOperand, OldIntermediateLayerVisitorContext context) {
-    if (!context.expressionIntermediateLayerMap.containsKey(timeSeriesOperand)) {
-      float memoryBudgetInMB = context.memoryAssigner.assign();
-
-      LayerPointReader parentLayerPointReader =
-          context.rawTimeSeriesInputLayer.constructValuePointReader(
-              timeSeriesOperand.getInputColumnIndex());
-
-      context.expressionDataTypeMap.put(timeSeriesOperand, parentLayerPointReader.getDataType());
-      context.expressionIntermediateLayerMap.put(
-          timeSeriesOperand,
-          context.memoryAssigner.getReference(timeSeriesOperand) == 1
-              ? new SingleInputColumnSingleReferenceIntermediateLayer(
-                  timeSeriesOperand, context.queryId, memoryBudgetInMB, parentLayerPointReader)
-              : new SingleInputColumnMultiReferenceIntermediateLayer(
-                  timeSeriesOperand, context.queryId, memoryBudgetInMB, parentLayerPointReader));
-    }
-
-    return context.expressionIntermediateLayerMap.get(timeSeriesOperand);
-  }
-
-  @Override
-  public IntermediateLayer visitConstantOperand(
-      ConstantOperand constantOperand, OldIntermediateLayerVisitorContext context) {
-    if (!context.expressionIntermediateLayerMap.containsKey(constantOperand)) {
-      try {
-        context.expressionDataTypeMap.put(constantOperand, constantOperand.getDataType());
-        IntermediateLayer intermediateLayer =
-            new ConstantIntermediateLayer(
-                constantOperand, context.queryId, context.memoryAssigner.assign());
-        context.expressionIntermediateLayerMap.put(constantOperand, intermediateLayer);
-      } catch (QueryProcessException e) {
-        throw new RuntimeException(e);
-      }
-    }
-
-    return context.expressionIntermediateLayerMap.get(constantOperand);
-  }
-
-  private Transformer getConcreteUnaryTransformer(
-      Expression expression, LayerPointReader pointReader) {
-    switch (expression.getExpressionType()) {
-      case IN:
-        InExpression inExpression = (InExpression) expression;
-        return new InTransformer(pointReader, inExpression.isNotIn(), inExpression.getValues());
-      case IS_NULL:
-        IsNullExpression isNullExpression = (IsNullExpression) expression;
-        return new IsNullTransformer(pointReader, isNullExpression.isNot());
-      case LOGIC_NOT:
-        return new LogicNotTransformer(pointReader);
-      case NEGATION:
-        return new ArithmeticNegationTransformer(pointReader);
-      case LIKE:
-        LikeExpression likeExpression = (LikeExpression) expression;
-        return new RegularTransformer(pointReader, likeExpression.getPattern());
-      case REGEXP:
-        RegularExpression regularExpression = (RegularExpression) expression;
-        return new RegularTransformer(pointReader, regularExpression.getPattern());
-      default:
-        throw new UnsupportedOperationException(
-            "Unsupported Expression Type: " + expression.getExpressionType());
-    }
-  }
-
-  private Transformer getConcreteBinaryTransformer(
-      Expression expression,
-      LayerPointReader leftParentLayerPointReader,
-      LayerPointReader rightParentLayerPointReader) {
-    switch (expression.getExpressionType()) {
-      case ADDITION:
-        return new ArithmeticAdditionTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case SUBTRACTION:
-        return new ArithmeticSubtractionTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case MULTIPLICATION:
-        return new ArithmeticMultiplicationTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case DIVISION:
-        return new ArithmeticDivisionTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case MODULO:
-        return new ArithmeticModuloTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case EQUAL_TO:
-        return new CompareEqualToTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case NON_EQUAL:
-        return new CompareNonEqualTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case GREATER_THAN:
-        return new CompareGreaterThanTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case GREATER_EQUAL:
-        return new CompareGreaterEqualTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case LESS_THAN:
-        return new CompareLessThanTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case LESS_EQUAL:
-        return new CompareLessEqualTransformer(
-            leftParentLayerPointReader, rightParentLayerPointReader);
-      case LOGIC_AND:
-        return new LogicAndTransformer(leftParentLayerPointReader, rightParentLayerPointReader);
-      case LOGIC_OR:
-        return new LogicOrTransformer(leftParentLayerPointReader, rightParentLayerPointReader);
-      default:
-        throw new UnsupportedOperationException(
-            "Unsupported Expression Type: " + expression.getExpressionType());
-    }
-  }
-
-  private Transformer getConcreteTernaryTransformer(
-      Expression expression,
-      LayerPointReader firstParentLayerPointReader,
-      LayerPointReader secondParentLayerPointReader,
-      LayerPointReader thirdParentLayerPointReader) {
-    switch (expression.getExpressionType()) {
-      case BETWEEN:
-        BetweenExpression betweenExpression = (BetweenExpression) expression;
-        return new BetweenTransformer(
-            firstParentLayerPointReader,
-            secondParentLayerPointReader,
-            thirdParentLayerPointReader,
-            betweenExpression.isNotBetween());
-      default:
-        throw new UnsupportedOperationException(
-            "Unsupported Expression Type: " + expression.getExpressionType());
-    }
-  }
-
-  private UDFQueryTransformer getUdfTransformer(
-      FunctionExpression functionExpression,
-      OldIntermediateLayerVisitorContext context,
-      IntermediateLayer udfInputIntermediateLayer)
-      throws QueryProcessException, IOException {
-    UDTFExecutor executor = context.udtfContext.getExecutorByFunctionExpression(functionExpression);
-    List<Expression> expressions = functionExpression.getExpressions();
-
-    executor.beforeStart(
-        context.queryId,
-        context.memoryAssigner.assign(),
-        expressions.stream().map(Expression::toString).collect(Collectors.toList()),
-        expressions.stream().map(context.expressionDataTypeMap::get).collect(Collectors.toList()),
-        functionExpression.getFunctionAttributes());
-
-    AccessStrategy accessStrategy = executor.getConfigurations().getAccessStrategy();
-    switch (accessStrategy.getAccessStrategyType()) {
-      case MAPPABLE_ROW_BY_ROW:
-        return new MappableUDFQueryRowTransformer(
-            udfInputIntermediateLayer.constructRowReader(), executor);
-      case ROW_BY_ROW:
-        return new UDFQueryRowTransformer(udfInputIntermediateLayer.constructRowReader(), executor);
-      case SLIDING_SIZE_WINDOW:
-      case SLIDING_TIME_WINDOW:
-        return new UDFQueryRowWindowTransformer(
-            udfInputIntermediateLayer.constructRowWindowReader(
-                accessStrategy, context.memoryAssigner.assign()),
-            executor);
-      default:
-        throw new UnsupportedOperationException("Unsupported transformer access strategy");
-    }
-  }
-
-  private IntermediateLayer constructUdfInputIntermediateLayer(
-      FunctionExpression functionExpression, OldIntermediateLayerVisitorContext context)
-      throws QueryProcessException, IOException {
-    List<IntermediateLayer> intermediateLayers = new ArrayList<>();
-    for (Expression expression : functionExpression.getExpressions()) {
-      intermediateLayers.add(this.process(expression, context));
-    }
-    return intermediateLayers.size() == 1
-        ? intermediateLayers.get(0)
-        : new MultiInputColumnIntermediateLayer(
-            functionExpression,
-            context.queryId,
-            context.memoryAssigner.assign(),
-            intermediateLayers.stream()
-                .map(IntermediateLayer::constructPointReader)
-                .collect(Collectors.toList()));
-  }
-
-  public static class OldIntermediateLayerVisitorContext {
-    long queryId;
-
-    UDTFContext udtfContext;
-
-    QueryDataSetInputLayer rawTimeSeriesInputLayer;
-
-    Map<Expression, IntermediateLayer> expressionIntermediateLayerMap;
-
-    Map<Expression, TSDataType> expressionDataTypeMap;
-
-    LayerMemoryAssigner memoryAssigner;
-
-    public OldIntermediateLayerVisitorContext(
-        long queryId,
-        UDTFContext udtfContext,
-        QueryDataSetInputLayer rawTimeSeriesInputLayer,
-        Map<Expression, IntermediateLayer> expressionIntermediateLayerMap,
-        Map<Expression, TSDataType> expressionDataTypeMap,
-        LayerMemoryAssigner memoryAssigner) {
-      this.queryId = queryId;
-      this.udtfContext = udtfContext;
-      this.rawTimeSeriesInputLayer = rawTimeSeriesInputLayer;
-      this.expressionIntermediateLayerMap = expressionIntermediateLayerMap;
-      this.expressionDataTypeMap = expressionDataTypeMap;
-      this.memoryAssigner = memoryAssigner;
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java
index e5ed00bc24..ff4255064e 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java
@@ -31,12 +31,9 @@ import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.utils.PathUtils;
 import org.apache.iotdb.db.conf.IoTDBConfig;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.exception.sql.SQLParserException;
+import org.apache.iotdb.db.constant.SqlConstant;
 import org.apache.iotdb.db.exception.sql.SemanticException;
-import org.apache.iotdb.db.mpp.common.filter.BasicFunctionFilter;
-import org.apache.iotdb.db.mpp.common.filter.QueryFilter;
 import org.apache.iotdb.db.mpp.plan.analyze.ExpressionAnalyzer;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
 import org.apache.iotdb.db.mpp.plan.expression.ExpressionType;
 import org.apache.iotdb.db.mpp.plan.expression.binary.AdditionExpression;
@@ -67,6 +64,7 @@ import org.apache.iotdb.db.mpp.plan.expression.unary.NegationExpression;
 import org.apache.iotdb.db.mpp.plan.expression.unary.RegularExpression;
 import org.apache.iotdb.db.mpp.plan.statement.AuthorType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.component.FillComponent;
 import org.apache.iotdb.db.mpp.plan.statement.component.FillPolicy;
 import org.apache.iotdb.db.mpp.plan.statement.component.FromComponent;
@@ -157,7 +155,6 @@ import org.apache.iotdb.db.mpp.plan.statement.sys.sync.ShowPipeSinkTypeStatement
 import org.apache.iotdb.db.mpp.plan.statement.sys.sync.ShowPipeStatement;
 import org.apache.iotdb.db.mpp.plan.statement.sys.sync.StartPipeStatement;
 import org.apache.iotdb.db.mpp.plan.statement.sys.sync.StopPipeStatement;
-import org.apache.iotdb.db.qp.constant.SQLConstant;
 import org.apache.iotdb.db.qp.sql.IoTDBSqlParser;
 import org.apache.iotdb.db.qp.sql.IoTDBSqlParser.ConstantContext;
 import org.apache.iotdb.db.qp.sql.IoTDBSqlParser.CountDevicesContext;
@@ -170,7 +167,7 @@ import org.apache.iotdb.db.qp.sql.IoTDBSqlParser.ExpressionContext;
 import org.apache.iotdb.db.qp.sql.IoTDBSqlParser.IdentifierContext;
 import org.apache.iotdb.db.qp.sql.IoTDBSqlParser.ShowFunctionsContext;
 import org.apache.iotdb.db.qp.sql.IoTDBSqlParserBaseVisitor;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.trigger.api.enums.TriggerEvent;
 import org.apache.iotdb.trigger.api.enums.TriggerType;
 import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
@@ -179,7 +176,6 @@ import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
 import org.apache.iotdb.tsfile.read.common.TimeRange;
-import org.apache.iotdb.tsfile.utils.Pair;
 
 import com.google.common.collect.ImmutableSet;
 
@@ -267,16 +263,11 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     }
 
     Map<String, String> props = new HashMap<>();
-    if (ctx.dataType != null) {
-      if (ctx.attributeKey() != null) {
-        if (!parseAttributeKey(ctx.attributeKey())
-            .equalsIgnoreCase(IoTDBConstant.COLUMN_TIMESERIES_DATATYPE)) {
-          throw new SQLParserException("expecting datatype");
-        }
-      }
+    TSDataType dataType = parseDataTypeAttribute(ctx);
+    if (dataType != null) {
       props.put(
           IoTDBConstant.COLUMN_TIMESERIES_DATATYPE.toLowerCase(),
-          parseAttributeValue(ctx.dataType).toLowerCase());
+          dataType.toString().toLowerCase());
     }
     List<IoTDBSqlParser.AttributePairContext> attributePairs = ctx.attributePair();
     if (ctx.attributePair(0) != null) {
@@ -367,22 +358,8 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       createAlignedTimeSeriesStatement.addAliasList(null);
     }
 
-    TSDataType dataType = null;
-    if (ctx.dataType != null) {
-      if (ctx.attributeKey() != null) {
-        if (!parseAttributeKey(ctx.attributeKey())
-            .equalsIgnoreCase(IoTDBConstant.COLUMN_TIMESERIES_DATATYPE)) {
-          throw new SQLParserException("expecting datatype");
-        }
-      }
-      String dataTypeString = ctx.dataType.getText().toUpperCase();
-      try {
-        dataType = TSDataType.valueOf(dataTypeString);
-        createAlignedTimeSeriesStatement.addDataType(dataType);
-      } catch (Exception e) {
-        throw new SemanticException(String.format("unsupported datatype: %s", dataTypeString));
-      }
-    }
+    TSDataType dataType = parseDataTypeAttribute(ctx);
+    createAlignedTimeSeriesStatement.addDataType(dataType);
 
     Map<String, String> props = new HashMap<>();
     if (ctx.attributePair() != null) {
@@ -435,7 +412,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     }
 
     if (props.size() > 0) {
-      throw new SQLParserException("create aligned timeseries: property is not supported yet.");
+      throw new SemanticException("create aligned timeseries: property is not supported yet.");
     }
 
     if (ctx.tagClause() != null) {
@@ -558,7 +535,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     } else {
       showTimeSeriesStatement =
           new ShowTimeSeriesStatement(
-              new PartialPath(SQLConstant.getSingleRootArray()), orderByHeat);
+              new PartialPath(SqlConstant.getSingleRootArray()), orderByHeat);
     }
     if (ctx.tagWhereClause() != null) {
       parseTagWhereClause(ctx.tagWhereClause(), showTimeSeriesStatement);
@@ -612,7 +589,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.prefixPath() != null) {
       return new ShowStorageGroupStatement(parsePrefixPath(ctx.prefixPath()));
     } else {
-      return new ShowStorageGroupStatement(new PartialPath(SQLConstant.getSingleRootArray()));
+      return new ShowStorageGroupStatement(new PartialPath(SqlConstant.getSingleRootArray()));
     }
   }
 
@@ -625,7 +602,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       showDevicesStatement = new ShowDevicesStatement(parsePrefixPath(ctx.prefixPath()));
     } else {
       showDevicesStatement =
-          new ShowDevicesStatement(new PartialPath(SQLConstant.getSingleRootArray()));
+          new ShowDevicesStatement(new PartialPath(SqlConstant.getSingleRootArray()));
     }
     if (ctx.rowPaginationClause() != null) {
       if (ctx.rowPaginationClause().limitClause() != null) {
@@ -650,7 +627,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.prefixPath() != null) {
       path = parsePrefixPath(ctx.prefixPath());
     } else {
-      path = new PartialPath(SQLConstant.getSingleRootArray());
+      path = new PartialPath(SqlConstant.getSingleRootArray());
     }
     return new CountDevicesStatement(path);
   }
@@ -663,7 +640,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.prefixPath() != null) {
       path = parsePrefixPath(ctx.prefixPath());
     } else {
-      path = new PartialPath(SQLConstant.getSingleRootArray());
+      path = new PartialPath(SqlConstant.getSingleRootArray());
     }
     if (ctx.INTEGER_LITERAL() != null) {
       int level = Integer.parseInt(ctx.INTEGER_LITERAL().getText());
@@ -684,7 +661,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.prefixPath() != null) {
       path = parsePrefixPath(ctx.prefixPath());
     } else {
-      path = new PartialPath(SQLConstant.getSingleRootArray());
+      path = new PartialPath(SqlConstant.getSingleRootArray());
     }
     int level = Integer.parseInt(ctx.INTEGER_LITERAL().getText());
     return new CountNodesStatement(path, level);
@@ -697,7 +674,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.prefixPath() != null) {
       path = parsePrefixPath(ctx.prefixPath());
     } else {
-      path = new PartialPath(SQLConstant.getSingleRootArray());
+      path = new PartialPath(SqlConstant.getSingleRootArray());
     }
     return new CountStorageGroupStatement(path);
   }
@@ -731,7 +708,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     try {
       URI uri = new URI(uriString);
     } catch (URISyntaxException e) {
-      throw new SQLParserException(String.format("Invalid URI: %s", uriString));
+      throw new SemanticException(String.format("Invalid URI: %s", uriString));
     }
     return uriString;
   }
@@ -812,7 +789,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.prefixPath() != null) {
       return new ShowChildPathsStatement(parsePrefixPath(ctx.prefixPath()));
     } else {
-      return new ShowChildPathsStatement(new PartialPath(SQLConstant.getSingleRootArray()));
+      return new ShowChildPathsStatement(new PartialPath(SqlConstant.getSingleRootArray()));
     }
   }
 
@@ -822,7 +799,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.prefixPath() != null) {
       return new ShowChildNodesStatement(parsePrefixPath(ctx.prefixPath()));
     } else {
-      return new ShowChildNodesStatement(new PartialPath(SQLConstant.getSingleRootArray()));
+      return new ShowChildNodesStatement(new PartialPath(SqlConstant.getSingleRootArray()));
     }
   }
 
@@ -957,7 +934,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
           groupByKeys.add("TAGS");
           queryStatement.setGroupByTagComponent(parseGroupByTagClause(groupByAttribute));
         } else {
-          throw new SQLParserException("Unknown GROUP BY type.");
+          throw new SemanticException("Unknown GROUP BY type.");
         }
       }
     }
@@ -1260,7 +1237,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     } else if (constantContext.dateExpression() != null) {
       return new LongLiteral(parseDateExpression(constantContext.dateExpression()));
     } else {
-      throw new SQLParserException("Unsupported constant operand: " + text);
+      throw new SemanticException("Unsupported constant value in FILL: " + text);
     }
   }
 
@@ -1384,7 +1361,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
         if (insertMultiValues.size() != 1) {
           throw new SemanticException("need timestamps when insert multi rows");
         }
-        timestamp = parseDateFormat(SQLConstant.NOW_FUNC);
+        timestamp = parseDateFormat(SqlConstant.NOW_FUNC);
       }
       timeArray[i] = timestamp;
 
@@ -1421,7 +1398,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       }
       return loadTsFileStatement;
     } catch (FileNotFoundException e) {
-      throw new SQLParserException(e.getMessage());
+      throw new SemanticException(e.getMessage());
     }
   }
 
@@ -1441,7 +1418,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     } else if (ctx.VERIFY() != null) {
       loadTsFileStatement.setVerifySchema(Boolean.parseBoolean(ctx.BOOLEAN_LITERAL().getText()));
     } else {
-      throw new SQLParserException(
+      throw new SemanticException(
           String.format(
               "load tsfile format %s error, please input AUTOREGISTER | SGLEVEL | VERIFY.",
               ctx.getText()));
@@ -1468,13 +1445,12 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
 
   /** path of expression in withoutNull clause can start with root. */
   private PartialPath parseFullPathInExpression(
-      IoTDBSqlParser.FullPathInExpressionContext ctx, boolean inWithoutNull)
-      throws SQLParserException {
+      IoTDBSqlParser.FullPathInExpressionContext ctx, boolean inWithoutNull) {
     List<IoTDBSqlParser.NodeNameContext> nodeNames = ctx.nodeName();
     int size = nodeNames.size();
     if (ctx.ROOT() != null) {
       if (!inWithoutNull) {
-        throw new SQLParserException("Path can not start with root in select clause.");
+        throw new SemanticException("Path can not start with root in select clause.");
       }
       size++;
     }
@@ -1579,7 +1555,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
   private void checkNodeNameInIntoPath(String src) {
     // ${} are allowed
     if (!TsFileConstant.NODE_NAME_IN_INTO_PATH_PATTERN.matcher(src).matches()) {
-      throw new SQLParserException(
+      throw new SemanticException(
           String.format(
               "%s is illegal, unquoted node name in select into clause can only consist of digits, characters, $, { and }",
               src));
@@ -1588,7 +1564,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
 
   private void checkIdentifier(String src) {
     if (!TsFileConstant.IDENTIFIER_PATTERN.matcher(src).matches()) {
-      throw new SQLParserException(
+      throw new SemanticException(
           String.format(
               "%s is illegal, identifier not enclosed with backticks can only consist of digits, characters and underscore.",
               src));
@@ -1597,17 +1573,17 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
 
   // Literals ========================================================================
 
-  public long parseDateFormat(String timestampStr) throws SQLParserException {
+  public long parseDateFormat(String timestampStr) {
     if (timestampStr == null || "".equals(timestampStr.trim())) {
       throw new SemanticException("input timestamp cannot be empty");
     }
-    if (timestampStr.equalsIgnoreCase(SQLConstant.NOW_FUNC)) {
+    if (timestampStr.equalsIgnoreCase(SqlConstant.NOW_FUNC)) {
       return DateTimeUtils.currentTime();
     }
     try {
       return DateTimeUtils.convertDatetimeStrToLong(timestampStr, zoneId);
     } catch (Exception e) {
-      throw new SQLParserException(
+      throw new SemanticException(
           String.format(
               "Input time format %s error. "
                   + "Input like yyyy-MM-dd HH:mm:ss, yyyy-MM-ddTHH:mm:ss or "
@@ -1616,17 +1592,17 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     }
   }
 
-  public long parseDateFormat(String timestampStr, long currentTime) throws SQLParserException {
+  public long parseDateFormat(String timestampStr, long currentTime) {
     if (timestampStr == null || "".equals(timestampStr.trim())) {
       throw new SemanticException("input timestamp cannot be empty");
     }
-    if (timestampStr.equalsIgnoreCase(SQLConstant.NOW_FUNC)) {
+    if (timestampStr.equalsIgnoreCase(SqlConstant.NOW_FUNC)) {
       return currentTime;
     }
     try {
       return DateTimeUtils.convertDatetimeStrToLong(timestampStr, zoneId);
     } catch (Exception e) {
-      throw new SQLParserException(
+      throw new SemanticException(
           String.format(
               "Input time format %s error. "
                   + "Input like yyyy-MM-dd HH:mm:ss, yyyy-MM-ddTHH:mm:ss or "
@@ -1693,7 +1669,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       alias = parseConstant(ctx.constant());
       if (PathUtils.isRealNumber(alias)
           || !TsFileConstant.IDENTIFIER_PATTERN.matcher(alias).matches()) {
-        throw new SQLParserException("Not support for this alias, Please enclose in back quotes.");
+        throw new SemanticException("Not support for this alias, Please enclose in back quotes.");
       }
     } else {
       alias = parseNodeString(ctx.identifier().getText());
@@ -1840,7 +1816,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (!(pathRelevant
         || (nodeNameList.size() == 1
             && nodeNameList.contains(new PartialPath(ALL_RESULT_NODES))))) {
-      throw new SQLParserException(
+      throw new SemanticException(
           String.format(
               "path independent privilege: [%s] can only be set on path: root.**",
               errorPrivilegeName));
@@ -2247,7 +2223,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
         if (subLeftExpression.isConstantOperand()
             && (!(subRightExpression.isConstantOperand()
                 && ((ConstantOperand) subRightExpression).getDataType().equals(TSDataType.TEXT)))) {
-          throw new SQLParserException("Attributes of functions should be quoted with '' or \"\"");
+          throw new SemanticException("Attributes of functions should be quoted with '' or \"\"");
         }
         if (subLeftExpression.isConstantOperand() && subRightExpression.isConstantOperand()) {
           // parse attribute
@@ -2310,7 +2286,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     } else if (constantContext.dateExpression() != null) {
       return String.valueOf(parseDateExpression(constantContext.dateExpression()));
     } else {
-      throw new IllegalArgumentException("Unsupported constant operand: " + text);
+      throw new IllegalArgumentException("Unsupported constant value: " + text);
     }
   }
 
@@ -2328,7 +2304,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       return new ConstantOperand(
           TSDataType.INT64, String.valueOf(parseDateExpression(constantContext.dateExpression())));
     } else {
-      throw new SQLParserException("Unsupported constant operand: " + text);
+      throw new SemanticException("Unsupported constant operand: " + text);
     }
   }
 
@@ -2381,7 +2357,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
         }
         return Long.parseLong(ctx.INTEGER_LITERAL().getText());
       } catch (NumberFormatException e) {
-        throw new SQLParserException(
+        throw new SemanticException(
             String.format("Can not parse %s to long value", ctx.INTEGER_LITERAL().getText()));
       }
     } else if (ctx.dateExpression() != null) {
@@ -2431,30 +2407,6 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     return parseIdentifier(ctx.getText());
   }
 
-  private Pair<Long, Long> calcOperatorInterval(QueryFilter queryFilter) {
-
-    if (queryFilter.getSinglePath() != null
-        && !IoTDBConstant.TIME.equals(queryFilter.getSinglePath().getMeasurement())) {
-      throw new SemanticException(DELETE_ONLY_SUPPORT_TIME_EXP_ERROR_MSG);
-    }
-
-    long time = Long.parseLong(((BasicFunctionFilter) queryFilter).getValue());
-    switch (queryFilter.getFilterType()) {
-      case LESSTHAN:
-        return new Pair<>(Long.MIN_VALUE, time - 1);
-      case LESSTHANOREQUALTO:
-        return new Pair<>(Long.MIN_VALUE, time);
-      case GREATERTHAN:
-        return new Pair<>(time + 1, Long.MAX_VALUE);
-      case GREATERTHANOREQUALTO:
-        return new Pair<>(time, Long.MAX_VALUE);
-      case EQUAL:
-        return new Pair<>(time, time);
-      default:
-        throw new SemanticException(DELETE_RANGE_ERROR_MSG);
-    }
-  }
-
   // Merge
   @Override
   public Statement visitMerge(IoTDBSqlParser.MergeContext ctx) {
@@ -2680,25 +2632,11 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       List<TSEncoding> encodings,
       List<CompressionType> compressors) {
     if (ctx.aliasNodeName() != null) {
-      throw new SQLParserException("schema template: alias is not supported yet.");
+      throw new SemanticException("schema template: alias is not supported yet.");
     }
 
-    TSDataType dataType = null;
-    if (ctx.dataType != null) {
-      if (ctx.attributeKey() != null) {
-        if (!parseAttributeKey(ctx.attributeKey())
-            .equalsIgnoreCase(IoTDBConstant.COLUMN_TIMESERIES_DATATYPE)) {
-          throw new SQLParserException("expecting datatype");
-        }
-      }
-      String dataTypeString = ctx.dataType.getText().toUpperCase();
-      try {
-        dataType = TSDataType.valueOf(dataTypeString);
-        dataTypes.add(dataType);
-      } catch (Exception e) {
-        throw new SemanticException(String.format("unsupported datatype: %s", dataTypeString));
-      }
-    }
+    TSDataType dataType = parseDataTypeAttribute(ctx);
+    dataTypes.add(dataType);
 
     Map<String, String> props = new HashMap<>();
     if (ctx.attributePair() != null) {
@@ -2751,18 +2689,37 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     }
 
     if (props.size() > 0) {
-      throw new SQLParserException("schema template: property is not supported yet.");
+      throw new SemanticException("schema template: property is not supported yet.");
     }
 
     if (ctx.tagClause() != null) {
-      throw new SQLParserException("schema template: tag is not supported yet.");
+      throw new SemanticException("schema template: tag is not supported yet.");
     }
 
     if (ctx.attributeClause() != null) {
-      throw new SQLParserException("schema template: attribute is not supported yet.");
+      throw new SemanticException("schema template: attribute is not supported yet.");
     }
   }
 
+  private TSDataType parseDataTypeAttribute(IoTDBSqlParser.AttributeClausesContext ctx) {
+    TSDataType dataType = null;
+    if (ctx.dataType != null) {
+      if (ctx.attributeKey() != null) {
+        if (!parseAttributeKey(ctx.attributeKey())
+            .equalsIgnoreCase(IoTDBConstant.COLUMN_TIMESERIES_DATATYPE)) {
+          throw new SemanticException("expecting datatype");
+        }
+      }
+      String dataTypeString = ctx.dataType.getText().toUpperCase();
+      try {
+        dataType = TSDataType.valueOf(dataTypeString);
+      } catch (Exception e) {
+        throw new SemanticException(String.format("unsupported datatype: %s", dataTypeString));
+      }
+    }
+    return dataType;
+  }
+
   @Override
   public Statement visitShowSchemaTemplates(IoTDBSqlParser.ShowSchemaTemplatesContext ctx) {
     return new ShowSchemaTemplateStatement();
@@ -2801,7 +2758,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       IoTDBSqlParser.ShowPathsUsingSchemaTemplateContext ctx) {
     PartialPath pathPattern;
     if (ctx.prefixPath() == null) {
-      pathPattern = new PartialPath(SQLConstant.getSingleRootArray());
+      pathPattern = new PartialPath(SqlConstant.getSingleRootArray());
     } else {
       pathPattern = parsePrefixPath(ctx.prefixPath());
     }
@@ -2857,7 +2814,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (expression instanceof TimeSeriesOperand) {
       return ((TimeSeriesOperand) expression).getPath();
     } else if (expression instanceof TimestampOperand) {
-      return SQLConstant.TIME_PATH;
+      return SqlConstant.TIME_PATH;
     } else {
       throw new IllegalArgumentException(
           "Unsupported expression type: " + expression.getExpressionType());
@@ -2865,34 +2822,35 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
   }
 
   private void parseSelectStatementForPipe(
-      IoTDBSqlParser.SelectStatementContext ctx, CreatePipeStatement statement)
-      throws SQLParserException {
+      IoTDBSqlParser.SelectStatementContext ctx, CreatePipeStatement statement) {
+    final String UNSUPPORTED_CLAUSE_IN_PIPE = "Not support for this sql in pipe.";
+
     if (ctx.intoClause() != null
         || ctx.groupByClause() != null
         || ctx.havingClause() != null
         || ctx.fillClause() != null
         || ctx.paginationClause() != null
         || ctx.alignByClause() != null) {
-      throw new SQLParserException("Not support for this sql in pipe.");
+      throw new SemanticException(UNSUPPORTED_CLAUSE_IN_PIPE);
     }
 
     // parse select
     IoTDBSqlParser.SelectClauseContext selectCtx = ctx.selectClause();
     if (selectCtx.LAST() != null || selectCtx.resultColumn().size() != 1) {
-      throw new SQLParserException("Not support for this sql in pipe.");
+      throw new SemanticException(UNSUPPORTED_CLAUSE_IN_PIPE);
     }
     IoTDBSqlParser.ResultColumnContext resultColumnCtx = selectCtx.resultColumn(0);
     if (resultColumnCtx.AS() != null
         || !IoTDBConstant.MULTI_LEVEL_PATH_WILDCARD.equals(
             resultColumnCtx.expression().getText())) {
-      throw new SQLParserException("Not support for this sql in pipe.");
+      throw new SemanticException(UNSUPPORTED_CLAUSE_IN_PIPE);
     }
 
     // parse from
     IoTDBSqlParser.FromClauseContext fromCtx = ctx.fromClause();
     if (fromCtx.prefixPath().size() != 1
         || !IoTDBConstant.PATH_ROOT.equals(fromCtx.prefixPath(0).getText())) {
-      throw new SQLParserException("Not support for this sql in pipe.");
+      throw new SemanticException(UNSUPPORTED_CLAUSE_IN_PIPE);
     }
 
     // parse where
@@ -2902,19 +2860,19 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
           parseExpression(whereCtx.expression(), whereCtx.expression().OPERATOR_NOT() == null);
       if (!((predicate instanceof GreaterThanExpression)
           || (predicate instanceof GreaterEqualExpression))) {
-        throw new SQLParserException("Not support for this sql in pipe.");
+        throw new SemanticException(UNSUPPORTED_CLAUSE_IN_PIPE);
       }
       Expression left = ((BinaryExpression) predicate).getLeftExpression();
       Expression right = ((BinaryExpression) predicate).getRightExpression();
 
-      if (!SQLConstant.isReservedPath(parsePathFromExpression(left))) {
-        throw new SQLParserException("Not support for this sql in pipe.");
+      if (!SqlConstant.isReservedPath(parsePathFromExpression(left))) {
+        throw new SemanticException(UNSUPPORTED_CLAUSE_IN_PIPE);
       }
       if (!(right instanceof ConstantOperand)) {
-        throw new SQLParserException("Not support for this sql in pipe.");
+        throw new SemanticException(UNSUPPORTED_CLAUSE_IN_PIPE);
       }
       if (((ConstantOperand) right).getDataType() != TSDataType.INT64) {
-        throw new SQLParserException("Not support for this sql in pipe.");
+        throw new SemanticException(UNSUPPORTED_CLAUSE_IN_PIPE);
       }
       long startTime = Long.parseLong(((ConstantOperand) right).getValueString());
       statement.setStartTime(startTime);
@@ -2933,7 +2891,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
   }
 
   @Override
-  public Statement visitCreatePipe(IoTDBSqlParser.CreatePipeContext ctx) throws SQLParserException {
+  public Statement visitCreatePipe(IoTDBSqlParser.CreatePipeContext ctx) {
 
     CreatePipeStatement createPipeStatement = new CreatePipeStatement(StatementType.CREATE_PIPE);
 
@@ -2941,7 +2899,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       createPipeStatement.setPipeName(parseIdentifier(ctx.pipeName.getText()));
       createPipeStatement.setPipeSinkName(parseIdentifier(ctx.pipeSinkName.getText()));
     } else {
-      throw new SQLParserException(
+      throw new SemanticException(
           "Not support for this sql in CREATEPIPE, please enter pipename or pipesinkname.");
     }
     if (ctx.selectStatement() != null) {
@@ -2962,7 +2920,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.pipeName != null) {
       startPipeStatement.setPipeName(parseIdentifier(ctx.pipeName.getText()));
     } else {
-      throw new SQLParserException("Not support for this sql in STARTPIPE, please enter pipename.");
+      throw new SemanticException("Not support for this sql in STARTPIPE, please enter pipename.");
     }
     return startPipeStatement;
   }
@@ -2974,7 +2932,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.pipeName != null) {
       stopPipeStatement.setPipeName(parseIdentifier(ctx.pipeName.getText()));
     } else {
-      throw new SQLParserException("Not support for this sql in STOPPIPE, please enter pipename.");
+      throw new SemanticException("Not support for this sql in STOPPIPE, please enter pipename.");
     }
     return stopPipeStatement;
   }
@@ -2987,7 +2945,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.pipeName != null) {
       dropPipeStatement.setPipeName(parseIdentifier(ctx.pipeName.getText()));
     } else {
-      throw new SQLParserException("Not support for this sql in DROPPIPE, please enter pipename.");
+      throw new SemanticException("Not support for this sql in DROPPIPE, please enter pipename.");
     }
     return dropPipeStatement;
   }
@@ -3016,13 +2974,13 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.pipeSinkName != null) {
       createPipeSinkStatement.setPipeSinkName(parseIdentifier(ctx.pipeSinkName.getText()));
     } else {
-      throw new SQLParserException(
+      throw new SemanticException(
           "Not support for this sql in CREATEPIPESINK, please enter pipesinkname.");
     }
     if (ctx.pipeSinkType != null) {
       createPipeSinkStatement.setPipeSinkType(parseIdentifier(ctx.pipeSinkType.getText()));
     } else {
-      throw new SQLParserException(
+      throw new SemanticException(
           "Not support for this sql in CREATEPIPESINK, please enter pipesinktype.");
     }
     if (ctx.syncAttributeClauses() != null) {
@@ -3043,7 +3001,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     if (ctx.pipeSinkName != null) {
       dropPipeSinkStatement.setPipeSinkName(parseIdentifier(ctx.pipeSinkName.getText()));
     } else {
-      throw new SQLParserException(
+      throw new SemanticException(
           "Not support for this sql in DROPPIPESINK, please enter pipesinkname.");
     }
     return dropPipeSinkStatement;
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/SQLParseError.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/SqlParseError.java
similarity index 93%
rename from server/src/main/java/org/apache/iotdb/db/qp/strategy/SQLParseError.java
rename to server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/SqlParseError.java
index 1db0a8915a..e927092a83 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/SQLParseError.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/SqlParseError.java
@@ -16,7 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.iotdb.db.qp.strategy;
+
+package org.apache.iotdb.db.mpp.plan.parser;
 
 import org.antlr.v4.runtime.BaseErrorListener;
 import org.antlr.v4.runtime.Parser;
@@ -29,9 +30,9 @@ import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
-public class SQLParseError extends BaseErrorListener {
+public class SqlParseError extends BaseErrorListener {
 
-  public static final SQLParseError INSTANCE = new SQLParseError();
+  public static final SqlParseError INSTANCE = new SqlParseError();
 
   @Override
   public void syntaxError(
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/StatementGenerator.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/StatementGenerator.java
index 151a475d67..5a82d4541f 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/StatementGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/StatementGenerator.java
@@ -22,6 +22,7 @@ package org.apache.iotdb.db.mpp.plan.parser;
 import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.exception.MetadataException;
 import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.db.constant.SqlConstant;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
 import org.apache.iotdb.db.metadata.template.TemplateQueryType;
 import org.apache.iotdb.db.metadata.utils.MetaFormatUtils;
@@ -57,10 +58,8 @@ import org.apache.iotdb.db.mpp.plan.statement.metadata.template.ShowPathSetTempl
 import org.apache.iotdb.db.mpp.plan.statement.metadata.template.ShowPathsUsingTemplateStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.template.ShowSchemaTemplateStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.template.UnsetSchemaTemplateStatement;
-import org.apache.iotdb.db.qp.constant.SQLConstant;
 import org.apache.iotdb.db.qp.sql.IoTDBSqlParser;
 import org.apache.iotdb.db.qp.sql.SqlLexer;
-import org.apache.iotdb.db.qp.strategy.SQLParseError;
 import org.apache.iotdb.db.utils.QueryDataSetUtils;
 import org.apache.iotdb.service.rpc.thrift.TSCreateAlignedTimeseriesReq;
 import org.apache.iotdb.service.rpc.thrift.TSCreateMultiTimeseriesReq;
@@ -479,14 +478,14 @@ public class StatementGenerator {
 
     SqlLexer lexer1 = new SqlLexer(charStream1);
     lexer1.removeErrorListeners();
-    lexer1.addErrorListener(SQLParseError.INSTANCE);
+    lexer1.addErrorListener(SqlParseError.INSTANCE);
 
     CommonTokenStream tokens1 = new CommonTokenStream(lexer1);
 
     IoTDBSqlParser parser1 = new IoTDBSqlParser(tokens1);
     parser1.getInterpreter().setPredictionMode(PredictionMode.SLL);
     parser1.removeErrorListeners();
-    parser1.addErrorListener(SQLParseError.INSTANCE);
+    parser1.addErrorListener(SqlParseError.INSTANCE);
 
     ParseTree tree;
     try {
@@ -499,7 +498,7 @@ public class StatementGenerator {
 
       SqlLexer lexer2 = new SqlLexer(charStream2);
       lexer2.removeErrorListeners();
-      lexer2.addErrorListener(SQLParseError.INSTANCE);
+      lexer2.addErrorListener(SqlParseError.INSTANCE);
 
       CommonTokenStream tokens2 = new CommonTokenStream(lexer2);
 
@@ -507,7 +506,7 @@ public class StatementGenerator {
           new org.apache.iotdb.db.qp.sql.IoTDBSqlParser(tokens2);
       parser2.getInterpreter().setPredictionMode(PredictionMode.LL);
       parser2.removeErrorListeners();
-      parser2.addErrorListener(SQLParseError.INSTANCE);
+      parser2.addErrorListener(SqlParseError.INSTANCE);
 
       // STAGE 2: parser with full LL(*)
       tree = parser2.singleStatement();
@@ -631,7 +630,7 @@ public class StatementGenerator {
         return new ShowPathSetTemplateStatement(req.getName());
       case SHOW_USING_TEMPLATES:
         return new ShowPathsUsingTemplateStatement(
-            new PartialPath(SQLConstant.getSingleRootArray()), req.getName());
+            new PartialPath(SqlConstant.getSingleRootArray()), req.getName());
       default:
         return null;
     }
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/MemoryDistributionCalculator.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/MemoryDistributionCalculator.java
index fe87cb9972..bd187f74f4 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/MemoryDistributionCalculator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/MemoryDistributionCalculator.java
@@ -70,7 +70,7 @@ import org.apache.iotdb.db.mpp.plan.planner.plan.node.source.LastQueryScanNode;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.source.SeriesAggregationScanNode;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.source.SeriesScanNode;
 
-import static org.apache.iotdb.db.mpp.plan.constant.DataNodeEndPoints.isSameNode;
+import static org.apache.iotdb.db.mpp.common.DataNodeEndPoints.isSameNode;
 
 public class MemoryDistributionCalculator
     extends PlanVisitor<Void, MemoryDistributionCalculator.MemoryDistributionContext> {
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java
index 123df8a63d..75f07c6fc2 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/OperatorTreeGenerator.java
@@ -213,10 +213,10 @@ import java.util.stream.Collectors;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static org.apache.iotdb.db.engine.querycontext.QueryDataSource.updateFilterUsingTTL;
+import static org.apache.iotdb.db.mpp.common.DataNodeEndPoints.isSameNode;
 import static org.apache.iotdb.db.mpp.execution.operator.AggregationUtil.calculateMaxAggregationResultSize;
 import static org.apache.iotdb.db.mpp.execution.operator.AggregationUtil.calculateMaxAggregationResultSizeForLastQuery;
 import static org.apache.iotdb.db.mpp.execution.operator.AggregationUtil.initTimeRangeIterator;
-import static org.apache.iotdb.db.mpp.plan.constant.DataNodeEndPoints.isSameNode;
 
 /** This Visitor is responsible for transferring PlanNode Tree to Operator Tree */
 public class OperatorTreeGenerator extends PlanVisitor<Operator, LocalExecutionPlanContext> {
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/SimpleFragmentParallelPlanner.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/SimpleFragmentParallelPlanner.java
index cc2cfa2337..96719c60cc 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/SimpleFragmentParallelPlanner.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/distribution/SimpleFragmentParallelPlanner.java
@@ -24,10 +24,10 @@ import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
 import org.apache.iotdb.commons.partition.QueryExecutor;
 import org.apache.iotdb.commons.partition.StorageExecutor;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.mpp.common.DataNodeEndPoints;
 import org.apache.iotdb.db.mpp.common.MPPQueryContext;
 import org.apache.iotdb.db.mpp.common.PlanFragmentId;
 import org.apache.iotdb.db.mpp.plan.analyze.Analysis;
-import org.apache.iotdb.db.mpp.plan.constant.DataNodeEndPoints;
 import org.apache.iotdb.db.mpp.plan.planner.IFragmentParallelPlaner;
 import org.apache.iotdb.db.mpp.plan.planner.plan.FragmentInstance;
 import org.apache.iotdb.db.mpp.plan.planner.plan.PlanFragment;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/DnfFilterOptimizer.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/DnfFilterOptimizer.java
deleted file mode 100644
index cf6367cc5e..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/DnfFilterOptimizer.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.mpp.plan.rewriter;
-
-import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
-import org.apache.iotdb.db.mpp.common.filter.QueryFilter;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant.FilterType;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class DnfFilterOptimizer implements IFilterOptimizer {
-
-  /**
-   * get DNF(disjunctive normal form) for this filter operator tree. Before getDnf, this op tree
-   * must be binary, in another word, each non-leaf node has exactly two children.
-   *
-   * @return QueryFilter optimized filter
-   * @throws StatementAnalyzeException exception in DNF optimize
-   */
-  @Override
-  public QueryFilter optimize(QueryFilter filter) throws StatementAnalyzeException {
-    return getDnf(filter);
-  }
-
-  private void dealWithLeftAndRightAndChildren(
-      List<QueryFilter> leftAndChildren,
-      List<QueryFilter> rightAndChildren,
-      List<QueryFilter> newChildrenList)
-      throws StatementAnalyzeException {
-    for (QueryFilter leftAndChild : leftAndChildren) {
-      for (QueryFilter rightAndChild : rightAndChildren) {
-        QueryFilter r = mergeToConjunction(leftAndChild.copy(), rightAndChild.copy());
-        newChildrenList.add(r);
-      }
-    }
-  }
-
-  private QueryFilter getDnf(QueryFilter filter) throws StatementAnalyzeException {
-    if (filter.isLeaf()) {
-      return filter;
-    }
-    List<QueryFilter> childOperators = filter.getChildren();
-    if (childOperators.size() != 2) {
-      throw new StatementAnalyzeException(
-          "node :" + filter.getFilterName() + " has " + childOperators.size() + " children");
-    }
-    QueryFilter left = getDnf(childOperators.get(0));
-    QueryFilter right = getDnf(childOperators.get(1));
-    List<QueryFilter> newChildrenList = new ArrayList<>();
-    switch (filter.getFilterType()) {
-      case KW_OR:
-        addChildOpInOr(left, newChildrenList);
-        addChildOpInOr(right, newChildrenList);
-        break;
-      case KW_AND:
-        if (left.getFilterType() != FilterType.KW_OR && right.getFilterType() != FilterType.KW_OR) {
-          addChildOpInAnd(left, newChildrenList);
-          addChildOpInAnd(right, newChildrenList);
-        } else {
-          dealWithLeftAndRightAndChildren(getAndChild(left), getAndChild(right), newChildrenList);
-          filter.setFilterType(FilterType.KW_OR);
-        }
-        break;
-      default:
-        throw new StatementAnalyzeException(
-            "get DNF failed, this tokenType is:" + filter.getFilterType());
-    }
-    filter.setChildren(newChildrenList);
-    return filter;
-  }
-
-  /**
-   * used by getDnf. merge two conjunction filter operators into a conjunction.<br>
-   * conjunction operator consists of {@code FunctionOperator} and inner operator which token is
-   * KW_AND.<br>
-   * e.g. (a and b) merge (c) is (a and b and c)
-   *
-   * @param operator1 To be merged operator
-   * @param operator2 To be merged operator
-   * @return merged operator
-   * @throws StatementAnalyzeException exception in DNF optimizing
-   */
-  private QueryFilter mergeToConjunction(QueryFilter operator1, QueryFilter operator2)
-      throws StatementAnalyzeException {
-    List<QueryFilter> retChildrenList = new ArrayList<>();
-    addChildOpInAnd(operator1, retChildrenList);
-    addChildOpInAnd(operator2, retChildrenList);
-    QueryFilter ret = new QueryFilter(FilterType.KW_AND, false);
-    ret.setChildren(retChildrenList);
-    return ret;
-  }
-
-  /**
-   * used by getDnf. get conjunction node. <br>
-   * If child is basic function or AND node, return a list just containing this. <br>
-   * If this child is OR, return children of OR.
-   *
-   * @param child operator
-   * @return children operator
-   */
-  private List<QueryFilter> getAndChild(QueryFilter child) {
-    if (child.getFilterType() == FilterType.KW_OR) {
-      return child.getChildren();
-    } else {
-      // other token type means leaf node or and
-      List<QueryFilter> ret = new ArrayList<>();
-      ret.add(child);
-      return ret;
-    }
-  }
-
-  /**
-   * If operator is leaf, add it in newChildrenList. If operator is And, add its children to
-   * newChildrenList.
-   *
-   * @param operator which children should be added in new children list
-   * @param newChildrenList new children list
-   * @throws StatementAnalyzeException exception in DNF optimizing
-   */
-  private void addChildOpInAnd(QueryFilter operator, List<QueryFilter> newChildrenList)
-      throws StatementAnalyzeException {
-    if (operator.isLeaf()) {
-      newChildrenList.add(operator);
-    } else if (operator.getFilterType() == FilterType.KW_AND) {
-      newChildrenList.addAll(operator.getChildren());
-    } else {
-      throw new StatementAnalyzeException(
-          "add all children of an OR operator to newChildrenList in AND");
-    }
-  }
-
-  /**
-   * used by getDnf. If operator is leaf or And, add operator to newChildrenList. Else add
-   * operator's children to newChildrenList
-   *
-   * @param operator to be added in new children list
-   * @param newChildrenList new children list
-   */
-  private void addChildOpInOr(QueryFilter operator, List<QueryFilter> newChildrenList) {
-    if (operator.isLeaf() || operator.getFilterType() == FilterType.KW_AND) {
-      newChildrenList.add(operator);
-    } else {
-      newChildrenList.addAll(operator.getChildren());
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/IFilterOptimizer.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/IFilterOptimizer.java
deleted file mode 100644
index 95685f856e..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/IFilterOptimizer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.mpp.plan.rewriter;
-
-import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
-import org.apache.iotdb.db.mpp.common.filter.QueryFilter;
-
-/** provide a query filter, optimize it. */
-@FunctionalInterface
-public interface IFilterOptimizer {
-
-  QueryFilter optimize(QueryFilter filter) throws StatementAnalyzeException;
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/MergeSingleFilterOptimizer.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/MergeSingleFilterOptimizer.java
deleted file mode 100644
index dc0f5b6a52..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/MergeSingleFilterOptimizer.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.mpp.plan.rewriter;
-
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
-import org.apache.iotdb.db.mpp.common.filter.BasicFunctionFilter;
-import org.apache.iotdb.db.mpp.common.filter.QueryFilter;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-
-public class MergeSingleFilterOptimizer implements IFilterOptimizer {
-
-  @Override
-  public QueryFilter optimize(QueryFilter filter) throws StatementAnalyzeException {
-    mergeSamePathFilter(filter);
-    return filter;
-  }
-
-  private void checkInnerFilterLen(List<QueryFilter> children) throws StatementAnalyzeException {
-    if (children.isEmpty()) {
-      throw new StatementAnalyzeException("this inner filter has no children!");
-    }
-    if (children.size() == 1) {
-      throw new StatementAnalyzeException("this inner filter has just one child!");
-    }
-  }
-
-  /**
-   * merge and extract node with same Path recursively. <br>
-   * If a node has more than two children and some children has same paths, remove them from this
-   * node and merge them to a new single node, then add the new node to this children list.<br>
-   * if all recursive children of this node have same seriesPath, set this node to single node, and
-   * return the same seriesPath, otherwise, throw exception;
-   *
-   * @param filter - children is not empty.
-   * @return - if all recursive children of this node have same seriesPath, set this node to single
-   *     node, and return the same seriesPath, otherwise, throw exception;
-   */
-  private PartialPath mergeSamePathFilter(QueryFilter filter) throws StatementAnalyzeException {
-    if (filter.isLeaf()) {
-      return filter.getSinglePath();
-    }
-    List<QueryFilter> children = filter.getChildren();
-    checkInnerFilterLen(children);
-    PartialPath childPath = mergeSamePathFilter(children.get(0));
-    PartialPath tempPath;
-    for (int i = 1; i < children.size(); i++) {
-      tempPath = mergeSamePathFilter(children.get(i));
-      // if one of children differs from others or is not single node(seriesPath = null), filter's
-      // seriesPath is null
-      if (tempPath == null || !tempPath.equals(childPath)) {
-        childPath = null;
-      }
-    }
-    if (childPath != null) {
-      filter.setIsSingle(true);
-      filter.setSinglePath(childPath);
-      return childPath;
-    }
-
-    // sort paths of BasicFunction by their single seriesPath. We don't sort children on non-leaf
-    // layer.
-    if (!children.isEmpty() && allIsBasic(children)) {
-      children.sort(Comparator.comparing(o -> o.getSinglePath().getFullPath()));
-    }
-    List<QueryFilter> ret = new ArrayList<>();
-    int firstNonSingleIndex = mergeSingleFilters(ret, filter);
-
-    // add last null child
-    return addLastNullChild(ret, filter, firstNonSingleIndex, childPath);
-  }
-
-  @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning
-  private int mergeSingleFilters(List<QueryFilter> ret, QueryFilter filter) {
-    List<QueryFilter> children = filter.getChildren();
-    List<QueryFilter> tempExtrNode = null;
-    PartialPath tempPath;
-    PartialPath childPath = null;
-    int firstNonSingleIndex;
-    for (firstNonSingleIndex = 0; firstNonSingleIndex < children.size(); firstNonSingleIndex++) {
-      tempPath = children.get(firstNonSingleIndex).getSinglePath();
-      // sorted by seriesPath, all non-single filters are in the end
-      if (tempPath == null) {
-        break;
-      }
-      if (childPath == null) {
-        // first child to be added
-        childPath = tempPath;
-        tempExtrNode = new ArrayList<>();
-        tempExtrNode.add(children.get(firstNonSingleIndex));
-      } else if (childPath.equals(tempPath)) {
-        // successive next single child with same seriesPath,merge it with previous children
-        // if not duplicate
-        QueryFilter child = children.get(firstNonSingleIndex);
-        if (!tempExtrNode.contains(child)) {
-          tempExtrNode.add(child);
-        }
-      } else {
-        // not more same, add existing nodes in tempExtrNode into a new node
-        // prevent make a node which has only one child.
-        if (tempExtrNode.size() == 1) {
-          ret.add(tempExtrNode.get(0));
-          // use exist Object directly for efficiency
-          tempExtrNode.set(0, children.get(firstNonSingleIndex));
-          childPath = tempPath;
-        } else {
-          // add a new inner node
-          QueryFilter newFilter = new QueryFilter(filter.getFilterType(), true);
-          newFilter.setSinglePath(childPath);
-          newFilter.setChildren(tempExtrNode);
-          ret.add(newFilter);
-          tempExtrNode = new ArrayList<>();
-          tempExtrNode.add(children.get(firstNonSingleIndex));
-          childPath = tempPath;
-        }
-      }
-    }
-    // the last several children before "not single paths" has not been added to ret list.
-    if (childPath != null) {
-      if (tempExtrNode.size() == 1) {
-        ret.add(tempExtrNode.get(0));
-      } else {
-        // add a new inner node
-        QueryFilter newFil = new QueryFilter(filter.getFilterType(), true);
-        newFil.setSinglePath(childPath);
-        newFil.setChildren(tempExtrNode);
-        ret.add(newFil);
-      }
-    }
-    return firstNonSingleIndex;
-  }
-
-  private PartialPath addLastNullChild(
-      List<QueryFilter> ret, QueryFilter filter, int i, PartialPath childPath) {
-    List<QueryFilter> children = filter.getChildren();
-    for (; i < children.size(); i++) {
-      ret.add(children.get(i));
-    }
-    if (ret.size() == 1) {
-      // all children have same seriesPath, which means this filter node is a single node
-      filter.setIsSingle(true);
-      filter.setSinglePath(childPath);
-      filter.setChildren(ret.get(0).getChildren());
-      return childPath;
-    } else {
-      filter.setIsSingle(false);
-      filter.setChildren(ret);
-      return null;
-    }
-  }
-
-  private boolean allIsBasic(List<QueryFilter> children) {
-    for (QueryFilter child : children) {
-      if (!(child instanceof BasicFunctionFilter)) {
-        return false;
-      }
-    }
-    return true;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/RemoveNotOptimizer.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/RemoveNotOptimizer.java
deleted file mode 100644
index daa274d135..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/rewriter/RemoveNotOptimizer.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.mpp.plan.rewriter;
-
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
-import org.apache.iotdb.db.mpp.common.filter.FunctionFilter;
-import org.apache.iotdb.db.mpp.common.filter.QueryFilter;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant;
-import org.apache.iotdb.db.mpp.plan.constant.FilterConstant.FilterType;
-
-import java.util.List;
-import java.util.Set;
-
-public class RemoveNotOptimizer implements IFilterOptimizer {
-
-  /**
-   * get DNF(disjunctive normal form) for this filter tree. Before getDNF, this op tree must be
-   * binary, in another word, each non-leaf node has exactly two children.
-   *
-   * @return optimized filter
-   * @throws StatementAnalyzeException exception in RemoveNot optimizing
-   */
-  @Override
-  public QueryFilter optimize(QueryFilter filter) throws StatementAnalyzeException {
-    Set<PartialPath> pathSet = filter.getPathSet();
-    QueryFilter optimizedFilter = removeNot(filter);
-    optimizedFilter.setPathSet(pathSet);
-    return optimizedFilter;
-  }
-
-  private QueryFilter removeNot(QueryFilter filter) throws StatementAnalyzeException {
-    if (filter.isLeaf()) {
-      return filter;
-    }
-    FilterType filterType = filter.getFilterType();
-    switch (filterType) {
-      case KW_AND:
-      case KW_OR:
-        // replace children in-place for efficiency
-        List<QueryFilter> children = filter.getChildren();
-        if (children.size() < 2) {
-          throw new StatementAnalyzeException(
-              "Filter has some time series don't correspond to any known time series");
-        }
-        children.set(0, removeNot(children.get(0)));
-        children.set(1, removeNot(children.get(1)));
-        return filter;
-      case KW_NOT:
-        if (filter.getChildren().size() < 1) {
-          throw new StatementAnalyzeException(
-              "Filter has some time series don't correspond to any known time series");
-        }
-        return reverseFilter(filter.getChildren().get(0));
-      default:
-        throw new StatementAnalyzeException("removeNot", filterType);
-    }
-  }
-
-  /**
-   * reverse given filter to reversed expression.
-   *
-   * @param filter BasicFunctionFilter
-   * @return QueryFilter reversed BasicFunctionFilter
-   * @throws StatementAnalyzeException exception in reverse filter
-   */
-  private QueryFilter reverseFilter(QueryFilter filter) throws StatementAnalyzeException {
-    FilterType filterType = filter.getFilterType();
-    if (filter.isLeaf()) {
-      ((FunctionFilter) filter).reverseFunc();
-      return filter;
-    }
-    switch (filterType) {
-      case KW_AND:
-      case KW_OR:
-        List<QueryFilter> children = filter.getChildren();
-        children.set(0, reverseFilter(children.get(0)));
-        children.set(1, reverseFilter(children.get(1)));
-        filter.setFilterType(FilterConstant.filterReverseWords.get(filterType));
-        return filter;
-      case KW_NOT:
-        return removeNot(filter.getChildren().get(0));
-      default:
-        throw new StatementAnalyzeException("reverseFilter", filterType);
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/Statement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/Statement.java
index 6d25e8012e..a3730c89a0 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/Statement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/Statement.java
@@ -20,7 +20,6 @@
 package org.apache.iotdb.db.mpp.plan.statement;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.parser.ASTVisitor;
 
 import java.util.List;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/constant/StatementType.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/StatementType.java
similarity index 98%
rename from server/src/main/java/org/apache/iotdb/db/mpp/plan/constant/StatementType.java
rename to server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/StatementType.java
index 7e88374da7..96eb0ee5f1 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/constant/StatementType.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/StatementType.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.iotdb.db.mpp.plan.constant;
+package org.apache.iotdb.db.mpp.plan.statement;
 
 /**
  * Type code of statement.
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/component/SelectComponent.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/component/SelectComponent.java
index 475b0a60a3..8961affe57 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/component/SelectComponent.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/component/SelectComponent.java
@@ -36,7 +36,7 @@ public class SelectComponent extends StatementNode {
 
   private boolean hasBuiltInAggregationFunction = false;
 
-  private List<ResultColumn> resultColumns = new ArrayList<>();
+  protected List<ResultColumn> resultColumns = new ArrayList<>();
 
   private Map<String, Expression> aliasToColumnMap;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/DeleteDataStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/DeleteDataStatement.java
index a7d7af40cd..9e7dfb4b66 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/DeleteDataStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/DeleteDataStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.crud;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.tsfile.read.common.TimeRange;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertMultiTabletsStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertMultiTabletsStatement.java
index 146d153330..46ced71fcc 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertMultiTabletsStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertMultiTabletsStatement.java
@@ -23,7 +23,7 @@ import org.apache.iotdb.common.rpc.thrift.TEndPoint;
 import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
 import org.apache.iotdb.commons.partition.DataPartition;
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.utils.TimePartitionUtils;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowStatement.java
index 2f3e20853e..660a5c7478 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowStatement.java
@@ -25,7 +25,7 @@ import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 import org.apache.iotdb.commons.partition.DataPartition;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.utils.TimePartitionUtils;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsOfOneDeviceStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsOfOneDeviceStatement.java
index 834717aaa7..d6d7d3f9ae 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsOfOneDeviceStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsOfOneDeviceStatement.java
@@ -23,7 +23,7 @@ import org.apache.iotdb.common.rpc.thrift.TEndPoint;
 import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 import org.apache.iotdb.commons.partition.DataPartition;
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.utils.TimePartitionUtils;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsStatement.java
index 2af88eb9ad..a93ed90a69 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsStatement.java
@@ -23,7 +23,7 @@ import org.apache.iotdb.common.rpc.thrift.TEndPoint;
 import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
 import org.apache.iotdb.commons.partition.DataPartition;
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.utils.TimePartitionUtils;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertStatement.java
index f8a11aa278..874c89867f 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertStatement.java
@@ -21,8 +21,8 @@ package org.apache.iotdb.db.mpp.plan.statement.crud;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.exception.sql.SemanticException;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.ArrayList;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertTabletStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertTabletStatement.java
index 314fdf2d61..986ecc5475 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertTabletStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertTabletStatement.java
@@ -23,7 +23,7 @@ import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
 import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 import org.apache.iotdb.commons.partition.DataPartition;
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.utils.TimePartitionUtils;
 import org.apache.iotdb.tsfile.utils.BitMap;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/LoadTsFileStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/LoadTsFileStatement.java
index c547de12de..9c4162195f 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/LoadTsFileStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/LoadTsFileStatement.java
@@ -22,8 +22,8 @@ package org.apache.iotdb.db.mpp.plan.statement.crud;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/QueryStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/QueryStatement.java
index a1e164c7d8..bc2c9006ae 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/QueryStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/QueryStatement.java
@@ -22,11 +22,11 @@ package org.apache.iotdb.db.mpp.plan.statement.crud;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.mpp.plan.analyze.ExpressionAnalyzer;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
 import org.apache.iotdb.db.mpp.plan.expression.leaf.TimeSeriesOperand;
 import org.apache.iotdb.db.mpp.plan.expression.multi.FunctionExpression;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.mpp.plan.statement.component.FillComponent;
 import org.apache.iotdb.db.mpp.plan.statement.component.FromComponent;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/internal/InternalCreateTimeSeriesStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/internal/InternalCreateTimeSeriesStatement.java
index 1db7154d76..5f7b07d067 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/internal/InternalCreateTimeSeriesStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/internal/InternalCreateTimeSeriesStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.internal;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/internal/SchemaFetchStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/internal/SchemaFetchStatement.java
index f988aa3d70..091e473e85 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/internal/SchemaFetchStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/internal/SchemaFetchStatement.java
@@ -22,8 +22,8 @@ package org.apache.iotdb.db.mpp.plan.statement.internal;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.path.PathPatternTree;
 import org.apache.iotdb.db.metadata.template.Template;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.List;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/AlterTimeSeriesStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/AlterTimeSeriesStatement.java
index d6f4198cba..8748771160 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/AlterTimeSeriesStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/AlterTimeSeriesStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CountStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CountStatement.java
index 7b8ea2f266..84982709c4 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CountStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CountStatement.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 
 import java.util.Collections;
 import java.util.List;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateAlignedTimeSeriesStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateAlignedTimeSeriesStatement.java
index a7b3495f64..b9d01f1a7b 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateAlignedTimeSeriesStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateAlignedTimeSeriesStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateContinuousQueryStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateContinuousQueryStatement.java
index 9aee94b8a3..97d40e9fd2 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateContinuousQueryStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateContinuousQueryStatement.java
@@ -25,9 +25,9 @@ import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.mpp.plan.analyze.ExpressionAnalyzer;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.mpp.plan.statement.component.GroupByTimeComponent;
 import org.apache.iotdb.db.mpp.plan.statement.crud.QueryStatement;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateFunctionStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateFunctionStatement.java
index bca6f22059..e08898fdbe 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateFunctionStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateFunctionStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateMultiTimeSeriesStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateMultiTimeSeriesStatement.java
index b0ad15c08f..3b344e7979 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateMultiTimeSeriesStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateMultiTimeSeriesStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateTimeSeriesStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateTimeSeriesStatement.java
index f10d7eddff..d074aa29ba 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateTimeSeriesStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateTimeSeriesStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateTriggerStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateTriggerStatement.java
index 200b547b1c..f2e05650b4 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateTriggerStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/CreateTriggerStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.trigger.api.enums.TriggerEvent;
 import org.apache.iotdb.trigger.api.enums.TriggerType;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DeleteStorageGroupStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DeleteStorageGroupStatement.java
index 25ec719ac7..6b779bacdc 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DeleteStorageGroupStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DeleteStorageGroupStatement.java
@@ -22,9 +22,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata;
 import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import org.slf4j.Logger;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DeleteTimeSeriesStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DeleteTimeSeriesStatement.java
index c21f590a24..5263a4300b 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DeleteTimeSeriesStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DeleteTimeSeriesStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.List;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropContinuousQueryStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropContinuousQueryStatement.java
index 85bc2382e6..a4fddad83c 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropContinuousQueryStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropContinuousQueryStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropFunctionStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropFunctionStatement.java
index e5850d4a81..03821ee925 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropFunctionStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropFunctionStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropTriggerStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropTriggerStatement.java
index 3927dfe7e6..c4f3665c1a 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropTriggerStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/DropTriggerStatement.java
@@ -22,9 +22,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.trigger.TriggerInformation;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.trigger.service.TriggerManagementService;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/SetStorageGroupStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/SetStorageGroupStatement.java
index 799dd03c3a..86092522b1 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/SetStorageGroupStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/SetStorageGroupStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/SetTTLStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/SetTTLStatement.java
index 549bc98e47..0c16f9a1e1 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/SetTTLStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/SetTTLStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowContinuousQueriesStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowContinuousQueriesStatement.java
index 413a4c88de..b86e38fa2a 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowContinuousQueriesStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowContinuousQueriesStatement.java
@@ -21,8 +21,8 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowStatement.java
index f67d9427e3..014f294555 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/ShowStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 
 import java.util.Collections;
 import java.util.List;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/UnSetTTLStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/UnSetTTLStatement.java
index 6fb80b918b..23a3fcca54 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/UnSetTTLStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/UnSetTTLStatement.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.db.mpp.plan.statement.metadata;
 
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 public class UnSetTTLStatement extends SetTTLStatement {
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ActivateTemplateStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ActivateTemplateStatement.java
index 5c424b5d13..eee2d71332 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ActivateTemplateStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ActivateTemplateStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata.template;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/CreateSchemaTemplateStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/CreateSchemaTemplateStatement.java
index 047c028d3c..f98d9b4983 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/CreateSchemaTemplateStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/CreateSchemaTemplateStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata.template;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/DeactivateTemplateStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/DeactivateTemplateStatement.java
index 8f54876f29..11b124b9df 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/DeactivateTemplateStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/DeactivateTemplateStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata.template;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.List;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/DropSchemaTemplateStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/DropSchemaTemplateStatement.java
index 51013c94d7..1bf587c1c6 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/DropSchemaTemplateStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/DropSchemaTemplateStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata.template;
 
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.ShowStatement;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/SetSchemaTemplateStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/SetSchemaTemplateStatement.java
index 0609d8349c..9224e96b7a 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/SetSchemaTemplateStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/SetSchemaTemplateStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata.template;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowNodesInSchemaTemplateStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowNodesInSchemaTemplateStatement.java
index dacfc93d8f..f9f5d408b1 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowNodesInSchemaTemplateStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowNodesInSchemaTemplateStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata.template;
 
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.ShowStatement;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowPathSetTemplateStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowPathSetTemplateStatement.java
index 18b751e067..b72de71ba8 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowPathSetTemplateStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowPathSetTemplateStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata.template;
 
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.ShowStatement;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowPathsUsingTemplateStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowPathsUsingTemplateStatement.java
index e3d95a646a..9538ec4160 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowPathsUsingTemplateStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowPathsUsingTemplateStatement.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata.template;
 
 import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.ShowStatement;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowSchemaTemplateStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowSchemaTemplateStatement.java
index e2744d8d1b..850ddd765d 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowSchemaTemplateStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/ShowSchemaTemplateStatement.java
@@ -20,8 +20,8 @@
 package org.apache.iotdb.db.mpp.plan.statement.metadata.template;
 
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.ShowStatement;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/UnsetSchemaTemplateStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/UnsetSchemaTemplateStatement.java
index de6ca98299..00762be267 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/UnsetSchemaTemplateStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/metadata/template/UnsetSchemaTemplateStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.metadata.template;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/AuthorStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/AuthorStatement.java
index 2e7a9c7312..05127a7c3b 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/AuthorStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/AuthorStatement.java
@@ -20,10 +20,10 @@ package org.apache.iotdb.db.mpp.plan.statement.sys;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.AuthorType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/ClearCacheStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/ClearCacheStatement.java
index 8d344050d5..ff3dfeda49 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/ClearCacheStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/ClearCacheStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/FlushStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/FlushStatement.java
index bc244c079e..5edd6c0ef9 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/FlushStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/FlushStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/LoadConfigurationStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/LoadConfigurationStatement.java
index d843c98190..b2189579b2 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/LoadConfigurationStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/LoadConfigurationStatement.java
@@ -20,9 +20,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/MergeStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/MergeStatement.java
index 9183b45341..31bf73c67f 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/MergeStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/MergeStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/SetSystemStatusStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/SetSystemStatusStatement.java
index 2a5082eca5..54b657d7d9 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/SetSystemStatusStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/SetSystemStatusStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys;
 import org.apache.iotdb.commons.cluster.NodeStatus;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/CreatePipeSinkStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/CreatePipeSinkStatement.java
index 2659505985..3e18b1092b 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/CreatePipeSinkStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/CreatePipeSinkStatement.java
@@ -22,9 +22,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys.sync;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.sync.utils.SyncConstant;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.io.IOException;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/CreatePipeStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/CreatePipeStatement.java
index 49f57eaf40..a20b45d471 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/CreatePipeStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/CreatePipeStatement.java
@@ -22,9 +22,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys.sync;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.sync.utils.SyncConstant;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.io.IOException;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/DropPipeSinkStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/DropPipeSinkStatement.java
index 9668297f91..6e929eb753 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/DropPipeSinkStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/DropPipeSinkStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys.sync;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/DropPipeStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/DropPipeStatement.java
index 5564ca6bf6..5c7fe0e5e2 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/DropPipeStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/DropPipeStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys.sync;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/StartPipeStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/StartPipeStatement.java
index a53a604a10..5bbf82b387 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/StartPipeStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/StartPipeStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys.sync;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/StopPipeStatement.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/StopPipeStatement.java
index 249a86a46c..cd5097d6f5 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/StopPipeStatement.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/sys/sync/StopPipeStatement.java
@@ -21,9 +21,9 @@ package org.apache.iotdb.db.mpp.plan.statement.sys.sync;
 
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.mpp.plan.analyze.QueryType;
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.IConfigStatement;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
 
 import java.util.Collections;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/transformation/dag/udf/UDTFContext.java b/server/src/main/java/org/apache/iotdb/db/mpp/transformation/dag/udf/UDTFContext.java
index e1ea0ced1f..be40778823 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/transformation/dag/udf/UDTFContext.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/transformation/dag/udf/UDTFContext.java
@@ -21,12 +21,10 @@ package org.apache.iotdb.db.mpp.transformation.dag.udf;
 
 import org.apache.iotdb.commons.udf.service.UDFClassLoaderManager;
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.mpp.plan.expression.ResultColumn;
 import org.apache.iotdb.db.mpp.plan.expression.multi.FunctionExpression;
 
 import java.time.ZoneId;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 public class UDTFContext {
@@ -39,12 +37,6 @@ public class UDTFContext {
     this.zoneId = zoneId;
   }
 
-  public void constructUdfExecutors(List<ResultColumn> resultColumns) {
-    for (ResultColumn resultColumn : resultColumns) {
-      resultColumn.getExpression().constructUdfExecutors(expressionName2Executor, zoneId);
-    }
-  }
-
   public void constructUdfExecutors(Expression[] outputExpressions) {
     for (Expression expression : outputExpressions) {
       expression.constructUdfExecutors(expressionName2Executor, zoneId);
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/constant/InfluxSQLConstant.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/constant/InfluxSqlConstant.java
similarity index 92%
rename from server/src/main/java/org/apache/iotdb/db/protocol/influxdb/constant/InfluxSQLConstant.java
rename to server/src/main/java/org/apache/iotdb/db/protocol/influxdb/constant/InfluxSqlConstant.java
index 3232778812..c7eaaa1a43 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/constant/InfluxSQLConstant.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/constant/InfluxSqlConstant.java
@@ -19,14 +19,20 @@
 
 package org.apache.iotdb.db.protocol.influxdb.constant;
 
-import org.apache.iotdb.db.qp.constant.SQLConstant;
+import org.apache.iotdb.db.constant.SqlConstant;
 
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
 /** this class contains several constants used in SQL. */
-public class InfluxSQLConstant extends SQLConstant {
+public class InfluxSqlConstant extends SqlConstant {
+
+  private InfluxSqlConstant() {
+    // forbidding instantiation
+    super();
+  }
+
   public static final String STAR = "*";
 
   public static final String MAX = "max";
@@ -45,11 +51,6 @@ public class InfluxSQLConstant extends SQLConstant {
   private static final Set<String> ONLY_TRAVERSE_FUNCTION_NAMES =
       new HashSet<>(Arrays.asList(MEDIAN, MODE, SPREAD, STDDEV));
 
-  public InfluxSQLConstant() throws InstantiationException {
-    // forbidding instantiation
-    super();
-  }
-
   public static Set<String> getNativeFunctionNames() {
     return NATIVE_FUNCTION_NAMES;
   }
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/InfluxFunctionFactory.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/InfluxFunctionFactory.java
index 9310990b46..8c2b1bf537 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/InfluxFunctionFactory.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/InfluxFunctionFactory.java
@@ -19,7 +19,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.aggregator.InfluxCountFunction;
 import org.apache.iotdb.db.protocol.influxdb.function.aggregator.InfluxMeanFunction;
 import org.apache.iotdb.db.protocol.influxdb.function.aggregator.InfluxMedianFunction;
@@ -39,27 +39,27 @@ public class InfluxFunctionFactory {
   public static InfluxFunction generateFunction(
       String functionName, List<Expression> expressionList) {
     switch (functionName) {
-      case InfluxSQLConstant.MAX:
+      case InfluxSqlConstant.MAX:
         return new InfluxMaxFunction(expressionList);
-      case InfluxSQLConstant.MIN:
+      case InfluxSqlConstant.MIN:
         return new InfluxMinFunction(expressionList);
-      case InfluxSQLConstant.LAST:
+      case InfluxSqlConstant.LAST:
         return new InfluxLastFunction(expressionList);
-      case InfluxSQLConstant.FIRST:
+      case InfluxSqlConstant.FIRST:
         return new InfluxFirstFunction(expressionList);
-      case InfluxSQLConstant.COUNT:
+      case InfluxSqlConstant.COUNT:
         return new InfluxCountFunction(expressionList);
-      case InfluxSQLConstant.MEAN:
+      case InfluxSqlConstant.MEAN:
         return new InfluxMeanFunction(expressionList);
-      case InfluxSQLConstant.MEDIAN:
+      case InfluxSqlConstant.MEDIAN:
         return new InfluxMedianFunction(expressionList);
-      case InfluxSQLConstant.MODE:
+      case InfluxSqlConstant.MODE:
         return new InfluxModeFunction(expressionList);
-      case InfluxSQLConstant.SPREAD:
+      case InfluxSqlConstant.SPREAD:
         return new InfluxSpreadFunction(expressionList);
-      case InfluxSQLConstant.STDDEV:
+      case InfluxSqlConstant.STDDEV:
         return new InfluxStddevFunction(expressionList);
-      case InfluxSQLConstant.SUM:
+      case InfluxSqlConstant.SUM:
         return new InfluxSumFunction(expressionList);
       default:
         throw new IllegalArgumentException("not support aggregation name:" + functionName);
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxCountFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxCountFunction.java
index 7cbc59971f..c7b066e1de 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxCountFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxCountFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.aggregator;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 
 import java.util.List;
@@ -44,7 +44,7 @@ public class InfluxCountFunction extends InfluxAggregator {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.COUNT;
+    return InfluxSqlConstant.COUNT;
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxMeanFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxMeanFunction.java
index 1337cc701b..78a84fa4b3 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxMeanFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxMeanFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.aggregator;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 import org.apache.iotdb.db.utils.MathUtils;
 
@@ -48,7 +48,7 @@ public class InfluxMeanFunction extends InfluxAggregator {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.MEAN;
+    return InfluxSqlConstant.MEAN;
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxMedianFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxMedianFunction.java
index eea844f9c0..c6c1a59224 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxMedianFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxMedianFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.aggregator;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 
 import java.util.ArrayList;
@@ -55,7 +55,7 @@ public class InfluxMedianFunction extends InfluxAggregator {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.MEDIAN;
+    return InfluxSqlConstant.MEDIAN;
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxModeFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxModeFunction.java
index ff1f63c8e2..b04a3ad9e7 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxModeFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxModeFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.aggregator;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 
 import java.util.HashMap;
@@ -49,7 +49,7 @@ public class InfluxModeFunction extends InfluxAggregator {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.MODE;
+    return InfluxSqlConstant.MODE;
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxSpreadFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxSpreadFunction.java
index 4da7fa3429..abf9598e9a 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxSpreadFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxSpreadFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.aggregator;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 
 import java.util.List;
@@ -52,7 +52,7 @@ public class InfluxSpreadFunction extends InfluxAggregator {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.SPREAD;
+    return InfluxSqlConstant.SPREAD;
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxStddevFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxStddevFunction.java
index 21790b6177..9f66da5190 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxStddevFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxStddevFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.aggregator;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 import org.apache.iotdb.db.utils.MathUtils;
 
@@ -47,7 +47,7 @@ public class InfluxStddevFunction extends InfluxAggregator {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.STDDEV;
+    return InfluxSqlConstant.STDDEV;
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxSumFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxSumFunction.java
index a0ed37920c..2e8a555fce 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxSumFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/aggregator/InfluxSumFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.aggregator;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 import org.apache.iotdb.db.utils.MathUtils;
 
@@ -47,7 +47,7 @@ public class InfluxSumFunction extends InfluxAggregator {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.SUM;
+    return InfluxSqlConstant.SUM;
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxFirstFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxFirstFunction.java
index 9ec5dbcdbb..8cca8ebc86 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxFirstFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxFirstFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.selector;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 
 import java.util.List;
@@ -65,6 +65,6 @@ public class InfluxFirstFunction extends InfluxSelector {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.FIRST;
+    return InfluxSqlConstant.FIRST;
   }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxLastFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxLastFunction.java
index 062f3f5df6..f7d5167988 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxLastFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxLastFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.selector;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 
 import java.util.List;
@@ -65,6 +65,6 @@ public class InfluxLastFunction extends InfluxSelector {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.LAST;
+    return InfluxSqlConstant.LAST;
   }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxMaxFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxMaxFunction.java
index c31f404b57..81cd62adb5 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxMaxFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxMaxFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.selector;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 
 import java.util.List;
@@ -67,7 +67,7 @@ public class InfluxMaxFunction extends InfluxSelector {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.MAX;
+    return InfluxSqlConstant.MAX;
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxMinFunction.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxMinFunction.java
index 52d6177c58..03d970e8b1 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxMinFunction.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/function/selector/InfluxMinFunction.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.protocol.influxdb.function.selector;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 
 import java.util.List;
@@ -67,7 +67,7 @@ public class InfluxMinFunction extends InfluxSelector {
 
   @Override
   public String getFunctionName() {
-    return InfluxSQLConstant.MIN;
+    return InfluxSqlConstant.MIN;
   }
 
   @Override
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/handler/AbstractQueryHandler.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/handler/AbstractQueryHandler.java
index 513c5d7b5f..b2f711b0ea 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/handler/AbstractQueryHandler.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/handler/AbstractQueryHandler.java
@@ -19,27 +19,29 @@
 package org.apache.iotdb.db.protocol.influxdb.handler;
 
 import org.apache.iotdb.commons.auth.AuthException;
+import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.mpp.plan.expression.ResultColumn;
+import org.apache.iotdb.db.mpp.plan.expression.binary.CompareBinaryExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.LogicAndExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.LogicBinaryExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.LogicOrExpression;
+import org.apache.iotdb.db.mpp.plan.expression.leaf.ConstantOperand;
 import org.apache.iotdb.db.mpp.plan.expression.leaf.TimeSeriesOperand;
 import org.apache.iotdb.db.mpp.plan.expression.multi.FunctionExpression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.mpp.plan.statement.component.ResultColumn;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunction;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionFactory;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 import org.apache.iotdb.db.protocol.influxdb.function.aggregator.InfluxAggregator;
 import org.apache.iotdb.db.protocol.influxdb.function.selector.InfluxSelector;
 import org.apache.iotdb.db.protocol.influxdb.meta.InfluxDBMetaManagerFactory;
-import org.apache.iotdb.db.protocol.influxdb.operator.InfluxQueryOperator;
-import org.apache.iotdb.db.protocol.influxdb.operator.InfluxSelectComponent;
+import org.apache.iotdb.db.protocol.influxdb.statement.InfluxQueryStatement;
+import org.apache.iotdb.db.protocol.influxdb.statement.InfluxSelectComponent;
 import org.apache.iotdb.db.protocol.influxdb.util.FilterUtils;
 import org.apache.iotdb.db.protocol.influxdb.util.JacksonUtils;
 import org.apache.iotdb.db.protocol.influxdb.util.QueryResultUtils;
 import org.apache.iotdb.db.protocol.influxdb.util.StringUtils;
-import org.apache.iotdb.db.qp.constant.FilterConstant;
-import org.apache.iotdb.db.qp.logical.Operator;
-import org.apache.iotdb.db.qp.logical.crud.BasicFunctionOperator;
-import org.apache.iotdb.db.qp.logical.crud.FilterOperator;
 import org.apache.iotdb.protocol.influxdb.rpc.thrift.InfluxQueryResultRsp;
 import org.apache.iotdb.rpc.RpcUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
@@ -50,6 +52,7 @@ import org.influxdb.dto.QueryResult;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -93,8 +96,8 @@ public abstract class AbstractQueryHandler {
       throws AuthException;
 
   public final InfluxQueryResultRsp queryInfluxDB(
-      String database, InfluxQueryOperator queryOperator, long sessionId) {
-    String measurement = queryOperator.getFromComponent().getPrefixPaths().get(0).getFullPath();
+      String database, InfluxQueryStatement queryStatement, long sessionId) {
+    String measurement = queryStatement.getFromComponent().getPrefixPaths().get(0).getFullPath();
     // The list of fields under the current measurement and the order of the specified rules
     Map<String, Integer> fieldOrders =
         InfluxDBMetaManagerFactory.getInstance().getFieldOrders(database, measurement, sessionId);
@@ -102,27 +105,27 @@ public abstract class AbstractQueryHandler {
     InfluxQueryResultRsp tsQueryResultRsp = new InfluxQueryResultRsp();
     try {
       // contain filter condition or have common query the result of by traversal.
-      if (queryOperator.getWhereComponent() != null
-          || queryOperator.getSelectComponent().isHasCommonQuery()
-          || queryOperator.getSelectComponent().isHasOnlyTraverseFunction()) {
+      if (queryStatement.hasWhere()
+          || queryStatement.getSelectComponent().isHasCommonQuery()
+          || queryStatement.getSelectComponent().isHasOnlyTraverseFunction()) {
         // step1 : generate query results
         queryResult =
             queryExpr(
-                queryOperator.getWhereComponent() != null
-                    ? queryOperator.getWhereComponent().getFilterOperator()
+                queryStatement.hasWhere()
+                    ? queryStatement.getWhereCondition().getPredicate()
                     : null,
                 database,
                 measurement,
                 fieldOrders,
                 sessionId);
         // step2 : select filter
-        ProcessSelectComponent(queryResult, queryOperator.getSelectComponent());
+        ProcessSelectComponent(queryResult, queryStatement.getSelectComponent());
       }
       // don't contain filter condition and only have function use iotdb function.
       else {
         queryResult =
             queryFuncWithoutFilter(
-                queryOperator.getSelectComponent(), database, measurement, sessionId);
+                queryStatement.getSelectComponent(), database, measurement, sessionId);
       }
       return tsQueryResultRsp
           .setResultJsonString(JacksonUtils.bean2Json(queryResult))
@@ -133,20 +136,6 @@ public abstract class AbstractQueryHandler {
     }
   }
 
-  /**
-   * conditions are generated from subtrees of unique conditions
-   *
-   * @param basicFunctionOperator subtree to generate condition
-   * @return corresponding conditions
-   */
-  public IExpression getIExpressionForBasicFunctionOperator(
-      BasicFunctionOperator basicFunctionOperator) {
-    return new SingleSeriesExpression(
-        basicFunctionOperator.getSinglePath(),
-        FilterUtils.filterTypeToFilter(
-            basicFunctionOperator.getFilterType(), basicFunctionOperator.getValue()));
-  }
-
   /**
    * further process the obtained query result through the query criteria of select
    *
@@ -166,7 +155,7 @@ public abstract class AbstractQueryHandler {
     List<List<Object>> values = queryResult.getResults().get(0).getSeries().get(0).getValues();
     // new columns
     List<String> newColumns = new ArrayList<>();
-    newColumns.add(InfluxSQLConstant.RESERVED_TIME);
+    newColumns.add(InfluxSqlConstant.RESERVED_TIME);
 
     // when have function
     if (selectComponent.isHasFunction()) {
@@ -180,7 +169,7 @@ public abstract class AbstractQueryHandler {
           newColumns.add(functionName);
         } else if (expression instanceof TimeSeriesOperand) {
           String columnName = ((TimeSeriesOperand) expression).getPath().getFullPath();
-          if (!columnName.equals(InfluxSQLConstant.STAR)) {
+          if (!columnName.equals(InfluxSqlConstant.STAR)) {
             newColumns.add(columnName);
           } else {
             newColumns.addAll(columns.subList(1, columns.size()));
@@ -223,7 +212,7 @@ public abstract class AbstractQueryHandler {
         InfluxSelector selector = (InfluxSelector) functions.get(0);
         List<Object> relatedValue = selector.getRelatedValues();
         for (String column : newColumns) {
-          if (InfluxSQLConstant.getNativeSelectorFunctionNames().contains(column)) {
+          if (InfluxSqlConstant.getNativeSelectorFunctionNames().contains(column)) {
             value.add(selector.calculateBruteForce().getValue());
           } else {
             if (relatedValue != null) {
@@ -257,7 +246,7 @@ public abstract class AbstractQueryHandler {
           if (!((TimeSeriesOperand) expression)
               .getPath()
               .getFullPath()
-              .equals(InfluxSQLConstant.STAR)) {
+              .equals(InfluxSqlConstant.STAR)) {
             newColumns.add(((TimeSeriesOperand) expression).getPath().getFullPath());
           } else {
             newColumns.addAll(columns.subList(1, columns.size()));
@@ -289,7 +278,7 @@ public abstract class AbstractQueryHandler {
       InfluxSelectComponent selectComponent, String database, String measurement, long sessionid) {
     // columns
     List<String> columns = new ArrayList<>();
-    columns.add(InfluxSQLConstant.RESERVED_TIME);
+    columns.add(InfluxSqlConstant.RESERVED_TIME);
 
     List<InfluxFunction> functions = new ArrayList<>();
 
@@ -334,40 +323,55 @@ public abstract class AbstractQueryHandler {
   }
 
   public QueryResult queryExpr(
-      FilterOperator operator,
+      Expression predicate,
       String database,
       String measurement,
       Map<String, Integer> fieldOrders,
       Long sessionId)
       throws AuthException {
-    if (operator == null) {
-      List<IExpression> expressions = new ArrayList<>();
-      return queryByConditions(expressions, database, measurement, fieldOrders, sessionId);
-    } else if (operator instanceof BasicFunctionOperator) {
-      List<IExpression> iExpressions = new ArrayList<>();
-      iExpressions.add(getIExpressionForBasicFunctionOperator((BasicFunctionOperator) operator));
-      return queryByConditions(iExpressions, database, measurement, fieldOrders, sessionId);
-    } else {
-      FilterOperator leftOperator = operator.getChildren().get(0);
-      FilterOperator rightOperator = operator.getChildren().get(1);
-      if (operator.getFilterType() == FilterConstant.FilterType.KW_OR) {
-        return QueryResultUtils.orQueryResultProcess(
-            queryExpr(leftOperator, database, measurement, fieldOrders, sessionId),
-            queryExpr(rightOperator, database, measurement, fieldOrders, sessionId));
-      } else if (operator.getFilterType() == FilterConstant.FilterType.KW_AND) {
-        if (canMergeOperator(leftOperator) && canMergeOperator(rightOperator)) {
-          List<IExpression> iExpressions1 = getIExpressionByFilterOperatorOperator(leftOperator);
-          List<IExpression> iExpressions2 = getIExpressionByFilterOperatorOperator(rightOperator);
-          iExpressions1.addAll(iExpressions2);
-          return queryByConditions(iExpressions1, database, measurement, fieldOrders, sessionId);
-        } else {
-          return QueryResultUtils.andQueryResultProcess(
-              queryExpr(leftOperator, database, measurement, fieldOrders, sessionId),
-              queryExpr(rightOperator, database, measurement, fieldOrders, sessionId));
-        }
+    if (predicate == null) {
+      return queryByConditions(
+          Collections.emptyList(), database, measurement, fieldOrders, sessionId);
+    } else if (predicate instanceof CompareBinaryExpression) {
+      return queryByConditions(
+          convertToIExpressions(predicate), database, measurement, fieldOrders, sessionId);
+    } else if (predicate instanceof LogicOrExpression) {
+      return QueryResultUtils.orQueryResultProcess(
+          queryExpr(
+              ((LogicOrExpression) predicate).getLeftExpression(),
+              database,
+              measurement,
+              fieldOrders,
+              sessionId),
+          queryExpr(
+              ((LogicOrExpression) predicate).getRightExpression(),
+              database,
+              measurement,
+              fieldOrders,
+              sessionId));
+    } else if (predicate instanceof LogicAndExpression) {
+      if (canMergePredicate(predicate)) {
+        return queryByConditions(
+            convertToIExpressions(predicate), database, measurement, fieldOrders, sessionId);
+      } else {
+        return QueryResultUtils.andQueryResultProcess(
+            queryExpr(
+                ((LogicAndExpression) predicate).getLeftExpression(),
+                database,
+                measurement,
+                fieldOrders,
+                sessionId),
+            queryExpr(
+                ((LogicAndExpression) predicate).getRightExpression(),
+                database,
+                measurement,
+                fieldOrders,
+                sessionId));
       }
+    } else {
+      throw new IllegalArgumentException(
+          "unsupported expression type: " + predicate.getExpressionType());
     }
-    throw new IllegalArgumentException("unknown operator " + operator);
   }
 
   /**
@@ -452,23 +456,34 @@ public abstract class AbstractQueryHandler {
    * generate query conditions through the syntax tree (if you enter this function, it means that it
    * must be a syntax tree that can be merged, and there is no or)
    *
-   * @param filterOperator the syntax tree of query criteria needs to be generated
+   * @param predicate the syntax tree of query criteria needs to be generated
    * @return condition list
    */
-  public List<IExpression> getIExpressionByFilterOperatorOperator(FilterOperator filterOperator) {
-    if (filterOperator instanceof BasicFunctionOperator) {
-      // It must be a non-or situation
-      List<IExpression> expressions = new ArrayList<>();
-      expressions.add(
-          getIExpressionForBasicFunctionOperator((BasicFunctionOperator) filterOperator));
-      return expressions;
+  public List<IExpression> convertToIExpressions(Expression predicate) {
+    if (predicate instanceof CompareBinaryExpression) {
+      Expression leftExpression = ((CompareBinaryExpression) predicate).getLeftExpression();
+      Expression rightExpression = ((CompareBinaryExpression) predicate).getRightExpression();
+      if (!(leftExpression instanceof TimeSeriesOperand
+          && rightExpression instanceof ConstantOperand)) {
+        throw new SemanticException("Unsupported predicate: " + predicate);
+      }
+      SingleSeriesExpression singleSeriesExpression =
+          new SingleSeriesExpression(
+              ((TimeSeriesOperand) leftExpression).getPath(),
+              FilterUtils.expressionTypeToFilter(
+                  predicate.getExpressionType(),
+                  ((ConstantOperand) rightExpression).getValueString()));
+      return Collections.singletonList(singleSeriesExpression);
+    } else if (predicate instanceof LogicBinaryExpression) {
+      List<IExpression> iExpressions = new ArrayList<>();
+      iExpressions.addAll(
+          convertToIExpressions(((LogicBinaryExpression) predicate).getLeftExpression()));
+      iExpressions.addAll(
+          convertToIExpressions(((LogicBinaryExpression) predicate).getRightExpression()));
+      return iExpressions;
     } else {
-      FilterOperator leftOperator = filterOperator.getChildren().get(0);
-      FilterOperator rightOperator = filterOperator.getChildren().get(1);
-      List<IExpression> expressions1 = getIExpressionByFilterOperatorOperator(leftOperator);
-      List<IExpression> expressions2 = getIExpressionByFilterOperatorOperator(rightOperator);
-      expressions1.addAll(expressions2);
-      return expressions1;
+      throw new IllegalArgumentException(
+          "unsupported expression type: " + predicate.getExpressionType());
     }
   }
 
@@ -476,35 +491,20 @@ public abstract class AbstractQueryHandler {
    * judge whether the subtrees of the syntax tree have or operations. If not, the query can be
    * merged
    *
-   * @param operator subtree to judge
+   * @param predicate subtree to judge
    * @return can merge queries
    */
-  public boolean canMergeOperator(FilterOperator operator) {
-    if (operator instanceof BasicFunctionOperator) {
+  public boolean canMergePredicate(Expression predicate) {
+    if (predicate instanceof CompareBinaryExpression) {
       return true;
+    } else if (predicate instanceof LogicOrExpression) {
+      return false;
+    } else if (predicate instanceof LogicAndExpression) {
+      return canMergePredicate(((LogicAndExpression) predicate).getLeftExpression())
+          && canMergePredicate(((LogicAndExpression) predicate).getRightExpression());
     } else {
-      if (operator.getFilterType() == FilterConstant.FilterType.KW_OR) {
-        return false;
-      } else {
-        FilterOperator leftOperator = operator.getChildren().get(0);
-        FilterOperator rightOperator = operator.getChildren().get(1);
-        return canMergeOperator(leftOperator) && canMergeOperator(rightOperator);
-      }
-    }
-  }
-
-  public void checkInfluxDBQueryOperator(Operator operator) {
-    if (!(operator instanceof InfluxQueryOperator)) {
-      throw new IllegalArgumentException("not query sql");
-    }
-    InfluxSelectComponent selectComponent = ((InfluxQueryOperator) operator).getSelectComponent();
-    if (selectComponent.isHasMoreSelectorFunction() && selectComponent.isHasCommonQuery()) {
-      throw new IllegalArgumentException(
-          "ERR: mixing multiple selector functions with tags or fields is not supported");
-    }
-    if (selectComponent.isHasAggregationFunction() && selectComponent.isHasCommonQuery()) {
       throw new IllegalArgumentException(
-          "ERR: mixing aggregate and non-aggregate queries is not supported");
+          "unsupported expression type: " + predicate.getExpressionType());
     }
   }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/handler/NewQueryHandler.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/handler/NewQueryHandler.java
index 063d907f2a..c42bf95b20 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/handler/NewQueryHandler.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/handler/NewQueryHandler.java
@@ -18,7 +18,7 @@
  */
 package org.apache.iotdb.db.protocol.influxdb.handler;
 
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunction;
 import org.apache.iotdb.db.protocol.influxdb.function.InfluxFunctionValue;
 import org.apache.iotdb.db.protocol.influxdb.util.QueryResultUtils;
@@ -46,7 +46,7 @@ public class NewQueryHandler extends AbstractQueryHandler {
   public final InfluxFunctionValue updateByIoTDBFunc(
       String path, InfluxFunction function, long sessionid) {
     switch (function.getFunctionName()) {
-      case InfluxSQLConstant.COUNT:
+      case InfluxSqlConstant.COUNT:
         {
           String functionSql =
               StringUtils.generateFunctionSql(
@@ -60,7 +60,7 @@ public class NewQueryHandler extends AbstractQueryHandler {
           }
           break;
         }
-      case InfluxSQLConstant.MEAN:
+      case InfluxSqlConstant.MEAN:
         {
           String functionSqlCount =
               StringUtils.generateFunctionSql("count", function.getParmaName(), path);
@@ -81,7 +81,7 @@ public class NewQueryHandler extends AbstractQueryHandler {
           }
           break;
         }
-      case InfluxSQLConstant.SUM:
+      case InfluxSqlConstant.SUM:
         {
           String functionSql =
               StringUtils.generateFunctionSql("sum", function.getParmaName(), path);
@@ -94,12 +94,12 @@ public class NewQueryHandler extends AbstractQueryHandler {
           }
           break;
         }
-      case InfluxSQLConstant.FIRST:
-      case InfluxSQLConstant.LAST:
+      case InfluxSqlConstant.FIRST:
+      case InfluxSqlConstant.LAST:
         {
           String functionSql;
           String functionName;
-          if (function.getFunctionName().equals(InfluxSQLConstant.FIRST)) {
+          if (function.getFunctionName().equals(InfluxSqlConstant.FIRST)) {
             functionSql =
                 StringUtils.generateFunctionSql("first_value", function.getParmaName(), path);
             functionName = "first_value";
@@ -128,11 +128,11 @@ public class NewQueryHandler extends AbstractQueryHandler {
           }
           break;
         }
-      case InfluxSQLConstant.MAX:
-      case InfluxSQLConstant.MIN:
+      case InfluxSqlConstant.MAX:
+      case InfluxSqlConstant.MIN:
         {
           String functionSql;
-          if (function.getFunctionName().equals(InfluxSQLConstant.MAX)) {
+          if (function.getFunctionName().equals(InfluxSqlConstant.MAX)) {
             functionSql =
                 StringUtils.generateFunctionSql("max_value", function.getParmaName(), path);
           } else {
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/input/InfluxLineParser.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/input/InfluxLineParser.java
index e943c0e0dc..c24497474c 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/input/InfluxLineParser.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/input/InfluxLineParser.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.db.protocol.influxdb.input;
 
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 
 import org.antlr.v4.runtime.ANTLRInputStream;
 import org.antlr.v4.runtime.CharStream;
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/operator/InfluxQueryOperator.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/operator/InfluxQueryOperator.java
deleted file mode 100644
index bdc15eb33e..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/operator/InfluxQueryOperator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.protocol.influxdb.operator;
-
-import org.apache.iotdb.db.qp.logical.crud.QueryOperator;
-
-public class InfluxQueryOperator extends QueryOperator {
-
-  protected InfluxSelectComponent influxSelectComponent;
-
-  public InfluxQueryOperator() {
-    super();
-  }
-
-  public InfluxSelectComponent getSelectComponent() {
-    return influxSelectComponent;
-  }
-
-  public void setSelectComponent(InfluxSelectComponent influxSelectComponent) {
-    this.influxSelectComponent = influxSelectComponent;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/parser/InfluxDBAstVisitor.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/parser/InfluxDBAstVisitor.java
new file mode 100644
index 0000000000..d7013ab8a4
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/parser/InfluxDBAstVisitor.java
@@ -0,0 +1,321 @@
+/*
+ * 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.protocol.influxdb.parser;
+
+import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.constant.SqlConstant;
+import org.apache.iotdb.db.exception.sql.SemanticException;
+import org.apache.iotdb.db.mpp.plan.analyze.ExpressionAnalyzer;
+import org.apache.iotdb.db.mpp.plan.expression.Expression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.AdditionExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.DivisionExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.EqualToExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.GreaterEqualExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.GreaterThanExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.LessEqualExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.LessThanExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.LogicAndExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.LogicOrExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.ModuloExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.MultiplicationExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.NonEqualExpression;
+import org.apache.iotdb.db.mpp.plan.expression.binary.SubtractionExpression;
+import org.apache.iotdb.db.mpp.plan.expression.leaf.ConstantOperand;
+import org.apache.iotdb.db.mpp.plan.expression.leaf.TimeSeriesOperand;
+import org.apache.iotdb.db.mpp.plan.expression.multi.FunctionExpression;
+import org.apache.iotdb.db.mpp.plan.expression.unary.LogicNotExpression;
+import org.apache.iotdb.db.mpp.plan.expression.unary.NegationExpression;
+import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.component.FromComponent;
+import org.apache.iotdb.db.mpp.plan.statement.component.ResultColumn;
+import org.apache.iotdb.db.mpp.plan.statement.component.WhereCondition;
+import org.apache.iotdb.db.protocol.influxdb.statement.InfluxQueryStatement;
+import org.apache.iotdb.db.protocol.influxdb.statement.InfluxSelectComponent;
+import org.apache.iotdb.db.qp.sql.InfluxDBSqlParser;
+import org.apache.iotdb.db.qp.sql.InfluxDBSqlParserBaseVisitor;
+import org.apache.iotdb.db.utils.DateTimeUtils;
+import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
+
+public class InfluxDBAstVisitor extends InfluxDBSqlParserBaseVisitor<Statement> {
+
+  private static final IoTDBConfig CONFIG = IoTDBDescriptor.getInstance().getConfig();
+
+  @Override
+  public Statement visitSingleStatement(InfluxDBSqlParser.SingleStatementContext ctx) {
+    return visit(ctx.statement());
+  }
+
+  @Override
+  public Statement visitSelectStatement(InfluxDBSqlParser.SelectStatementContext ctx) {
+    InfluxQueryStatement queryStatement = new InfluxQueryStatement();
+    queryStatement.setSelectComponent(parseSelectClause(ctx.selectClause()));
+    queryStatement.setFromComponent(parseFromClause(ctx.fromClause()));
+    if (ctx.whereClause() != null) {
+      queryStatement.setWhereCondition(parseWhereClause(ctx.whereClause()));
+    }
+    return queryStatement;
+  }
+
+  public InfluxSelectComponent parseSelectClause(InfluxDBSqlParser.SelectClauseContext ctx) {
+    InfluxSelectComponent influxSelectComponent = new InfluxSelectComponent();
+    for (InfluxDBSqlParser.ResultColumnContext resultColumnContext : ctx.resultColumn()) {
+      influxSelectComponent.addResultColumn(parseResultColumn(resultColumnContext));
+    }
+    return influxSelectComponent;
+  }
+
+  private FromComponent parseFromClause(InfluxDBSqlParser.FromClauseContext fromClause) {
+    FromComponent fromComponent = new FromComponent();
+    for (InfluxDBSqlParser.NodeNameContext nodeName : fromClause.nodeName()) {
+      fromComponent.addPrefixPath(new PartialPath(nodeName.getText(), false));
+    }
+    return fromComponent;
+  }
+
+  private WhereCondition parseWhereClause(InfluxDBSqlParser.WhereClauseContext ctx) {
+    return new WhereCondition(parsePredicate(ctx.predicate()));
+  }
+
+  private ResultColumn parseResultColumn(InfluxDBSqlParser.ResultColumnContext ctx) {
+    Expression selectExpression = parseExpression(ctx.expression());
+    ResultColumn.ColumnType columnType =
+        ExpressionAnalyzer.identifyOutputColumnType(selectExpression, true);
+    if (ctx.AS() != null) {
+      return new ResultColumn(selectExpression, ctx.identifier().getText(), columnType);
+    } else {
+      return new ResultColumn(selectExpression, columnType);
+    }
+  }
+
+  private Expression parseExpression(InfluxDBSqlParser.ExpressionContext context) {
+    // LR_BRACKET unaryInBracket=expression RR_BRACKET
+    if (context.unaryInBracket != null) {
+      return parseExpression(context.unaryInBracket);
+    }
+
+    // (PLUS | MINUS) unaryAfterSign=expression
+    if (context.unaryAfterSign != null) {
+      return context.MINUS() != null
+          ? new NegationExpression(parseExpression(context.expression(0)))
+          : parseExpression(context.expression(0));
+    }
+
+    // leftExpression=expression (STAR | DIV | MOD) rightExpression=expression
+    // leftExpression=expression (PLUS | MINUS) rightExpression=expression
+    if (context.leftExpression != null && context.rightExpression != null) {
+      Expression leftExpression = parseExpression(context.leftExpression);
+      Expression rightExpression = parseExpression(context.rightExpression);
+      if (context.STAR() != null) {
+        return new MultiplicationExpression(leftExpression, rightExpression);
+      }
+      if (context.DIV() != null) {
+        return new DivisionExpression(leftExpression, rightExpression);
+      }
+      if (context.MOD() != null) {
+        return new ModuloExpression(leftExpression, rightExpression);
+      }
+      if (context.PLUS() != null) {
+        return new AdditionExpression(leftExpression, rightExpression);
+      }
+      if (context.MINUS() != null) {
+        return new SubtractionExpression(leftExpression, rightExpression);
+      }
+    }
+
+    // functionName=nodeName LR_BRACKET expression (COMMA expression)* functionAttribute* RR_BRACKET
+    if (context.functionName != null) {
+      return parseFunctionExpression(context);
+    }
+
+    // nodeName || constant
+    if (context.nodeName() != null || context.constant() != null) {
+      return new TimeSeriesOperand(new PartialPath(context.nodeName().getText(), false));
+    }
+
+    throw new UnsupportedOperationException();
+  }
+
+  private Expression parseFunctionExpression(InfluxDBSqlParser.ExpressionContext functionClause) {
+
+    FunctionExpression functionExpression =
+        new FunctionExpression(functionClause.functionName.getText());
+
+    // expressions
+    for (InfluxDBSqlParser.ExpressionContext expression : functionClause.expression()) {
+      functionExpression.addExpression(parseExpression(expression));
+    }
+
+    // attributes
+    for (InfluxDBSqlParser.FunctionAttributeContext functionAttribute :
+        functionClause.functionAttribute()) {
+      functionExpression.addAttribute(
+          removeStringQuote(functionAttribute.functionAttributeKey.getText()),
+          removeStringQuote(functionAttribute.functionAttributeValue.getText()));
+    }
+
+    return functionExpression;
+  }
+
+  private Expression parsePredicate(InfluxDBSqlParser.PredicateContext context) {
+    if (context.predicateInBracket != null) {
+      return parsePredicate(context.predicateInBracket);
+    }
+
+    if (context.OPERATOR_NOT() != null) {
+      return new LogicNotExpression(parsePredicate(context.predicateAfterUnaryOperator));
+    }
+
+    if (context.leftPredicate != null && context.rightPredicate != null) {
+      Expression leftExpression = parsePredicate(context.leftPredicate);
+      Expression rightExpression = parsePredicate(context.rightPredicate);
+
+      if (context.OPERATOR_GT() != null) {
+        return new GreaterThanExpression(leftExpression, rightExpression);
+      }
+      if (context.OPERATOR_GTE() != null) {
+        return new GreaterEqualExpression(leftExpression, rightExpression);
+      }
+      if (context.OPERATOR_LT() != null) {
+        return new LessThanExpression(leftExpression, rightExpression);
+      }
+      if (context.OPERATOR_LTE() != null) {
+        return new LessEqualExpression(leftExpression, rightExpression);
+      }
+      if (context.OPERATOR_SEQ() != null) {
+        return new EqualToExpression(leftExpression, rightExpression);
+      }
+      if (context.OPERATOR_NEQ() != null) {
+        return new NonEqualExpression(leftExpression, rightExpression);
+      }
+      if (context.OPERATOR_AND() != null) {
+        return new LogicAndExpression(leftExpression, rightExpression);
+      }
+      if (context.OPERATOR_OR() != null) {
+        return new LogicOrExpression(leftExpression, rightExpression);
+      }
+      throw new UnsupportedOperationException();
+    }
+
+    if (context.nodeName() != null) {
+      return new TimeSeriesOperand(new PartialPath(context.nodeName().getText(), false));
+    }
+
+    if (context.time != null) {
+      return new TimeSeriesOperand(SqlConstant.TIME_PATH);
+    }
+
+    if (context.constant() != null) {
+      return parseConstantOperand(context.constant());
+    }
+
+    throw new UnsupportedOperationException();
+  }
+
+  private Expression parseConstantOperand(InfluxDBSqlParser.ConstantContext constantContext) {
+    String text = constantContext.getText();
+    if (constantContext.BOOLEAN_LITERAL() != null) {
+      return new ConstantOperand(TSDataType.BOOLEAN, text);
+    } else if (constantContext.STRING_LITERAL() != null) {
+      return new ConstantOperand(TSDataType.TEXT, parseStringLiteral(text));
+    } else if (constantContext.INTEGER_LITERAL() != null) {
+      return new ConstantOperand(TSDataType.INT64, text);
+    } else if (constantContext.realLiteral() != null) {
+      return parseRealLiteral(text);
+    } else if (constantContext.dateExpression() != null) {
+      return new ConstantOperand(
+          TSDataType.INT64, String.valueOf(parseDateExpression(constantContext.dateExpression())));
+    } else {
+      throw new SemanticException("Unsupported constant operand: " + text);
+    }
+  }
+
+  private String parseStringLiteral(String src) {
+    if (2 <= src.length()) {
+      // do not unescape string
+      String unWrappedString = src.substring(1, src.length() - 1);
+      if (src.charAt(0) == '\"' && src.charAt(src.length() - 1) == '\"') {
+        // replace "" with "
+        String replaced = unWrappedString.replace("\"\"", "\"");
+        return replaced.length() == 0 ? "" : replaced;
+      }
+      if ((src.charAt(0) == '\'' && src.charAt(src.length() - 1) == '\'')) {
+        // replace '' with '
+        String replaced = unWrappedString.replace("''", "'");
+        return replaced.length() == 0 ? "" : replaced;
+      }
+    }
+    return src;
+  }
+
+  private Expression parseRealLiteral(String value) {
+    // 3.33 is float by default
+    return new ConstantOperand(
+        CONFIG.getFloatingStringInferType().equals(TSDataType.DOUBLE)
+            ? TSDataType.DOUBLE
+            : TSDataType.FLOAT,
+        value);
+  }
+
+  private static String removeStringQuote(String src) {
+    if (src.charAt(0) == '\'' && src.charAt(src.length() - 1) == '\'') {
+      return src.substring(1, src.length() - 1);
+    } else if (src.charAt(0) == '\"' && src.charAt(src.length() - 1) == '\"') {
+      return src.substring(1, src.length() - 1);
+    } else {
+      throw new IllegalArgumentException("error format for string with quote:" + src);
+    }
+  }
+
+  /**
+   * parse time expression, which is addition and subtraction expression of duration time, now() or
+   * DataTimeFormat time.
+   *
+   * <p>eg. now() + 1d - 2h
+   */
+  private static Long parseDateExpression(InfluxDBSqlParser.DateExpressionContext ctx) {
+    long time;
+    time = parseTimeFormat(ctx.getChild(0).getText());
+    for (int i = 1; i < ctx.getChildCount(); i = i + 2) {
+      if (ctx.getChild(i).getText().equals("+")) {
+        time += DateTimeUtils.convertDurationStrToLong(time, ctx.getChild(i + 1).getText());
+      } else {
+        time -= DateTimeUtils.convertDurationStrToLong(time, ctx.getChild(i + 1).getText());
+      }
+    }
+    return time;
+  }
+
+  /** function for parsing time format. */
+  public static long parseTimeFormat(String timestampStr) {
+    if (timestampStr == null || timestampStr.trim().equals("")) {
+      throw new IllegalArgumentException("input timestamp cannot be empty");
+    }
+    if (timestampStr.equalsIgnoreCase(SqlConstant.NOW_FUNC)) {
+      return DateTimeUtils.currentTime();
+    }
+    throw new IllegalArgumentException(
+        String.format(
+            "Input time format %s error. "
+                + "Input like yyyy-MM-dd HH:mm:ss, yyyy-MM-ddTHH:mm:ss or "
+                + "refer to user document for more info.",
+            timestampStr));
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/sql/InfluxDBLogicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/parser/InfluxDBStatementGenerator.java
similarity index 76%
rename from server/src/main/java/org/apache/iotdb/db/protocol/influxdb/sql/InfluxDBLogicalGenerator.java
rename to server/src/main/java/org/apache/iotdb/db/protocol/influxdb/parser/InfluxDBStatementGenerator.java
index 361d105e4e..ec88d8bfe1 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/sql/InfluxDBLogicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/parser/InfluxDBStatementGenerator.java
@@ -16,12 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.iotdb.db.protocol.influxdb.sql;
 
-import org.apache.iotdb.db.qp.logical.Operator;
+package org.apache.iotdb.db.protocol.influxdb.parser;
+
+import org.apache.iotdb.db.mpp.plan.parser.SqlParseError;
+import org.apache.iotdb.db.mpp.plan.statement.Statement;
 import org.apache.iotdb.db.qp.sql.InfluxDBSqlParser;
 import org.apache.iotdb.db.qp.sql.SqlLexer;
-import org.apache.iotdb.db.qp.strategy.SQLParseError;
 
 import org.antlr.v4.runtime.CharStream;
 import org.antlr.v4.runtime.CharStreams;
@@ -30,21 +31,21 @@ import org.antlr.v4.runtime.atn.PredictionMode;
 import org.antlr.v4.runtime.misc.ParseCancellationException;
 import org.antlr.v4.runtime.tree.ParseTree;
 
-public class InfluxDBLogicalGenerator {
+public class InfluxDBStatementGenerator {
 
-  private InfluxDBLogicalGenerator() {}
+  private InfluxDBStatementGenerator() {}
 
-  public static Operator generate(String sql) throws ParseCancellationException {
-    InfluxDBSqlVisitor influxDBSqlVisitor = new InfluxDBSqlVisitor();
+  public static Statement generate(String sql) throws ParseCancellationException {
+    InfluxDBAstVisitor influxDBAstVisitor = new InfluxDBAstVisitor();
     CharStream charStream1 = CharStreams.fromString(sql);
     SqlLexer lexer1 = new SqlLexer(charStream1);
     lexer1.removeErrorListeners();
-    lexer1.addErrorListener(SQLParseError.INSTANCE);
+    lexer1.addErrorListener(SqlParseError.INSTANCE);
     CommonTokenStream tokens1 = new CommonTokenStream(lexer1);
     InfluxDBSqlParser parser1 = new InfluxDBSqlParser(tokens1);
     parser1.getInterpreter().setPredictionMode(PredictionMode.SLL);
     parser1.removeErrorListeners();
-    parser1.addErrorListener(SQLParseError.INSTANCE);
+    parser1.addErrorListener(SqlParseError.INSTANCE);
     ParseTree tree;
     try {
       tree = parser1.singleStatement(); // STAGE 1
@@ -52,15 +53,15 @@ public class InfluxDBLogicalGenerator {
       CharStream charStream2 = CharStreams.fromString(sql);
       SqlLexer lexer2 = new SqlLexer(charStream2);
       lexer2.removeErrorListeners();
-      lexer2.addErrorListener(SQLParseError.INSTANCE);
+      lexer2.addErrorListener(SqlParseError.INSTANCE);
       CommonTokenStream tokens2 = new CommonTokenStream(lexer2);
       InfluxDBSqlParser parser2 = new InfluxDBSqlParser(tokens2);
       parser2.getInterpreter().setPredictionMode(PredictionMode.LL);
       parser2.removeErrorListeners();
-      parser2.addErrorListener(SQLParseError.INSTANCE);
+      parser2.addErrorListener(SqlParseError.INSTANCE);
       tree = parser2.singleStatement(); // STAGE 2
       // if we parse ok, it's LL not SLL
     }
-    return influxDBSqlVisitor.visit(tree);
+    return influxDBAstVisitor.visit(tree);
   }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/sql/InfluxDBSqlVisitor.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/sql/InfluxDBSqlVisitor.java
deleted file mode 100644
index 6136ac99ee..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/sql/InfluxDBSqlVisitor.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * 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.protocol.influxdb.sql;
-
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.mpp.plan.expression.ResultColumn;
-import org.apache.iotdb.db.mpp.plan.expression.binary.AdditionExpression;
-import org.apache.iotdb.db.mpp.plan.expression.binary.DivisionExpression;
-import org.apache.iotdb.db.mpp.plan.expression.binary.ModuloExpression;
-import org.apache.iotdb.db.mpp.plan.expression.binary.MultiplicationExpression;
-import org.apache.iotdb.db.mpp.plan.expression.binary.SubtractionExpression;
-import org.apache.iotdb.db.mpp.plan.expression.leaf.TimeSeriesOperand;
-import org.apache.iotdb.db.mpp.plan.expression.multi.FunctionExpression;
-import org.apache.iotdb.db.mpp.plan.expression.unary.NegationExpression;
-import org.apache.iotdb.db.protocol.influxdb.operator.InfluxQueryOperator;
-import org.apache.iotdb.db.protocol.influxdb.operator.InfluxSelectComponent;
-import org.apache.iotdb.db.qp.constant.FilterConstant;
-import org.apache.iotdb.db.qp.constant.SQLConstant;
-import org.apache.iotdb.db.qp.logical.Operator;
-import org.apache.iotdb.db.qp.logical.crud.BasicFunctionOperator;
-import org.apache.iotdb.db.qp.logical.crud.FilterOperator;
-import org.apache.iotdb.db.qp.logical.crud.FromComponent;
-import org.apache.iotdb.db.qp.logical.crud.WhereComponent;
-import org.apache.iotdb.db.qp.sql.InfluxDBSqlParser;
-import org.apache.iotdb.db.qp.sql.InfluxDBSqlParserBaseVisitor;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
-
-public class InfluxDBSqlVisitor extends InfluxDBSqlParserBaseVisitor<Operator> {
-
-  private InfluxQueryOperator queryOp;
-
-  @Override
-  public Operator visitSingleStatement(InfluxDBSqlParser.SingleStatementContext ctx) {
-    return visit(ctx.statement());
-  }
-
-  @Override
-  public Operator visitSelectStatement(InfluxDBSqlParser.SelectStatementContext ctx) {
-    queryOp = new InfluxQueryOperator();
-    parseSelectClause(ctx.selectClause());
-    parseFromClause(ctx.fromClause());
-    if (ctx.whereClause() != null) {
-      WhereComponent whereComponent = parseWhereClause(ctx.whereClause());
-      queryOp.setWhereComponent(whereComponent);
-    }
-    return queryOp;
-  }
-
-  public void parseSelectClause(InfluxDBSqlParser.SelectClauseContext ctx) {
-    InfluxSelectComponent influxSelectComponent = new InfluxSelectComponent();
-    for (InfluxDBSqlParser.ResultColumnContext resultColumnContext : ctx.resultColumn()) {
-      influxSelectComponent.addResultColumn(parseResultColumn(resultColumnContext));
-    }
-    queryOp.setSelectComponent(influxSelectComponent);
-  }
-
-  private void parseFromClause(InfluxDBSqlParser.FromClauseContext fromClause) {
-    FromComponent fromComponent = new FromComponent();
-
-    for (InfluxDBSqlParser.NodeNameContext nodeName : fromClause.nodeName()) {
-      fromComponent.addPrefixTablePath(new PartialPath(nodeName.getText(), false));
-    }
-    queryOp.setFromComponent(fromComponent);
-  }
-
-  private WhereComponent parseWhereClause(InfluxDBSqlParser.WhereClauseContext ctx) {
-    FilterOperator whereOp = new FilterOperator();
-    whereOp.addChildOperator(parseOrExpression(ctx.orExpression()));
-    return new WhereComponent(whereOp.getChildren().get(0));
-  }
-
-  private FilterOperator parseOrExpression(InfluxDBSqlParser.OrExpressionContext ctx) {
-    if (ctx.andExpression().size() == 1) {
-      return parseAndExpression(ctx.andExpression(0));
-    }
-    FilterOperator binaryOp = new FilterOperator(FilterConstant.FilterType.KW_OR);
-    if (ctx.andExpression().size() > 2) {
-      binaryOp.addChildOperator(parseAndExpression(ctx.andExpression(0)));
-      binaryOp.addChildOperator(parseAndExpression(ctx.andExpression(1)));
-      for (int i = 2; i < ctx.andExpression().size(); i++) {
-        FilterOperator operator = new FilterOperator(FilterConstant.FilterType.KW_OR);
-        operator.addChildOperator(binaryOp);
-        operator.addChildOperator(parseAndExpression(ctx.andExpression(i)));
-        binaryOp = operator;
-      }
-    } else {
-      for (InfluxDBSqlParser.AndExpressionContext andExpressionContext : ctx.andExpression()) {
-        binaryOp.addChildOperator(parseAndExpression(andExpressionContext));
-      }
-    }
-    return binaryOp;
-  }
-
-  private FilterOperator parseAndExpression(InfluxDBSqlParser.AndExpressionContext ctx) {
-    if (ctx.predicate().size() == 1) {
-      return parsePredicate(ctx.predicate(0));
-    }
-    FilterOperator binaryOp = new FilterOperator(FilterConstant.FilterType.KW_AND);
-    int size = ctx.predicate().size();
-    if (size > 2) {
-      binaryOp.addChildOperator(parsePredicate(ctx.predicate(0)));
-      binaryOp.addChildOperator(parsePredicate(ctx.predicate(1)));
-      for (int i = 2; i < size; i++) {
-        FilterOperator op = new FilterOperator(FilterConstant.FilterType.KW_AND);
-        op.addChildOperator(binaryOp);
-        op.addChildOperator(parsePredicate(ctx.predicate(i)));
-        binaryOp = op;
-      }
-    } else {
-      for (InfluxDBSqlParser.PredicateContext predicateContext : ctx.predicate()) {
-        binaryOp.addChildOperator(parsePredicate(predicateContext));
-      }
-    }
-    return binaryOp;
-  }
-
-  private FilterOperator parsePredicate(InfluxDBSqlParser.PredicateContext ctx) {
-    if (ctx.OPERATOR_NOT() != null) {
-      FilterOperator notOp = new FilterOperator(FilterConstant.FilterType.KW_NOT);
-      notOp.addChildOperator(parseOrExpression(ctx.orExpression()));
-      return notOp;
-    } else if (ctx.LR_BRACKET() != null && ctx.OPERATOR_NOT() == null) {
-      return parseOrExpression(ctx.orExpression());
-    } else {
-      String keyName = null;
-      if (ctx.TIME() != null || ctx.TIMESTAMP() != null) {
-        keyName = SQLConstant.RESERVED_TIME;
-      }
-      if (ctx.nodeName() != null) {
-        keyName = ctx.nodeName().getText();
-      }
-      if (keyName == null) {
-        throw new IllegalArgumentException("keyName is null, please check the sql");
-      }
-      return parseBasicFunctionOperator(ctx, keyName);
-    }
-  }
-
-  private ResultColumn parseResultColumn(
-      InfluxDBSqlParser.ResultColumnContext resultColumnContext) {
-    return new ResultColumn(
-        parseExpression(resultColumnContext.expression()),
-        resultColumnContext.AS() == null ? null : resultColumnContext.identifier().getText());
-  }
-
-  private Expression parseExpression(InfluxDBSqlParser.ExpressionContext context) {
-    // LR_BRACKET unaryInBracket=expression RR_BRACKET
-    if (context.unaryInBracket != null) {
-      return parseExpression(context.unaryInBracket);
-    }
-
-    // (PLUS | MINUS) unaryAfterSign=expression
-    if (context.unaryAfterSign != null) {
-      return context.MINUS() != null
-          ? new NegationExpression(parseExpression(context.expression(0)))
-          : parseExpression(context.expression(0));
-    }
-
-    // leftExpression=expression (STAR | DIV | MOD) rightExpression=expression
-    // leftExpression=expression (PLUS | MINUS) rightExpression=expression
-    if (context.leftExpression != null && context.rightExpression != null) {
-      Expression leftExpression = parseExpression(context.leftExpression);
-      Expression rightExpression = parseExpression(context.rightExpression);
-      if (context.STAR() != null) {
-        return new MultiplicationExpression(leftExpression, rightExpression);
-      }
-      if (context.DIV() != null) {
-        return new DivisionExpression(leftExpression, rightExpression);
-      }
-      if (context.MOD() != null) {
-        return new ModuloExpression(leftExpression, rightExpression);
-      }
-      if (context.PLUS() != null) {
-        return new AdditionExpression(leftExpression, rightExpression);
-      }
-      if (context.MINUS() != null) {
-        return new SubtractionExpression(leftExpression, rightExpression);
-      }
-    }
-
-    // functionName=nodeName LR_BRACKET expression (COMMA expression)* functionAttribute* RR_BRACKET
-    if (context.functionName != null) {
-      return parseFunctionExpression(context);
-    }
-
-    // nodeName || constant
-    if (context.nodeName() != null || context.constant() != null) {
-      return new TimeSeriesOperand(new PartialPath(context.nodeName().getText(), false));
-    }
-
-    throw new UnsupportedOperationException();
-  }
-
-  private Expression parseFunctionExpression(InfluxDBSqlParser.ExpressionContext functionClause) {
-
-    FunctionExpression functionExpression =
-        new FunctionExpression(functionClause.functionName.getText());
-
-    // expressions
-    for (InfluxDBSqlParser.ExpressionContext expression : functionClause.expression()) {
-      functionExpression.addExpression(parseExpression(expression));
-    }
-
-    // attributes
-    for (InfluxDBSqlParser.FunctionAttributeContext functionAttribute :
-        functionClause.functionAttribute()) {
-      functionExpression.addAttribute(
-          removeStringQuote(functionAttribute.functionAttributeKey.getText()),
-          removeStringQuote(functionAttribute.functionAttributeValue.getText()));
-    }
-
-    return functionExpression;
-  }
-
-  private static String removeStringQuote(String src) {
-    if (src.charAt(0) == '\'' && src.charAt(src.length() - 1) == '\'') {
-      return src.substring(1, src.length() - 1);
-    } else if (src.charAt(0) == '\"' && src.charAt(src.length() - 1) == '\"') {
-      return src.substring(1, src.length() - 1);
-    } else {
-      throw new IllegalArgumentException("error format for string with quote:" + src);
-    }
-  }
-
-  /**
-   * parse time expression, which is addition and subtraction expression of duration time, now() or
-   * DataTimeFormat time.
-   *
-   * <p>eg. now() + 1d - 2h
-   */
-  private static Long parseDateExpression(InfluxDBSqlParser.DateExpressionContext ctx) {
-    long time;
-    time = parseTimeFormat(ctx.getChild(0).getText());
-    for (int i = 1; i < ctx.getChildCount(); i = i + 2) {
-      if (ctx.getChild(i).getText().equals("+")) {
-        time += DateTimeUtils.convertDurationStrToLong(time, ctx.getChild(i + 1).getText());
-      } else {
-        time -= DateTimeUtils.convertDurationStrToLong(time, ctx.getChild(i + 1).getText());
-      }
-    }
-    return time;
-  }
-
-  /** function for parsing time format. */
-  public static long parseTimeFormat(String timestampStr) {
-    if (timestampStr == null || timestampStr.trim().equals("")) {
-      throw new IllegalArgumentException("input timestamp cannot be empty");
-    }
-    if (timestampStr.equalsIgnoreCase(SQLConstant.NOW_FUNC)) {
-      return DateTimeUtils.currentTime();
-    }
-    throw new IllegalArgumentException(
-        String.format(
-            "Input time format %s error. "
-                + "Input like yyyy-MM-dd HH:mm:ss, yyyy-MM-ddTHH:mm:ss or "
-                + "refer to user document for more info.",
-            timestampStr));
-  }
-
-  private static FilterOperator parseBasicFunctionOperator(
-      InfluxDBSqlParser.PredicateContext ctx, String pathName) {
-    BasicFunctionOperator basic;
-    if (ctx.constant().dateExpression() != null) {
-      if (!pathName.equals(SQLConstant.RESERVED_TIME)) {
-        throw new IllegalArgumentException("Date can only be used to time");
-      }
-      basic =
-          new BasicFunctionOperator(
-              FilterConstant.lexerToFilterType.get(ctx.comparisonOperator().type.getType()),
-              new PartialPath(pathName, false),
-              Long.toString(parseDateExpression(ctx.constant().dateExpression())));
-    } else {
-      basic =
-          new BasicFunctionOperator(
-              FilterConstant.lexerToFilterType.get(ctx.comparisonOperator().type.getType()),
-              new PartialPath(pathName, false),
-              ctx.constant().getText());
-    }
-    return basic;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/statement/InfluxQueryStatement.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/statement/InfluxQueryStatement.java
new file mode 100644
index 0000000000..8cde0ebedd
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/statement/InfluxQueryStatement.java
@@ -0,0 +1,57 @@
+/*
+ * 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.protocol.influxdb.statement;
+
+import org.apache.iotdb.db.exception.sql.SemanticException;
+import org.apache.iotdb.db.mpp.plan.statement.component.SelectComponent;
+import org.apache.iotdb.db.mpp.plan.statement.crud.QueryStatement;
+
+public class InfluxQueryStatement extends QueryStatement {
+
+  private InfluxSelectComponent influxSelectComponent;
+
+  public InfluxQueryStatement() {
+    super();
+  }
+
+  @Override
+  public InfluxSelectComponent getSelectComponent() {
+    return influxSelectComponent;
+  }
+
+  @Override
+  public void setSelectComponent(SelectComponent influxSelectComponent) {
+    this.influxSelectComponent = (InfluxSelectComponent) influxSelectComponent;
+  }
+
+  @Override
+  public void semanticCheck() {
+    if (influxSelectComponent.isHasMoreSelectorFunction()
+        && influxSelectComponent.isHasCommonQuery()) {
+      throw new SemanticException(
+          "ERR: mixing multiple selector functions with tags or fields is not supported");
+    }
+    if (influxSelectComponent.isHasAggregationFunction()
+        && influxSelectComponent.isHasCommonQuery()) {
+      throw new SemanticException(
+          "ERR: mixing aggregate and non-aggregate queries is not supported");
+    }
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/operator/InfluxSelectComponent.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/statement/InfluxSelectComponent.java
similarity index 83%
rename from server/src/main/java/org/apache/iotdb/db/protocol/influxdb/operator/InfluxSelectComponent.java
rename to server/src/main/java/org/apache/iotdb/db/protocol/influxdb/statement/InfluxSelectComponent.java
index 79a1150f66..6e425a3097 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/operator/InfluxSelectComponent.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/statement/InfluxSelectComponent.java
@@ -16,19 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.iotdb.db.protocol.influxdb.operator;
+
+package org.apache.iotdb.db.protocol.influxdb.statement;
 
 import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.mpp.plan.expression.ResultColumn;
 import org.apache.iotdb.db.mpp.plan.expression.leaf.TimeSeriesOperand;
 import org.apache.iotdb.db.mpp.plan.expression.multi.FunctionExpression;
-import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSQLConstant;
-
-import java.time.ZoneId;
+import org.apache.iotdb.db.mpp.plan.statement.component.ResultColumn;
+import org.apache.iotdb.db.mpp.plan.statement.component.SelectComponent;
+import org.apache.iotdb.db.protocol.influxdb.constant.InfluxSqlConstant;
 
 /** this class maintains information from select clause. */
-public final class InfluxSelectComponent
-    extends org.apache.iotdb.db.qp.logical.crud.SelectComponent {
+public final class InfluxSelectComponent extends SelectComponent {
 
   private boolean hasAggregationFunction = false;
   private boolean hasSelectorFunction = false;
@@ -39,21 +38,21 @@ public final class InfluxSelectComponent
   private boolean hasOnlyTraverseFunction = false;
 
   public InfluxSelectComponent() {
-    super((ZoneId) null);
+    super(null);
   }
 
   public void addResultColumn(ResultColumn resultColumn) {
     Expression expression = resultColumn.getExpression();
     if (expression instanceof FunctionExpression) {
       String functionName = ((FunctionExpression) expression).getFunctionName();
-      if (InfluxSQLConstant.getNativeFunctionNames().contains(functionName.toLowerCase())) {
+      if (InfluxSqlConstant.getNativeFunctionNames().contains(functionName.toLowerCase())) {
         if (hasFunction) {
           hasMoreFunction = true;
         } else {
           hasFunction = true;
         }
       }
-      if (InfluxSQLConstant.getNativeSelectorFunctionNames().contains(functionName.toLowerCase())) {
+      if (InfluxSqlConstant.getNativeSelectorFunctionNames().contains(functionName.toLowerCase())) {
         if (hasSelectorFunction) {
           hasMoreSelectorFunction = true;
         } else {
@@ -62,7 +61,7 @@ public final class InfluxSelectComponent
       } else {
         hasAggregationFunction = true;
       }
-      if (InfluxSQLConstant.getOnlyTraverseFunctionNames().contains(functionName.toLowerCase())) {
+      if (InfluxSqlConstant.getOnlyTraverseFunctionNames().contains(functionName.toLowerCase())) {
         hasOnlyTraverseFunction = true;
       }
     }
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/util/FilterUtils.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/util/FilterUtils.java
index 8bad260c70..9855f5b9a7 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/util/FilterUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/util/FilterUtils.java
@@ -18,7 +18,7 @@
  */
 package org.apache.iotdb.db.protocol.influxdb.util;
 
-import org.apache.iotdb.db.qp.constant.FilterConstant;
+import org.apache.iotdb.db.mpp.plan.expression.ExpressionType;
 import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
 import org.apache.iotdb.tsfile.read.filter.ValueFilter;
 import org.apache.iotdb.tsfile.read.filter.basic.Filter;
@@ -62,22 +62,22 @@ public class FilterUtils {
     }
   }
 
-  public static Filter filterTypeToFilter(FilterConstant.FilterType filterType, String value) {
-    switch (filterType) {
-      case EQUAL:
+  public static Filter expressionTypeToFilter(ExpressionType expressionType, String value) {
+    switch (expressionType) {
+      case EQUAL_TO:
         return ValueFilter.eq(value);
-      case NOTEQUAL:
+      case NON_EQUAL:
         return ValueFilter.notEq(value);
-      case LESSTHANOREQUALTO:
+      case LESS_EQUAL:
         return ValueFilter.ltEq(value);
-      case LESSTHAN:
+      case LESS_THAN:
         return ValueFilter.lt(value);
-      case GREATERTHANOREQUALTO:
+      case GREATER_EQUAL:
         return ValueFilter.gtEq(value);
-      case GREATERTHAN:
+      case GREATER_THAN:
         return ValueFilter.gt(value);
       default:
-        throw new UnSupportedDataTypeException("Unsupported data type:" + filterType);
+        throw new IllegalArgumentException("Unsupported expression type:" + expressionType);
     }
   }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/mqtt/PayloadFormatManager.java b/server/src/main/java/org/apache/iotdb/db/protocol/mqtt/PayloadFormatManager.java
index 40a7631474..ee9fd6aea3 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/mqtt/PayloadFormatManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/mqtt/PayloadFormatManager.java
@@ -19,7 +19,6 @@ package org.apache.iotdb.db.protocol.mqtt;
 
 import org.apache.iotdb.commons.file.SystemFileFactory;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.utils.FilesUtils;
 
 import com.google.common.base.Preconditions;
 import org.apache.commons.io.FileUtils;
@@ -31,6 +30,7 @@ import java.io.IOException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.ServiceLoader;
 
@@ -86,7 +86,7 @@ public class PayloadFormatManager {
       logger.info("PayloadFormatManager(), find MQTT Payload Plugin {}.", pluginName);
     }
 
-    URL[] jarURLs = FilesUtils.getPluginJarURLs(mqttDir);
+    URL[] jarURLs = getPluginJarURLs(mqttDir);
     logger.debug("MQTT Plugin jarURLs: {}", jarURLs);
 
     for (URL jarUrl : jarURLs) {
@@ -111,4 +111,19 @@ public class PayloadFormatManager {
       }
     }
   }
+
+  /**
+   * get all jar files in the given folder
+   *
+   * @param folderPath
+   * @return all jar files' URL
+   * @throws IOException
+   */
+  private static URL[] getPluginJarURLs(String folderPath) throws IOException {
+    HashSet<File> fileSet =
+        new HashSet<>(
+            org.apache.commons.io.FileUtils.listFiles(
+                SystemFileFactory.INSTANCE.getFile(folderPath), new String[] {"jar"}, true));
+    return org.apache.commons.io.FileUtils.toURLs(fileSet.toArray(new File[0]));
+  }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/ExceptionHandler.java b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/ExceptionHandler.java
index 2bc6b1017a..5cc980fcc5 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/ExceptionHandler.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/ExceptionHandler.java
@@ -24,7 +24,6 @@ import org.apache.iotdb.commons.exception.MetadataException;
 import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.exception.sql.SQLParserException;
 import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.exception.sql.StatementAnalyzeException;
 import org.apache.iotdb.db.protocol.rest.model.ExecutionStatus;
@@ -69,7 +68,7 @@ public class ExceptionHandler {
     } else if (e instanceof ParseCancellationException) {
       responseResult.setMessage(e.getMessage());
       responseResult.setCode(TSStatusCode.SQL_PARSE_ERROR.getStatusCode());
-    } else if (e instanceof SQLParserException || e instanceof StatementAnalyzeException) {
+    } else if (e instanceof StatementAnalyzeException) {
       responseResult.setMessage(e.getMessage());
       responseResult.setCode(TSStatusCode.METADATA_ERROR.getStatusCode());
     } else if (e instanceof SemanticException) {
diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/ExecuteStatementHandler.java b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/ExecuteStatementHandler.java
index 17167fefd9..d7f7841167 100644
--- a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/ExecuteStatementHandler.java
+++ b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/ExecuteStatementHandler.java
@@ -17,8 +17,8 @@
 
 package org.apache.iotdb.db.protocol.rest.handler;
 
-import org.apache.iotdb.db.mpp.plan.constant.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.Statement;
+import org.apache.iotdb.db.mpp.plan.statement.StatementType;
 import org.apache.iotdb.db.mpp.plan.statement.crud.QueryStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.ShowStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.template.DropSchemaTemplateStatement;
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/constant/FilterConstant.java b/server/src/main/java/org/apache/iotdb/db/qp/constant/FilterConstant.java
deleted file mode 100644
index 5a92fa4ecd..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/constant/FilterConstant.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.qp.constant;
-
-import org.apache.iotdb.db.mpp.plan.expression.ExpressionType;
-import org.apache.iotdb.db.qp.sql.SqlLexer;
-
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.Map;
-
-public class FilterConstant {
-
-  public static final Map<Integer, FilterType> lexerToFilterType = new HashMap<>();
-  public static final Map<ExpressionType, FilterType> ExpressionToFilterType = new HashMap<>();
-  public static final Map<FilterType, String> filterSymbol = new EnumMap<>(FilterType.class);
-  public static final Map<FilterType, String> filterNames = new EnumMap<>(FilterType.class);
-  public static final Map<FilterType, FilterType> filterReverseWords =
-      new EnumMap<>(FilterType.class);
-
-  public enum FilterType {
-    KW_AND,
-    KW_OR,
-    KW_NOT,
-
-    EQUAL,
-    NOTEQUAL,
-    LESSTHANOREQUALTO,
-    LESSTHAN,
-    GREATERTHANOREQUALTO,
-    GREATERTHAN,
-    IN,
-    REGEXP,
-    LIKE
-  }
-
-  static {
-    lexerToFilterType.put(SqlLexer.OPERATOR_DEQ, FilterType.EQUAL);
-    lexerToFilterType.put(SqlLexer.OPERATOR_SEQ, FilterType.EQUAL);
-    lexerToFilterType.put(SqlLexer.OPERATOR_NEQ, FilterType.NOTEQUAL);
-    lexerToFilterType.put(SqlLexer.OPERATOR_LTE, FilterType.LESSTHANOREQUALTO);
-    lexerToFilterType.put(SqlLexer.OPERATOR_LT, FilterType.LESSTHAN);
-    lexerToFilterType.put(SqlLexer.OPERATOR_GTE, FilterType.GREATERTHANOREQUALTO);
-    lexerToFilterType.put(SqlLexer.OPERATOR_GT, FilterType.GREATERTHAN);
-    lexerToFilterType.put(SqlLexer.OPERATOR_IN, FilterType.IN);
-    lexerToFilterType.put(SqlLexer.REGEXP, FilterType.REGEXP);
-    lexerToFilterType.put(SqlLexer.LIKE, FilterType.LIKE);
-  }
-
-  static {
-    ExpressionToFilterType.put(ExpressionType.EQUAL_TO, FilterType.EQUAL);
-    ExpressionToFilterType.put(ExpressionType.NON_EQUAL, FilterType.NOTEQUAL);
-    ExpressionToFilterType.put(ExpressionType.LESS_EQUAL, FilterType.LESSTHANOREQUALTO);
-    ExpressionToFilterType.put(ExpressionType.LESS_THAN, FilterType.LESSTHAN);
-    ExpressionToFilterType.put(ExpressionType.GREATER_EQUAL, FilterType.GREATERTHANOREQUALTO);
-    ExpressionToFilterType.put(ExpressionType.GREATER_THAN, FilterType.GREATERTHAN);
-  }
-
-  static {
-    filterSymbol.put(FilterType.KW_AND, "&");
-    filterSymbol.put(FilterType.KW_OR, "|");
-    filterSymbol.put(FilterType.KW_NOT, "!");
-    filterSymbol.put(FilterType.EQUAL, "=");
-    filterSymbol.put(FilterType.NOTEQUAL, "<>");
-    filterSymbol.put(FilterType.LESSTHANOREQUALTO, "<=");
-    filterSymbol.put(FilterType.LESSTHAN, "<");
-    filterSymbol.put(FilterType.GREATERTHANOREQUALTO, ">=");
-    filterSymbol.put(FilterType.GREATERTHAN, ">");
-    filterSymbol.put(FilterType.LIKE, "%");
-  }
-
-  static {
-    filterNames.put(FilterType.KW_AND, "and");
-    filterNames.put(FilterType.KW_OR, "or");
-    filterNames.put(FilterType.KW_NOT, "not");
-    filterNames.put(FilterType.EQUAL, "equal");
-    filterNames.put(FilterType.NOTEQUAL, "not_equal");
-    filterNames.put(FilterType.LESSTHANOREQUALTO, "lessthan_or_equalto");
-    filterNames.put(FilterType.LESSTHAN, "lessthan");
-    filterNames.put(FilterType.GREATERTHANOREQUALTO, "greaterthan_or_equalto");
-    filterNames.put(FilterType.GREATERTHAN, "greaterthan");
-    filterNames.put(FilterType.IN, "in");
-    filterNames.put(FilterType.REGEXP, "regexp");
-    filterNames.put(FilterType.LIKE, "like");
-  }
-
-  static {
-    filterReverseWords.put(FilterType.KW_AND, FilterType.KW_OR);
-    filterReverseWords.put(FilterType.KW_OR, FilterType.KW_AND);
-    filterReverseWords.put(FilterType.EQUAL, FilterType.NOTEQUAL);
-    filterReverseWords.put(FilterType.NOTEQUAL, FilterType.EQUAL);
-    filterReverseWords.put(FilterType.LESSTHAN, FilterType.GREATERTHANOREQUALTO);
-    filterReverseWords.put(FilterType.GREATERTHANOREQUALTO, FilterType.LESSTHAN);
-    filterReverseWords.put(FilterType.LESSTHANOREQUALTO, FilterType.GREATERTHAN);
-    filterReverseWords.put(FilterType.GREATERTHAN, FilterType.LESSTHANOREQUALTO);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java b/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
deleted file mode 100644
index 399566525b..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.qp.constant;
-
-import org.apache.iotdb.commons.path.PartialPath;
-
-import com.google.common.collect.ImmutableMap;
-
-import java.util.Map;
-
-/** this class contains several constants used in SQL. */
-// some fields are for future features
-public class SQLConstant {
-
-  public SQLConstant() throws InstantiationException {
-    // forbidding instantiation
-    throw new InstantiationException();
-  }
-
-  private static final String[] SINGLE_ROOT_ARRAY = {"root", "**"};
-  private static final String[] SINGLE_TIME_ARRAY = {"time"};
-  public static final PartialPath TIME_PATH = new PartialPath(SINGLE_TIME_ARRAY);
-  public static final String ALIGNBY_DEVICE_COLUMN_NAME = "Device";
-  public static final String RESERVED_TIME = "time";
-  public static final String IS_AGGREGATION = "IS_AGGREGATION";
-  public static final String NOW_FUNC = "now()";
-  public static final String START_TIME_STR = "1970-1-01T00:00:00";
-
-  public static final String LINE_FEED_SIGNAL = "\n";
-  public static final String ROOT = "root";
-  public static final String METADATA_PARAM_EQUAL = "=";
-  public static final String QUOTE = "'";
-  public static final String DQUOTE = "\"";
-  public static final String BOOLEAN_TRUE = "true";
-  public static final String BOOLEAN_FALSE = "false";
-  public static final String BOOLEAN_TRUE_NUM = "1";
-  public static final String BOOLEAN_FALSE_NUM = "0";
-
-  // names of aggregations
-  public static final String MIN_TIME = "min_time";
-  public static final String MAX_TIME = "max_time";
-  public static final String MAX_VALUE = "max_value";
-  public static final String MIN_VALUE = "min_value";
-  public static final String EXTREME = "extreme";
-  public static final String FIRST_VALUE = "first_value";
-  public static final String LAST_VALUE = "last_value";
-  public static final String COUNT = "count";
-  public static final String AVG = "avg";
-  public static final String SUM = "sum";
-
-  public static final String LAST = "last";
-
-  public static final int TOK_WHERE = 23;
-  public static final int TOK_INSERT = 24;
-  public static final int TOK_DELETE = 25;
-  public static final int TOK_UPDATE = 26;
-  public static final int TOK_QUERY = 27;
-
-  public static final int TOK_CREATE_INDEX = 31;
-  public static final int TOK_DROP_INDEX = 32;
-  public static final int TOK_QUERY_INDEX = 33;
-
-  public static final int TOK_GRANT_WATERMARK_EMBEDDING = 34;
-  public static final int TOK_REVOKE_WATERMARK_EMBEDDING = 35;
-
-  public static final int TOK_AUTHOR_CREATE = 41;
-  public static final int TOK_AUTHOR_DROP = 42;
-  public static final int TOK_AUTHOR_GRANT = 43;
-  public static final int TOK_AUTHOR_REVOKE = 44;
-  public static final int TOK_AUTHOR_UPDATE_USER = 46;
-
-  public static final int TOK_DATALOAD = 45;
-
-  public static final int TOK_METADATA_CREATE = 51;
-  public static final int TOK_METADATA_DELETE = 52;
-  public static final int TOK_METADATA_SET_FILE_LEVEL = 53;
-  public static final int TOK_PROPERTY_CREATE = 54;
-  public static final int TOK_PROPERTY_ADD_LABEL = 55;
-  public static final int TOK_PROPERTY_DELETE_LABEL = 56;
-  public static final int TOK_PROPERTY_LINK = 57;
-  public static final int TOK_PROPERTY_UNLINK = 58;
-  public static final int TOK_LIST = 59;
-
-  public static final int TOK_DURATION = 60;
-  public static final int TOK_DATE_EXPR = 61;
-  public static final int TOK_METADATA_DELETE_FILE_LEVEL = 62;
-
-  public static final int TOK_SET = 63;
-  public static final int TOK_UNSET = 64;
-  public static final int TOK_SHOW = 65;
-  public static final int TOK_LOAD_CONFIGURATION = 66;
-
-  public static final int TOK_FLUSH_TASK_INFO = 67;
-  public static final int TOK_LOAD_FILES = 69;
-  public static final int TOK_REMOVE_FILE = 70;
-  public static final int TOK_UNLOAD_FILE = 71;
-  public static final int TOK_VERSION = 72;
-  public static final int TOK_TIMESERIES = 73;
-  public static final int TOK_STORAGE_GROUP = 74;
-  public static final int TOK_CHILD_PATHS = 75;
-  public static final int TOK_DEVICES = 76;
-  public static final int TOK_COUNT_TIMESERIES = 77;
-  public static final int TOK_COUNT_NODE_TIMESERIES = 78;
-  public static final int TOK_COUNT_NODES = 79;
-
-  public static final int TOK_METADATA_ALTER = 80;
-
-  public static final int TOK_FLUSH = 81;
-  public static final int TOK_MERGE = 82;
-  public static final int TOK_FULL_MERGE = 83;
-
-  public static final int TOK_CLEAR_CACHE = 84;
-
-  public static final int TOK_LOAD_CONFIGURATION_GLOBAL = 85;
-  public static final int TOK_LOAD_CONFIGURATION_LOCAL = 86;
-
-  public static final int TOK_SHOW_MERGE_STATUS = 87;
-  public static final int TOK_DELETE_PARTITION = 88;
-
-  public static final int TOK_CREATE_SCHEMA_SNAPSHOT = 89;
-  public static final int TOK_TRACING = 91;
-
-  public static final int TOK_FUNCTION_CREATE = 92;
-  public static final int TOK_FUNCTION_DROP = 93;
-  public static final int TOK_SHOW_FUNCTIONS = 94;
-
-  public static final int TOK_COUNT_DEVICES = 95;
-  public static final int TOK_COUNT_STORAGE_GROUP = 96;
-  public static final int TOK_QUERY_PROCESSLIST = 97;
-  public static final int TOK_KILL_QUERY = 98;
-
-  public static final int TOK_CHILD_NODES = 99;
-
-  public static final int TOK_TRIGGER_CREATE = 100;
-  public static final int TOK_TRIGGER_DROP = 101;
-  public static final int TOK_TRIGGER_START = 102;
-  public static final int TOK_TRIGGER_STOP = 103;
-  public static final int TOK_SHOW_TRIGGERS = 104;
-  public static final int TOK_LOCK_INFO = 105;
-
-  public static final int TOK_CONTINUOUS_QUERY_CREATE = 106;
-  public static final int TOK_CONTINUOUS_QUERY_DROP = 107;
-  public static final int TOK_SHOW_CONTINUOUS_QUERIES = 108;
-
-  public static final int TOK_SELECT_INTO = 109;
-
-  public static final int TOK_SET_SYSTEM_MODE = 110;
-
-  public static final int TOK_SETTLE = 111;
-
-  public static final int TOK_SCHEMA_TEMPLATE_CREATE = 112;
-  public static final int TOK_SCHEMA_TEMPLATE_SET = 113;
-  public static final int TOK_SCHEMA_TEMPLATE_ACTIVATE = 114;
-  public static final int TOK_SCHEMA_TEMPLATE_UNSET = 115;
-  public static final int TOK_SCHEMA_TEMPLATE_APPEND = 116;
-  public static final int TOK_SCHEMA_TEMPLATE_PRUNE = 117;
-  public static final int TOK_SCHEMA_TEMPLATE_DROP = 118;
-  public static final int TOK_SCHEMA_TEMPLATE_SHOW = 119;
-  public static final int TOK_SCHEMA_TEMPLATE_SHOW_NODES = 120;
-  public static final int TOK_SCHEMA_TEMPLATE_SHOW_PATHS_SET = 121;
-  public static final int TOK_SCHEMA_TEMPLATE_SHOW_PATHS_USING = 122;
-
-  public static final int TOK_SHOW_QUERY_RESOURCE = 123;
-
-  public static final int TOK_CREATE_PIPESINK = 200;
-  public static final int TOK_DROP_PIPESINK = 201;
-  public static final int TOK_SHOW_PIPESINK = 202;
-  public static final int TOK_SHOW_PIPESINKTYPE = 203;
-  public static final int TOK_CREATE_PIPE = 204;
-  public static final int TOK_SHOW_PIPE = 205;
-  public static final int TOK_STOP_PIPE = 206;
-  public static final int TOK_START_PIPE = 207;
-  public static final int TOK_DROP_PIPE = 208;
-  public static final int TOK_SHOW_PIPE_SERVER = 209;
-  public static final int TOK_PIPE_SERVER_START = 210;
-  public static final int TOK_PIPE_SERVER_STOP = 211;
-
-  public static final Map<Integer, String> tokenNames =
-      new ImmutableMap.Builder<Integer, String>()
-          .put(TOK_WHERE, "TOK_WHERE")
-          .put(TOK_INSERT, "TOK_INSERT")
-          .put(TOK_DELETE, "TOK_DELETE")
-          .put(TOK_UPDATE, "TOK_UPDATE")
-          .put(TOK_QUERY, "TOK_QUERY")
-          .put(TOK_AUTHOR_CREATE, "TOK_AUTHOR_CREATE")
-          .put(TOK_AUTHOR_DROP, "TOK_AUTHOR_DROP")
-          .put(TOK_AUTHOR_GRANT, "TOK_AUTHOR_GRANT")
-          .put(TOK_AUTHOR_REVOKE, "TOK_AUTHOR_REVOKE")
-          .put(TOK_AUTHOR_UPDATE_USER, "TOK_AUTHOR_UPDATE_USER")
-          .put(TOK_DATALOAD, "TOK_DATALOAD")
-          .put(TOK_METADATA_CREATE, "TOK_METADATA_CREATE")
-          .put(TOK_METADATA_DELETE, "TOK_METADATA_DELETE")
-          .put(TOK_METADATA_SET_FILE_LEVEL, "TOK_METADATA_SET_FILE_LEVEL")
-          .put(TOK_METADATA_DELETE_FILE_LEVEL, "TOK_METADATA_DELETE_FILE_LEVEL")
-          .put(TOK_PROPERTY_CREATE, "TOK_PROPERTY_CREATE")
-          .put(TOK_PROPERTY_ADD_LABEL, "TOK_PROPERTY_ADD_LABEL")
-          .put(TOK_PROPERTY_DELETE_LABEL, "TOK_PROPERTY_DELETE_LABEL")
-          .put(TOK_PROPERTY_LINK, "TOK_PROPERTY_LINK")
-          .put(TOK_PROPERTY_UNLINK, "TOK_PROPERTY_UNLINK")
-          .put(TOK_LIST, "TOK_LIST")
-          .put(TOK_SET, "TOK_SET")
-          .put(TOK_UNSET, "TOK_UNSET")
-          .put(TOK_SHOW, "TOK_SHOW")
-          .put(TOK_LOAD_CONFIGURATION, "TOK_LOAD_CONFIGURATION")
-          .put(TOK_FLUSH_TASK_INFO, "TOK_FLUSH_TASK_INFO")
-          .put(TOK_LOAD_FILES, "TOK_LOAD_FILES")
-          .put(TOK_REMOVE_FILE, "TOK_REMOVE_FILE")
-          .put(TOK_UNLOAD_FILE, "TOK_UNLOAD_FILE")
-          .put(TOK_SHOW_MERGE_STATUS, "TOK_SHOW_MERGE_STATUS")
-          .put(TOK_DELETE_PARTITION, "TOK_DELETE_PARTITION")
-          .put(TOK_TRACING, "TOK_TRACING")
-          .put(TOK_FUNCTION_CREATE, "TOK_FUNCTION_CREATE")
-          .put(TOK_FUNCTION_DROP, "TOK_FUNCTION_DROP")
-          .put(TOK_SHOW_FUNCTIONS, "TOK_SHOW_FUNCTIONS")
-          .put(TOK_CREATE_INDEX, "TOK_CREATE_INDEX")
-          .put(TOK_DROP_INDEX, "TOK_DROP_INDEX")
-          .put(TOK_QUERY_INDEX, "TOK_QUERY_INDEX")
-          .put(TOK_TRIGGER_CREATE, "TOK_TRIGGER_CREATE")
-          .put(TOK_TRIGGER_DROP, "TOK_TRIGGER_DROP")
-          .put(TOK_TRIGGER_START, "TOK_TRIGGER_START")
-          .put(TOK_TRIGGER_STOP, "TOK_TRIGGER_STOP")
-          .put(TOK_SHOW_TRIGGERS, "TOK_SHOW_TRIGGERS")
-          .put(TOK_CONTINUOUS_QUERY_CREATE, "TOK_CONTINUOUS_QUERY_CREATE")
-          .put(TOK_CONTINUOUS_QUERY_DROP, "TOK_CONTINUOUS_QUERY_DROP")
-          .put(TOK_SHOW_CONTINUOUS_QUERIES, "TOK_SHOW_CONTINUOUS_QUERIES")
-          .put(TOK_SELECT_INTO, "TOK_SELECT_INTO")
-          .put(TOK_SETTLE, "TOK_SETTLE")
-          .put(TOK_SCHEMA_TEMPLATE_CREATE, "TOK_SCHEMA_TEMPLATE_CREATE")
-          .put(TOK_SCHEMA_TEMPLATE_SET, "TOK_SCHEMA_TEMPLATE_SET")
-          .put(TOK_SCHEMA_TEMPLATE_ACTIVATE, "TOK_SCHEMA_TEMPLATE_ACTIVATE")
-          .put(TOK_SCHEMA_TEMPLATE_UNSET, "TOK_SCHEMA_TEMPLATE_UNSET")
-          .put(TOK_SCHEMA_TEMPLATE_APPEND, "TOK_SCHEMA_TEMPLATE_APPEND")
-          .put(TOK_SCHEMA_TEMPLATE_PRUNE, "TOK_SCHEMA_TEMPLATE_PRUNE")
-          .put(TOK_SCHEMA_TEMPLATE_DROP, "TOK_SCHEMA_TEMPLATE_DROP")
-          .put(TOK_SCHEMA_TEMPLATE_SHOW, "TOK_SCHEMA_TEMPLATE_SHOW")
-          .put(TOK_SCHEMA_TEMPLATE_SHOW_NODES, "TOK_SCHEMA_TEMPLATE_SHOW_NODES")
-          .put(TOK_SCHEMA_TEMPLATE_SHOW_PATHS_SET, "TOK_SCHEMA_TEMPLATE_SHOW_PATHS_SET")
-          .put(TOK_SCHEMA_TEMPLATE_SHOW_PATHS_USING, "TOK_SCHEMA_TEMPLATE_SHOW_PATHS_USING")
-          .put(TOK_SHOW_QUERY_RESOURCE, "TOK_SHOW_QUERY_RESOURCE")
-          .put(TOK_CREATE_PIPESINK, "TOK_CREATE_PIPESINK")
-          .put(TOK_DROP_PIPESINK, "TOK_DROP_PIPESINK")
-          .put(TOK_SHOW_PIPESINK, "TOK_SHOW_PIPESINK")
-          .put(TOK_SHOW_PIPESINKTYPE, "TOK_SHOW_PIPESINKTYPE")
-          .put(TOK_CREATE_PIPE, "TOK_CREATE_PIPE")
-          .put(TOK_SHOW_PIPE, "TOK_SHOW_PIPE")
-          .put(TOK_STOP_PIPE, "TOK_STOP_PIPE")
-          .put(TOK_START_PIPE, "TOK_START_PIPE")
-          .put(TOK_DROP_PIPE, "TOK_DROP_PIPE")
-          .put(TOK_SHOW_PIPE_SERVER, "TOK_SHOW_PIPE_SERVER")
-          .put(TOK_PIPE_SERVER_START, "TOK_PIPE_SERVER_START")
-          .put(TOK_PIPE_SERVER_STOP, "TOK_PIPE_SERVER_STOP")
-          .build();
-
-  public static String[] getSingleRootArray() {
-    return SINGLE_ROOT_ARRAY;
-  }
-
-  public static String[] getSingleTimeArray() {
-    return SINGLE_TIME_ARRAY;
-  }
-
-  public static boolean isReservedPath(PartialPath pathStr) {
-    return pathStr.equals(TIME_PATH);
-  }
-
-  public static boolean isNotReservedPath(PartialPath pathStr) {
-    return !pathStr.equals(TIME_PATH);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
deleted file mode 100644
index 6efdf010ed..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.qp.logical;
-
-import org.apache.iotdb.db.qp.constant.SQLConstant;
-
-/** This class is a superclass of all operator. */
-public abstract class Operator {
-
-  // operator type in int format
-  protected int tokenIntType;
-  // flag of "explain"
-  protected boolean isDebug;
-
-  protected OperatorType operatorType = OperatorType.NULL;
-
-  /**
-   * Since IoTDB v0.13, all DDL and DML use patternMatch as default. Before IoTDB v0.13, all DDL and
-   * DML use prefixMatch.
-   */
-  protected boolean isPrefixMatchPath = false;
-
-  protected Operator(int tokenIntType) {
-    this.tokenIntType = tokenIntType;
-    this.isDebug = false;
-  }
-
-  public OperatorType getType() {
-    return operatorType;
-  }
-
-  public boolean isQuery() {
-    return operatorType == OperatorType.QUERY;
-  }
-
-  public int getTokenIntType() {
-    return tokenIntType;
-  }
-
-  public void setOperatorType(OperatorType operatorType) {
-    this.operatorType = operatorType;
-  }
-
-  public boolean isDebug() {
-    return isDebug;
-  }
-
-  public void setDebug(boolean debug) {
-    isDebug = debug;
-  }
-
-  public boolean isPrefixMatchPath() {
-    return isPrefixMatchPath;
-  }
-
-  @Override
-  public String toString() {
-    return SQLConstant.tokenNames.get(tokenIntType);
-  }
-
-  /** If you want to add new OperatorType, you must add it in the last. */
-  public enum OperatorType {
-    NULL,
-
-    AUTHOR,
-    LOAD_DATA,
-    CREATE_USER,
-    DELETE_USER,
-    MODIFY_PASSWORD,
-    GRANT_USER_PRIVILEGE,
-    REVOKE_USER_PRIVILEGE,
-    GRANT_USER_ROLE,
-    REVOKE_USER_ROLE,
-    CREATE_ROLE,
-    DELETE_ROLE,
-    GRANT_ROLE_PRIVILEGE,
-    REVOKE_ROLE_PRIVILEGE,
-    LIST_USER,
-    LIST_ROLE,
-    LIST_USER_PRIVILEGE,
-    LIST_ROLE_PRIVILEGE,
-    LIST_USER_ROLES,
-    LIST_ROLE_USERS,
-    GRANT_WATERMARK_EMBEDDING,
-    REVOKE_WATERMARK_EMBEDDING,
-
-    SET_STORAGE_GROUP,
-    DELETE_STORAGE_GROUP,
-    CREATE_TIMESERIES,
-    CREATE_ALIGNED_TIMESERIES,
-    CREATE_MULTI_TIMESERIES,
-    DELETE_TIMESERIES,
-    ALTER_TIMESERIES,
-    CHANGE_ALIAS,
-    CHANGE_TAG_OFFSET,
-
-    INSERT,
-    BATCH_INSERT,
-    BATCH_INSERT_ROWS,
-    BATCH_INSERT_ONE_DEVICE,
-    MULTI_BATCH_INSERT,
-
-    DELETE,
-
-    QUERY,
-    LAST,
-    GROUP_BY_TIME,
-    GROUP_BY_FILL,
-    AGGREGATION,
-    FILL,
-    UDAF,
-    UDTF,
-
-    SELECT_INTO,
-
-    CREATE_FUNCTION,
-    DROP_FUNCTION,
-
-    SHOW,
-    SHOW_MERGE_STATUS,
-
-    CREATE_INDEX,
-    DROP_INDEX,
-    QUERY_INDEX,
-
-    LOAD_FILES,
-    REMOVE_FILE,
-    UNLOAD_FILE,
-
-    CREATE_TRIGGER,
-    DROP_TRIGGER,
-    START_TRIGGER,
-    STOP_TRIGGER,
-
-    CREATE_TEMPLATE,
-    SET_TEMPLATE,
-    ACTIVATE_TEMPLATE,
-
-    MERGE,
-    FULL_MERGE,
-
-    MNODE,
-    MEASUREMENT_MNODE,
-    STORAGE_GROUP_MNODE,
-    AUTO_CREATE_DEVICE_MNODE,
-
-    TTL,
-    KILL,
-    FLUSH,
-    TRACING,
-    CLEAR_CACHE,
-    DELETE_PARTITION,
-    LOAD_CONFIGURATION,
-    CREATE_SCHEMA_SNAPSHOT,
-
-    CREATE_CONTINUOUS_QUERY,
-    DROP_CONTINUOUS_QUERY,
-    SHOW_CONTINUOUS_QUERIES,
-    SET_SYSTEM_MODE,
-
-    SETTLE,
-
-    UNSET_TEMPLATE,
-    PRUNE_TEMPLATE,
-    APPEND_TEMPLATE,
-    DROP_TEMPLATE,
-
-    SHOW_QUERY_RESOURCE,
-
-    CREATE_PIPESINK,
-    DROP_PIPESINK,
-    SHOW_PIPESINK,
-    SHOW_PIPESINKTYPE,
-    CREATE_PIPE,
-    SHOW_PIPE,
-    STOP_PIPE,
-    START_PIPE,
-    DROP_PIPE,
-
-    ACTIVATE_TEMPLATE_IN_CLUSTER,
-    PRE_DELETE_TIMESERIES_IN_CLUSTER,
-    ROLLBACK_PRE_DELETE_TIMESERIES
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/BasicFunctionOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/BasicFunctionOperator.java
deleted file mode 100644
index dd992c969a..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/BasicFunctionOperator.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.qp.logical.crud;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.query.LogicalOperatorException;
-import org.apache.iotdb.db.exception.sql.SQLParserException;
-import org.apache.iotdb.db.qp.constant.FilterConstant;
-import org.apache.iotdb.db.qp.constant.FilterConstant.FilterType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
-import org.apache.iotdb.tsfile.utils.Binary;
-import org.apache.iotdb.tsfile.utils.Pair;
-import org.apache.iotdb.tsfile.utils.StringContainer;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Map;
-import java.util.Objects;
-
-/** basic operator includes = < > >= <= !=. */
-public class BasicFunctionOperator extends FunctionOperator {
-
-  protected String value;
-  private Logger logger = LoggerFactory.getLogger(BasicFunctionOperator.class);
-  private BasicOperatorType funcToken;
-
-  /**
-   * BasicFunctionOperator Constructor.
-   *
-   * @param filterType filter Type
-   * @param path path
-   * @param value value
-   * @throws LogicalOperatorException Logical Operator Exception
-   */
-  public BasicFunctionOperator(FilterType filterType, PartialPath path, String value)
-      throws SQLParserException {
-    super(filterType);
-    funcToken = BasicOperatorType.getBasicOpBySymbol(filterType);
-    this.singlePath = path;
-    this.value = value;
-    isLeaf = true;
-    isSingle = true;
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  @Override
-  public void reverseFunc() {
-    FilterType filterType = FilterConstant.filterReverseWords.get(this.filterType);
-    setFilterType(filterType);
-    funcToken = BasicOperatorType.getBasicOpBySymbol(filterType);
-  }
-
-  @Override
-  protected Pair<IUnaryExpression, String> transformToSingleQueryFilter(
-      Map<PartialPath, TSDataType> pathTSDataTypeHashMap)
-      throws LogicalOperatorException, MetadataException {
-    TSDataType type = pathTSDataTypeHashMap.get(singlePath);
-    if (type == null) {
-      throw new MetadataException(
-          "given seriesPath:{" + singlePath.getFullPath() + "} don't exist in metadata");
-    }
-    IUnaryExpression ret;
-
-    switch (type) {
-      case INT32:
-        ret = funcToken.getUnaryExpression(singlePath, Integer.valueOf(value));
-        break;
-      case INT64:
-        ret = funcToken.getUnaryExpression(singlePath, Long.valueOf(value));
-        break;
-      case BOOLEAN:
-        ret = funcToken.getUnaryExpression(singlePath, Boolean.valueOf(value));
-        break;
-      case FLOAT:
-        ret = funcToken.getUnaryExpression(singlePath, Float.valueOf(value));
-        break;
-      case DOUBLE:
-        ret = funcToken.getUnaryExpression(singlePath, Double.valueOf(value));
-        break;
-      case TEXT:
-        if (funcToken.equals(BasicOperatorType.EQ)
-            || funcToken.equals(BasicOperatorType.NOTEQUAL)) {
-          ret =
-              funcToken.getUnaryExpression(
-                  singlePath,
-                  (value.startsWith("'") && value.endsWith("'"))
-                          || (value.startsWith("\"") && value.endsWith("\""))
-                      ? new Binary(value.substring(1, value.length() - 1))
-                      : new Binary(value));
-        } else {
-          throw new LogicalOperatorException(
-              "For Basic operator,TEXT type only support EQUAL or NOTEQUAL operator");
-        }
-        break;
-      default:
-        throw new LogicalOperatorException(type.toString(), "");
-    }
-
-    return new Pair<>(ret, singlePath.getFullPath());
-  }
-
-  @Override
-  public String showTree(int spaceNum) {
-    StringContainer sc = new StringContainer();
-    for (int i = 0; i < spaceNum; i++) {
-      sc.addTail("  ");
-    }
-    sc.addTail(singlePath.getFullPath(), getFilterSymbol(), value, ", single\n");
-    return sc.toString();
-  }
-
-  @Override
-  public BasicFunctionOperator copy() {
-    BasicFunctionOperator ret;
-    try {
-      ret = new BasicFunctionOperator(this.filterType, singlePath.clone(), value);
-    } catch (SQLParserException e) {
-      logger.error("error copy:", e);
-      return null;
-    }
-    ret.isLeaf = isLeaf;
-    ret.isSingle = isSingle;
-    ret.pathSet = pathSet;
-    return ret;
-  }
-
-  @Override
-  public String toString() {
-    return "[" + singlePath.getFullPath() + getFilterSymbol() + value + "]";
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    BasicFunctionOperator that = (BasicFunctionOperator) o;
-    return Objects.equals(singlePath, that.singlePath)
-        && Objects.equals(value, that.value)
-        && funcToken == that.funcToken;
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(super.hashCode(), singlePath, value, funcToken);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/BasicOperatorType.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/BasicOperatorType.java
deleted file mode 100644
index fdde4558a9..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/BasicOperatorType.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.qp.logical.crud;
-
-import org.apache.iotdb.db.exception.query.LogicalOperatorException;
-import org.apache.iotdb.db.exception.sql.SQLParserException;
-import org.apache.iotdb.db.qp.constant.FilterConstant;
-import org.apache.iotdb.db.qp.constant.FilterConstant.FilterType;
-import org.apache.iotdb.tsfile.read.common.Path;
-import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
-import org.apache.iotdb.tsfile.read.expression.impl.GlobalTimeExpression;
-import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
-import org.apache.iotdb.tsfile.read.filter.TimeFilter;
-import org.apache.iotdb.tsfile.read.filter.ValueFilter;
-import org.apache.iotdb.tsfile.read.filter.basic.Filter;
-
-import static org.apache.iotdb.commons.conf.IoTDBConstant.TIME;
-
-/** all basic operator in filter. */
-public enum BasicOperatorType {
-  EQ {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.eq((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.eq(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.eq(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.eq(value);
-    }
-  },
-  LTEQ {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.ltEq((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.ltEq(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.ltEq(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.ltEq(value);
-    }
-  },
-  LT {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.lt((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.lt(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.lt(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.lt(value);
-    }
-  },
-  GTEQ {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.gtEq((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.gtEq(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.gtEq(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.gtEq(value);
-    }
-  },
-  GT {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.gt((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.gt(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.gt(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.gt(value);
-    }
-  },
-  NOTEQUAL {
-    @Override
-    public <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value) {
-      if (path.equals(TIME)) {
-        return new GlobalTimeExpression(TimeFilter.notEq((Long) value));
-      } else {
-        return new SingleSeriesExpression(path, ValueFilter.notEq(value));
-      }
-    }
-
-    @Override
-    public <T extends Comparable<T>> Filter getValueFilter(T value) {
-      return ValueFilter.notEq(value);
-    }
-
-    @Override
-    public Filter getTimeFilter(long value) {
-      return TimeFilter.notEq(value);
-    }
-  };
-
-  /**
-   * BasicOperatorType Constructor.
-   *
-   * @param filterType token in Int Type
-   * @return basic operator type
-   * @throws LogicalOperatorException Logical Operator Exception
-   */
-  public static BasicOperatorType getBasicOpBySymbol(FilterType filterType)
-      throws SQLParserException {
-    switch (filterType) {
-      case EQUAL:
-        return EQ;
-      case LESSTHANOREQUALTO:
-        return LTEQ;
-      case LESSTHAN:
-        return LT;
-      case GREATERTHANOREQUALTO:
-        return GTEQ;
-      case GREATERTHAN:
-        return GT;
-      case NOTEQUAL:
-        return NOTEQUAL;
-      default:
-        throw new SQLParserException(
-            "unsupported type:{}" + FilterConstant.filterNames.get(filterType));
-    }
-  }
-
-  public abstract <T extends Comparable<T>> IUnaryExpression getUnaryExpression(Path path, T value);
-
-  public abstract <T extends Comparable<T>> Filter getValueFilter(T tsPrimitiveType);
-
-  public abstract Filter getTimeFilter(long value);
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FilterOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FilterOperator.java
deleted file mode 100644
index cc81c029a5..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FilterOperator.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.qp.logical.crud;
-
-import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.query.LogicalOperatorException;
-import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.qp.constant.FilterConstant;
-import org.apache.iotdb.db.qp.constant.FilterConstant.FilterType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.expression.IExpression;
-import org.apache.iotdb.tsfile.read.expression.IUnaryExpression;
-import org.apache.iotdb.tsfile.read.expression.impl.BinaryExpression;
-import org.apache.iotdb.tsfile.read.filter.factory.FilterFactory;
-import org.apache.iotdb.tsfile.utils.Pair;
-import org.apache.iotdb.tsfile.utils.StringContainer;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This class is for filter in where clause. It may consist of more than two child FilterOperators,
- * but if it's not a leaf operator, the relation is the same among all of its children (AND or OR),
- * which is identified by tokenType.
- */
-public class FilterOperator implements Comparable<FilterOperator> {
-
-  protected FilterType filterType;
-
-  private List<FilterOperator> childOperators = new ArrayList<>();
-  // leaf filter operator means it doesn't have left and right child filterOperator. Leaf filter
-  // should set FunctionOperator.
-  protected boolean isLeaf = false;
-  // isSingle being true means all recursive children of this filter belong to one seriesPath.
-  boolean isSingle = false;
-  // if isSingle = false, singlePath must be null
-  PartialPath singlePath = null;
-  // all paths involved in this filter
-  Set<PartialPath> pathSet;
-
-  public FilterOperator() {}
-
-  public FilterOperator(FilterType filterType) {
-    this.filterType = filterType;
-  }
-
-  public FilterOperator(FilterType filterType, boolean isSingle) {
-    this.filterType = filterType;
-    this.isSingle = isSingle;
-  }
-
-  public FilterType getFilterType() {
-    return filterType;
-  }
-
-  public void setFilterType(FilterType filterType) {
-    this.filterType = filterType;
-  }
-
-  public String getFilterName() {
-    return FilterConstant.filterNames.get(filterType);
-  }
-
-  public String getFilterSymbol() {
-    return FilterConstant.filterSymbol.get(filterType);
-  }
-
-  public List<FilterOperator> getChildren() {
-    return childOperators;
-  }
-
-  public void setChildren(List<FilterOperator> children) {
-    this.childOperators = children;
-  }
-
-  public void setIsSingle(boolean b) {
-    this.isSingle = b;
-  }
-
-  public PartialPath getSinglePath() {
-    return singlePath;
-  }
-
-  public void setSinglePath(PartialPath singlePath) {
-    this.singlePath = singlePath;
-  }
-
-  public void addChildOperator(FilterOperator op) {
-    childOperators.add(op);
-  }
-
-  public void setPathSet(Set<PartialPath> pathSet) {
-    this.pathSet = pathSet;
-  }
-
-  public Set<PartialPath> getPathSet() {
-    return pathSet;
-  }
-
-  /**
-   * For a filter operator, if isSingle, call transformToSingleQueryFilter.<br>
-   * FilterOperator cannot be leaf.
-   *
-   * @return QueryFilter in TsFile
-   * @param pathTSDataTypeHashMap
-   */
-  public IExpression transformToExpression(Map<PartialPath, TSDataType> pathTSDataTypeHashMap)
-      throws QueryProcessException {
-    if (isSingle) {
-      Pair<IUnaryExpression, String> ret;
-      try {
-        ret = transformToSingleQueryFilter(pathTSDataTypeHashMap);
-      } catch (MetadataException e) {
-        throw new QueryProcessException(e);
-      }
-      return ret.left;
-    } else {
-      if (childOperators.isEmpty()) {
-        throw new LogicalOperatorException(
-            String.valueOf(filterType), "this filter is not leaf, but it's empty");
-      }
-      IExpression retFilter = childOperators.get(0).transformToExpression(pathTSDataTypeHashMap);
-      IExpression currentFilter;
-      for (int i = 1; i < childOperators.size(); i++) {
-        currentFilter = childOperators.get(i).transformToExpression(pathTSDataTypeHashMap);
-        switch (filterType) {
-          case KW_AND:
-            retFilter = BinaryExpression.and(retFilter, currentFilter);
-            break;
-          case KW_OR:
-            retFilter = BinaryExpression.or(retFilter, currentFilter);
-            break;
-          default:
-            throw new LogicalOperatorException(
-                String.valueOf(filterType), "Maybe it means " + getFilterName());
-        }
-      }
-      return retFilter;
-    }
-  }
-
-  /**
-   * it will be used in BasicFunction Operator.
-   *
-   * @return - pair.left: UnaryQueryFilter constructed by its one child; pair.right: Path
-   *     represented by this child.
-   * @throws MetadataException exception in filter transforming
-   * @param pathTSDataTypeHashMap
-   */
-  protected Pair<IUnaryExpression, String> transformToSingleQueryFilter(
-      Map<PartialPath, TSDataType> pathTSDataTypeHashMap)
-      throws LogicalOperatorException, MetadataException {
-    if (childOperators.isEmpty()) {
-      throw new LogicalOperatorException(
-          String.valueOf(filterType),
-          "TransformToSingleFilter: this filter is not a leaf, but it's empty.");
-    }
-    Pair<IUnaryExpression, String> currentPair =
-        childOperators.get(0).transformToSingleQueryFilter(pathTSDataTypeHashMap);
-
-    IUnaryExpression retFilter = currentPair.left;
-    String path = currentPair.right;
-
-    for (int i = 1; i < childOperators.size(); i++) {
-      currentPair = childOperators.get(i).transformToSingleQueryFilter(pathTSDataTypeHashMap);
-      if (!path.equals(currentPair.right)) {
-        throw new LogicalOperatorException(
-            "TransformToSingleFilter: paths among children are not inconsistent: one is: "
-                + path
-                + ", another is: "
-                + currentPair.right);
-      }
-      switch (filterType) {
-        case KW_AND:
-          retFilter.setFilter(
-              FilterFactory.and(retFilter.getFilter(), currentPair.left.getFilter()));
-          break;
-        case KW_OR:
-          retFilter.setFilter(
-              FilterFactory.or(retFilter.getFilter(), currentPair.left.getFilter()));
-          break;
-        default:
-          throw new LogicalOperatorException(
-              String.valueOf(filterType), "Maybe it means " + getFilterName());
-      }
-    }
-    return new Pair<>(retFilter, path);
-  }
-
-  /** a filter with null path is no smaller than any other filter. */
-  @Override
-  public int compareTo(FilterOperator fil) {
-    if (singlePath == null && fil.singlePath == null) {
-      return 0;
-    }
-    if (singlePath == null) {
-      return 1;
-    }
-    if (fil.singlePath == null) {
-      return -1;
-    }
-    return fil.singlePath.getFullPath().compareTo(singlePath.getFullPath());
-  }
-
-  @Override
-  public boolean equals(Object fil) {
-    if (!(fil instanceof FilterOperator)) {
-      return false;
-    }
-    // if child is leaf, will execute BasicFunctionOperator.equals()
-    FilterOperator operator = (FilterOperator) fil;
-    return this.filterType == operator.filterType
-        && this.getChildren().equals(operator.getChildren());
-  }
-
-  @Override
-  public int hashCode() {
-    return getFilterSymbol().hashCode();
-  }
-
-  public boolean isLeaf() {
-    return isLeaf;
-  }
-
-  public boolean isSingle() {
-    return isSingle;
-  }
-
-  public String showTree() {
-    return showTree(0);
-  }
-
-  public String showTree(int spaceNum) {
-    StringContainer sc = new StringContainer();
-    for (int i = 0; i < spaceNum; i++) {
-      sc.addTail("  ");
-    }
-    sc.addTail(getFilterName());
-    if (isSingle) {
-      sc.addTail("[single:", getSinglePath().getFullPath(), "]");
-    }
-    sc.addTail("\n");
-    for (FilterOperator filter : childOperators) {
-      sc.addTail(filter.showTree(spaceNum + 1));
-    }
-    return sc.toString();
-  }
-
-  @Override
-  public String toString() {
-    StringContainer sc = new StringContainer();
-    sc.addTail("[", FilterConstant.filterNames.get(filterType));
-    if (isSingle) {
-      sc.addTail("[single:", getSinglePath().getFullPath(), "]");
-    }
-    sc.addTail(" ");
-    for (FilterOperator filter : childOperators) {
-      sc.addTail(filter.toString());
-    }
-    sc.addTail("]");
-    return sc.toString();
-  }
-
-  public FilterOperator copy() {
-    FilterOperator ret = new FilterOperator(this.filterType);
-    ret.isLeaf = isLeaf;
-    ret.isSingle = isSingle;
-    if (singlePath != null) {
-      ret.singlePath = singlePath.clone();
-    }
-    for (FilterOperator filterOperator : this.childOperators) {
-      ret.addChildOperator(filterOperator.copy());
-    }
-    return ret;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FromComponent.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FromComponent.java
deleted file mode 100644
index 9c8741ed38..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FromComponent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.qp.logical.crud;
-
-import org.apache.iotdb.commons.path.PartialPath;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/** this class maintains information of {@code FROM} clause. */
-public class FromComponent {
-
-  private List<PartialPath> prefixList = new ArrayList<>();
-
-  public FromComponent() {}
-
-  public void addPrefixTablePath(PartialPath prefixPath) {
-    prefixList.add(prefixPath);
-  }
-
-  public List<PartialPath> getPrefixPaths() {
-    return prefixList;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FunctionOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FunctionOperator.java
deleted file mode 100644
index 1c58d6ff4c..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/FunctionOperator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.qp.logical.crud;
-
-import org.apache.iotdb.db.qp.constant.FilterConstant.FilterType;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class presents series condition which is general(e.g. numerical comparison) or defined by
- * user. Function is used for bottom operator.<br>
- * FunctionOperator has a {@code seriesPath}, and other filter condition.
- */
-public class FunctionOperator extends FilterOperator {
-
-  private static final Logger logger = LoggerFactory.getLogger(FunctionOperator.class);
-
-  public FunctionOperator(FilterType filterType) {
-    super(filterType);
-  }
-
-  /** reverse func. */
-  public void reverseFunc() {
-    // Implemented by subclass
-  }
-
-  @Override
-  public void addChildOperator(FilterOperator op) {
-    logger.error("cannot add child to leaf FilterOperator, now it's FunctionOperator");
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java
deleted file mode 100644
index 65a27dcf65..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.qp.logical.crud;
-
-import org.apache.iotdb.db.index.common.IndexType;
-import org.apache.iotdb.db.qp.constant.SQLConstant;
-import org.apache.iotdb.db.qp.logical.Operator;
-
-import java.util.Map;
-import java.util.Set;
-
-public class QueryOperator extends Operator {
-
-  protected SelectComponent selectComponent;
-  protected FromComponent fromComponent;
-  protected WhereComponent whereComponent;
-  protected SpecialClauseComponent specialClauseComponent;
-
-  protected Map<String, Object> props;
-  protected IndexType indexType;
-
-  protected boolean enableTracing;
-
-  Set<String> aliasSet;
-
-  public QueryOperator() {
-    super(SQLConstant.TOK_QUERY);
-    operatorType = Operator.OperatorType.QUERY;
-  }
-
-  public Set<String> getAliasSet() {
-    return aliasSet;
-  }
-
-  public SelectComponent getSelectComponent() {
-    return selectComponent;
-  }
-
-  public FromComponent getFromComponent() {
-    return fromComponent;
-  }
-
-  public void setFromComponent(FromComponent fromComponent) {
-    this.fromComponent = fromComponent;
-  }
-
-  public WhereComponent getWhereComponent() {
-    return whereComponent;
-  }
-
-  public void setWhereComponent(WhereComponent whereComponent) {
-    this.whereComponent = whereComponent;
-  }
-
-  public SpecialClauseComponent getSpecialClauseComponent() {
-    return specialClauseComponent;
-  }
-
-  public Map<String, Object> getProps() {
-    return props;
-  }
-
-  public void setProps(Map<String, Object> props) {
-    this.props = props;
-  }
-
-  public IndexType getIndexType() {
-    return indexType;
-  }
-
-  public boolean isAlignByDevice() {
-    return specialClauseComponent != null && specialClauseComponent.isAlignByDevice();
-  }
-
-  public boolean isGroupByLevel() {
-    return specialClauseComponent != null && specialClauseComponent.getLevels() != null;
-  }
-
-  public int[] getLevels() {
-    return specialClauseComponent.getLevels();
-  }
-
-  /** Reset sLimit and sOffset to zero. */
-  public void resetSLimitOffset() {
-    if (specialClauseComponent != null) {
-      specialClauseComponent.setSeriesLimit(0);
-      specialClauseComponent.setSeriesOffset(0);
-    }
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/SelectComponent.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/SelectComponent.java
deleted file mode 100644
index 2b4616278e..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/SelectComponent.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.qp.logical.crud;
-
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.mpp.plan.expression.ResultColumn;
-import org.apache.iotdb.db.mpp.plan.expression.leaf.TimeSeriesOperand;
-import org.apache.iotdb.db.mpp.plan.expression.multi.FunctionExpression;
-
-import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.List;
-
-/** this class maintains information from select clause. */
-public class SelectComponent {
-
-  private final ZoneId zoneId;
-
-  private boolean hasPlainAggregationFunction = false;
-  private boolean hasTimeSeriesGeneratingFunction = false;
-  private boolean hasUserDefinedAggregationFunction = false;
-
-  protected List<ResultColumn> resultColumns = new ArrayList<>();
-
-  private List<PartialPath> pathsCache;
-  private List<String> aggregationFunctionsCache;
-
-  /** init with tokenIntType, default operatorType is <code>OperatorType.SELECT</code>. */
-  public SelectComponent(ZoneId zoneId) {
-    this.zoneId = zoneId;
-  }
-
-  public SelectComponent(SelectComponent selectComponent) {
-    zoneId = selectComponent.zoneId;
-
-    hasPlainAggregationFunction = selectComponent.hasPlainAggregationFunction;
-    hasTimeSeriesGeneratingFunction = selectComponent.hasTimeSeriesGeneratingFunction;
-    hasUserDefinedAggregationFunction = selectComponent.hasUserDefinedAggregationFunction;
-
-    resultColumns.addAll(selectComponent.resultColumns);
-
-    pathsCache = null;
-    aggregationFunctionsCache = null;
-  }
-
-  public ZoneId getZoneId() {
-    return zoneId;
-  }
-
-  public void setHasPlainAggregationFunction(boolean hasPlainAggregationFunction) {
-    this.hasPlainAggregationFunction = hasPlainAggregationFunction;
-  }
-
-  public boolean hasPlainAggregationFunction() {
-    return hasPlainAggregationFunction;
-  }
-
-  public boolean hasTimeSeriesGeneratingFunction() {
-    return hasTimeSeriesGeneratingFunction;
-  }
-
-  public boolean hasUserDefinedAggregationFunction() {
-    return hasUserDefinedAggregationFunction;
-  }
-
-  public void addResultColumn(ResultColumn resultColumn) {
-    resultColumns.add(resultColumn);
-    if (resultColumn.getExpression().isUserDefinedAggregationFunctionExpression()) {
-      hasUserDefinedAggregationFunction = true;
-    }
-    if (resultColumn.getExpression().isBuiltInAggregationFunctionExpression()) {
-      hasPlainAggregationFunction = true;
-    }
-    if (resultColumn.getExpression().isTimeSeriesGeneratingFunctionExpression()) {
-      hasTimeSeriesGeneratingFunction = true;
-    }
-  }
-
-  public void setResultColumns(List<ResultColumn> resultColumns) {
-    this.resultColumns = resultColumns;
-
-    pathsCache = null;
-    aggregationFunctionsCache = null;
-  }
-
-  public List<ResultColumn> getResultColumns() {
-    return resultColumns;
-  }
-
-  public List<PartialPath> getPaths() {
-    if (pathsCache == null) {
-      pathsCache = new ArrayList<>();
-      for (ResultColumn resultColumn : resultColumns) {
-        Expression expression = resultColumn.getExpression();
-        if (expression instanceof TimeSeriesOperand) {
-          pathsCache.add(((TimeSeriesOperand) expression).getPath());
-        } else if (expression instanceof FunctionExpression
-            && expression.isBuiltInAggregationFunctionExpression()) {
-          pathsCache.add(((TimeSeriesOperand) expression.getExpressions().get(0)).getPath());
-        } else {
-          pathsCache.add(null);
-        }
-      }
-    }
-    return pathsCache;
-  }
-
-  public List<String> getAggregationFunctions() {
-    if (aggregationFunctionsCache == null) {
-      aggregationFunctionsCache = new ArrayList<>();
-      for (ResultColumn resultColumn : resultColumns) {
-        Expression expression = resultColumn.getExpression();
-        aggregationFunctionsCache.add(
-            expression instanceof FunctionExpression
-                ? ((FunctionExpression) resultColumn.getExpression()).getFunctionName()
-                : null);
-      }
-    }
-    return aggregationFunctionsCache;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/SpecialClauseComponent.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/SpecialClauseComponent.java
deleted file mode 100644
index f9b411a1b8..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/SpecialClauseComponent.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.qp.logical.crud;
-
-import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.qp.utils.GroupByLevelController;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SpecialClauseComponent {
-
-  protected int rowLimit = 0;
-  protected int rowOffset = 0;
-  protected int seriesLimit = 0;
-  protected int seriesOffset = 0;
-
-  protected boolean ascending = true;
-  // if true, we don't need the row whose any column is null
-  protected boolean withoutAnyNull;
-  // if true, we don't need the row whose all columns are null
-  protected boolean withoutAllNull;
-
-  protected List<Expression> withoutNullColumns = new ArrayList<>();
-
-  protected GroupByLevelController groupByLevelController;
-  protected int[] levels;
-
-  protected boolean isAlignByDevice = false;
-  protected boolean isAlignByTime = true;
-
-  public SpecialClauseComponent() {}
-
-  public void addWithoutNullColumn(Expression e) {
-    withoutNullColumns.add(e);
-  }
-
-  public List<Expression> getWithoutNullColumns() {
-    return withoutNullColumns;
-  }
-
-  public void setWithoutNullColumns(List<Expression> withoutNullColumns) {
-    this.withoutNullColumns = withoutNullColumns;
-  }
-
-  public int getRowLimit() {
-    return rowLimit;
-  }
-
-  public void setRowLimit(int rowLimit) {
-    this.rowLimit = rowLimit;
-  }
-
-  public int getRowOffset() {
-    return rowOffset;
-  }
-
-  public void setRowOffset(int rowOffset) {
-    this.rowOffset = rowOffset;
-  }
-
-  public boolean hasLimit() {
-    return rowLimit > 0;
-  }
-
-  public int getSeriesLimit() {
-    return seriesLimit;
-  }
-
-  public void setSeriesLimit(int seriesLimit) {
-    this.seriesLimit = seriesLimit;
-  }
-
-  public int getSeriesOffset() {
-    return seriesOffset;
-  }
-
-  public void setSeriesOffset(int seriesOffset) {
-    this.seriesOffset = seriesOffset;
-  }
-
-  public boolean hasSlimit() {
-    return seriesLimit > 0;
-  }
-
-  public boolean hasSoffset() {
-    return seriesOffset > 0;
-  }
-
-  public boolean isAscending() {
-    return ascending;
-  }
-
-  public void setAscending(boolean ascending) {
-    this.ascending = ascending;
-  }
-
-  public boolean isWithoutAnyNull() {
-    return withoutAnyNull;
-  }
-
-  public void setWithoutAnyNull(boolean withoutAnyNull) {
-    this.withoutAnyNull = withoutAnyNull;
-  }
-
-  public boolean isWithoutAllNull() {
-    return withoutAllNull;
-  }
-
-  public void setWithoutAllNull(boolean withoutAllNull) {
-    this.withoutAllNull = withoutAllNull;
-  }
-
-  public int[] getLevels() {
-    return levels;
-  }
-
-  public void setLevels(int[] levels) {
-    this.levels = levels;
-  }
-
-  public void setGroupByLevelController(GroupByLevelController groupByLevelController) {
-    this.groupByLevelController = groupByLevelController;
-  }
-
-  public GroupByLevelController getGroupByLevelController() {
-    return groupByLevelController;
-  }
-
-  public boolean isAlignByDevice() {
-    return isAlignByDevice;
-  }
-
-  public void setAlignByDevice(boolean isAlignByDevice) {
-    this.isAlignByDevice = isAlignByDevice;
-  }
-
-  public boolean isAlignByTime() {
-    return isAlignByTime;
-  }
-
-  public void setAlignByTime(boolean isAlignByTime) {
-    this.isAlignByTime = isAlignByTime;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/WhereComponent.java b/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/WhereComponent.java
deleted file mode 100644
index 3191d0020f..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/crud/WhereComponent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.iotdb.db.qp.logical.crud;
-
-public class WhereComponent {
-
-  private FilterOperator filterOperator;
-
-  public WhereComponent() {}
-
-  public WhereComponent(FilterOperator filterOperator) {
-    this.filterOperator = filterOperator;
-  }
-
-  public FilterOperator getFilterOperator() {
-    return filterOperator;
-  }
-
-  public void setFilterOperator(FilterOperator filterOperator) {
-    this.filterOperator = filterOperator;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/utils/GroupByLevelController.java b/server/src/main/java/org/apache/iotdb/db/qp/utils/GroupByLevelController.java
deleted file mode 100644
index aebc8ffe90..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/qp/utils/GroupByLevelController.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.qp.utils;
-
-import org.apache.iotdb.commons.conf.IoTDBConstant;
-import org.apache.iotdb.commons.path.MeasurementPath;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.db.exception.query.LogicalOptimizeException;
-import org.apache.iotdb.db.mpp.plan.expression.Expression;
-import org.apache.iotdb.db.mpp.plan.expression.ResultColumn;
-import org.apache.iotdb.db.mpp.plan.expression.multi.FunctionExpression;
-import org.apache.iotdb.db.qp.logical.crud.QueryOperator;
-import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This class is used to control the row number of group by level query. For example, selected
- * series[root.sg.d1.s1, root.sg.d2.s1, root.sg2.d1.s1], level = 1; the result rows will be
- * [root.sg.*.s1, root.sg2.*.s1], sLimit and sOffset will be used to control the result numbers
- * rather than the selected series.
- */
-public class GroupByLevelController {
-
-  public static String ALIAS_ERROR_MESSAGE1 =
-      "alias '%s' can only be matched with one result column";
-  public static String ALIAS_ERROR_MESSAGE2 = "Result column %s with more than one alias[%s, %s]";
-  private final int seriesLimit;
-  private int seriesOffset;
-  Set<String> limitPaths;
-  Set<String> offsetPaths;
-  private final int[] levels;
-  int prevSize = 0;
-  /** count(root.sg.d1.s1) with level = 1 -> count(root.*.d1.s1) */
-  private Map<String, String> groupedPathMap;
-  /** count(root.*.d1.s1) -> alias */
-  private Map<String, String> columnToAliasMap;
-  /**
-   * Only used to check whether one alisa is corresponding to only one column. i.e. Different
-   * columns can't have the same alias.
-   */
-  private Map<String, String> aliasToColumnMap;
-
-  public GroupByLevelController(int seriesLimit, int[] levels) {
-    this.seriesLimit = seriesLimit;
-    this.levels = levels;
-  }
-
-  public GroupByLevelController(QueryOperator operator) {
-    this.seriesLimit = operator.getSpecialClauseComponent().getSeriesLimit();
-    this.seriesOffset = operator.getSpecialClauseComponent().getSeriesOffset();
-    this.limitPaths = seriesLimit > 0 ? new HashSet<>() : null;
-    this.offsetPaths = seriesOffset > 0 ? new HashSet<>() : null;
-    this.groupedPathMap = new LinkedHashMap<>();
-    this.levels = operator.getLevels();
-  }
-
-  public String getGroupedPath(String rawPath) {
-    return groupedPathMap.get(rawPath);
-  }
-
-  public String getAlias(String originName) {
-    return columnToAliasMap != null && columnToAliasMap.get(originName) != null
-        ? columnToAliasMap.get(originName)
-        : null;
-  }
-
-  public void control(ResultColumn rawColumn, List<ResultColumn> resultColumns)
-      throws LogicalOptimizeException {
-    Set<Integer> countWildcardIterIndices = getCountStarIndices(rawColumn);
-
-    // `resultColumns` includes all result columns after removing wildcards, so we need to skip
-    // those we have processed
-    Iterator<ResultColumn> iterator = resultColumns.iterator();
-    for (int i = 0; i < prevSize; i++) {
-      iterator.next();
-    }
-
-    while (iterator.hasNext()) {
-      ResultColumn resultColumn = iterator.next();
-      Expression rootExpression = resultColumn.getExpression();
-      boolean hasAggregation = false;
-      int idx = 0;
-      for (Iterator<Expression> it = rootExpression.iterator(); it.hasNext(); ) {
-        Expression expression = it.next();
-        if (expression instanceof FunctionExpression
-            && expression.isBuiltInAggregationFunctionExpression()) {
-          hasAggregation = true;
-          List<PartialPath> paths = ((FunctionExpression) expression).getPaths();
-          String functionName = ((FunctionExpression) expression).getFunctionName();
-          boolean isCountStar = countWildcardIterIndices.contains(idx++);
-          String groupedPath = generatePartialPathByLevel(isCountStar, paths.get(0), levels);
-          String rawPath = String.format("%s(%s)", functionName, paths.get(0).getFullPath());
-          String pathWithFunction = String.format("%s(%s)", functionName, groupedPath);
-
-          if (seriesLimit == 0 && seriesOffset == 0) {
-            groupedPathMap.put(rawPath, pathWithFunction);
-            checkAliasAndUpdateAliasMap(rawColumn, pathWithFunction);
-          } else {
-            // We cannot judge whether the path after grouping exists until we add it to set
-            if (seriesOffset > 0 && offsetPaths != null) {
-              offsetPaths.add(pathWithFunction);
-              if (offsetPaths.size() <= seriesOffset) {
-                iterator.remove();
-                if (offsetPaths.size() == seriesOffset) {
-                  seriesOffset = 0;
-                }
-              }
-            } else if (offsetPaths == null || !offsetPaths.contains(pathWithFunction)) {
-              limitPaths.add(pathWithFunction);
-              if (seriesLimit > 0 && limitPaths.size() > seriesLimit) {
-                iterator.remove();
-                limitPaths.remove(pathWithFunction);
-              } else {
-                groupedPathMap.put(rawPath, pathWithFunction);
-                checkAliasAndUpdateAliasMap(rawColumn, pathWithFunction);
-              }
-            } else {
-              iterator.remove();
-            }
-          }
-        }
-      }
-      if (!hasAggregation) {
-        throw new LogicalOptimizeException(rootExpression + " can't be used in group by level.");
-      }
-    }
-    prevSize = resultColumns.size();
-  }
-
-  // As one expression may have many aggregation results in the tree leaf, here we should traverse
-  // all the successor expressions and record the count(*) indices
-  private Set<Integer> getCountStarIndices(ResultColumn rawColumn) {
-    Set<Integer> countWildcardIterIndices = new HashSet<>();
-    int idx = 0;
-    for (Iterator<Expression> it = rawColumn.getExpression().iterator(); it.hasNext(); ) {
-      Expression expression = it.next();
-      if (expression instanceof FunctionExpression
-          && expression.isBuiltInAggregationFunctionExpression()
-          && ((FunctionExpression) expression).isCountStar()) {
-        countWildcardIterIndices.add(idx);
-      }
-      idx++;
-    }
-    return countWildcardIterIndices;
-  }
-
-  private void checkAliasAndUpdateAliasMap(ResultColumn rawColumn, String originName)
-      throws LogicalOptimizeException {
-    if (!rawColumn.hasAlias()) {
-      return;
-    } else if (columnToAliasMap == null) {
-      columnToAliasMap = new HashMap<>();
-      aliasToColumnMap = new HashMap<>();
-    }
-    // If an alias is corresponding to more than one result column, throw an exception
-    if (columnToAliasMap.get(originName) == null) {
-      if (aliasToColumnMap.get(rawColumn.getAlias()) != null) {
-        throw new LogicalOptimizeException(
-            String.format(ALIAS_ERROR_MESSAGE1, rawColumn.getAlias()));
-      } else {
-        columnToAliasMap.put(originName, rawColumn.getAlias());
-        aliasToColumnMap.put(rawColumn.getAlias(), originName);
-      }
-      // If a result column is corresponding to more than one alias, throw an exception
-    } else if (!columnToAliasMap.get(originName).equals(rawColumn.getAlias())) {
-      throw new LogicalOptimizeException(
-          String.format(
-              ALIAS_ERROR_MESSAGE2,
-              originName,
-              columnToAliasMap.get(originName),
-              rawColumn.getAlias()));
-    }
-  }
-
-  /**
-   * Transform an originalPath to a partial path that satisfies given level. Path nodes don't
-   * satisfy the given level will be replaced by "*" except the sensor level, e.g.
-   * generatePartialPathByLevel("root.sg.dh.d1.s1", 2) will return "root.*.dh.*.s1".
-   *
-   * <p>Especially, if count(*), then the sensor level will be replaced by "*" too.
-   *
-   * @return result partial path
-   */
-  public String generatePartialPathByLevel(
-      boolean isCountStar, PartialPath rawPath, int[] pathLevels) {
-    String[] nodes = rawPath.getNodes();
-    Set<Integer> levelSet = new HashSet<>();
-    for (int level : pathLevels) {
-      levelSet.add(level);
-    }
-
-    List<String> transformedNodes = new ArrayList<>(nodes.length);
-
-    transformedNodes.add(nodes[0]);
-    for (int k = 1; k < nodes.length - 1; k++) {
-      if (levelSet.contains(k)) {
-        transformedNodes.add(nodes[k]);
-      } else {
-        transformedNodes.add(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD);
-      }
-    }
-    if (isCountStar) {
-      transformedNodes.add(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD);
-    } else {
-      transformedNodes.add(nodes[nodes.length - 1]);
-    }
-
-    MeasurementPath groupedPath =
-        new MeasurementPath(
-            new PartialPath(transformedNodes.toArray(new String[0])),
-            ((MeasurementPath) rawPath).getMeasurementSchema());
-    if (rawPath.isMeasurementAliasExists()) {
-      groupedPath.setMeasurementAlias(rawPath.getMeasurementAlias());
-      return groupedPath.getFullPathWithAlias();
-    }
-    return groupedPath.getFullPath();
-  }
-
-  public void serialize(ByteBuffer byteBuffer) {
-    ReadWriteIOUtils.write(seriesLimit, byteBuffer);
-    ReadWriteIOUtils.write(seriesOffset, byteBuffer);
-    if (limitPaths == null) {
-      ReadWriteIOUtils.write(-1, byteBuffer);
-    } else {
-      ReadWriteIOUtils.write(limitPaths.size(), byteBuffer);
-      for (String limitPath : limitPaths) {
-        ReadWriteIOUtils.write(limitPath, byteBuffer);
-      }
-    }
-
-    if (offsetPaths == null) {
-      ReadWriteIOUtils.write(-1, byteBuffer);
-    } else {
-      ReadWriteIOUtils.write(offsetPaths.size(), byteBuffer);
-      for (String offsetPath : offsetPaths) {
-        ReadWriteIOUtils.write(offsetPath, byteBuffer);
-      }
-    }
-
-    if (levels == null) {
-      ReadWriteIOUtils.write(-1, byteBuffer);
-    } else {
-      ReadWriteIOUtils.write(levels.length, byteBuffer);
-      for (int level : levels) {
-        ReadWriteIOUtils.write(level, byteBuffer);
-      }
-    }
-
-    ReadWriteIOUtils.write(prevSize, byteBuffer);
-    ReadWriteIOUtils.write(groupedPathMap, byteBuffer);
-    ReadWriteIOUtils.write(columnToAliasMap, byteBuffer);
-    ReadWriteIOUtils.write(aliasToColumnMap, byteBuffer);
-  }
-
-  public static GroupByLevelController deserialize(ByteBuffer byteBuffer) {
-    int seriesLimit = ReadWriteIOUtils.readInt(byteBuffer);
-    int seriesOffset = ReadWriteIOUtils.readInt(byteBuffer);
-    int limitPathSize = ReadWriteIOUtils.readInt(byteBuffer);
-    Set<String> limitPaths = null;
-    if (limitPathSize != -1) {
-      limitPaths = new HashSet<>();
-      for (int i = 0; i < limitPathSize; i++) {
-        limitPaths.add(ReadWriteIOUtils.readString(byteBuffer));
-      }
-    }
-
-    int offsetPathSize = ReadWriteIOUtils.readInt(byteBuffer);
-    Set<String> offsetPaths = null;
-    if (offsetPathSize != -1) {
-      offsetPaths = new HashSet<>();
-      for (int i = 0; i < offsetPathSize; i++) {
-        offsetPaths.add(ReadWriteIOUtils.readString(byteBuffer));
-      }
-    }
-
-    int levelSize = ReadWriteIOUtils.readInt(byteBuffer);
-    int[] levels = null;
-    if (levelSize != -1) {
-      levels = new int[levelSize];
-      for (int i = 0; i < levelSize; i++) {
-        levels[i] = ReadWriteIOUtils.readInt(byteBuffer);
-      }
-    }
-
-    int prevSize = ReadWriteIOUtils.readInt(byteBuffer);
-    Map<String, String> groupedPathMap = ReadWriteIOUtils.readMap(byteBuffer);
-    Map<String, String> columnToAliasMap = ReadWriteIOUtils.readMap(byteBuffer);
-    Map<String, String> aliasToColumnMap = ReadWriteIOUtils.readMap(byteBuffer);
-
-    GroupByLevelController groupByLevelController = new GroupByLevelController(seriesLimit, levels);
-    groupByLevelController.limitPaths = limitPaths;
-    groupByLevelController.aliasToColumnMap = aliasToColumnMap;
-    groupByLevelController.columnToAliasMap = columnToAliasMap;
-    groupByLevelController.groupedPathMap = groupedPathMap;
-    groupByLevelController.offsetPaths = offsetPaths;
-    groupByLevelController.prevSize = prevSize;
-    groupByLevelController.seriesOffset = seriesOffset;
-
-    return groupByLevelController;
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/query/control/QueryResourceManager.java b/server/src/main/java/org/apache/iotdb/db/query/control/QueryResourceManager.java
index 0934f3fd10..d6ea3cb31c 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/control/QueryResourceManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/control/QueryResourceManager.java
@@ -18,11 +18,8 @@
  */
 package org.apache.iotdb.db.query.control;
 
-import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
 import org.apache.iotdb.db.service.TemporaryQueryDataFileService;
 
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
 /**
@@ -40,16 +37,8 @@ public class QueryResourceManager {
   private final AtomicLong queryIdAtom = new AtomicLong();
   private final QueryFileManager filePathsManager;
 
-  /**
-   * Record QueryDataSource used in queries
-   *
-   * <p>Key: query job id. Value: QueryDataSource corresponding to each data region.
-   */
-  private final Map<Long, Map<String, QueryDataSource>> cachedQueryDataSourcesMap;
-
   private QueryResourceManager() {
     filePathsManager = new QueryFileManager();
-    cachedQueryDataSourcesMap = new ConcurrentHashMap<>();
   }
 
   public static QueryResourceManager getInstance() {
@@ -86,9 +75,6 @@ public class QueryResourceManager {
 
     // close and delete UDF temp files
     TemporaryQueryDataFileService.getInstance().deregister(queryId);
-
-    // remove cached QueryDataSource
-    cachedQueryDataSourcesMap.remove(queryId);
   }
 
   public QueryFileManager getQueryFileManager() {
diff --git a/server/src/main/java/org/apache/iotdb/db/query/filter/TsFileFilter.java b/server/src/main/java/org/apache/iotdb/db/query/filter/TsFileFilter.java
deleted file mode 100644
index 97711ef3b2..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/query/filter/TsFileFilter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.query.filter;
-
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-
-/**
- * TsFileFilter is used to filter unwanted TsFiles in a QueryDataSource, to better support data
- * partitioning in the distributed version and other features.
- */
-@FunctionalInterface
-public interface TsFileFilter {
-  boolean fileNotSatisfy(TsFileResource resource);
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/query/reader/series/AlignedSeriesReader.java b/server/src/main/java/org/apache/iotdb/db/query/reader/series/AlignedSeriesReader.java
deleted file mode 100644
index f3689b0a50..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/query/reader/series/AlignedSeriesReader.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.query.reader.series;
-
-import org.apache.iotdb.commons.path.AlignedPath;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.commons.utils.TestOnly;
-import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.query.filter.TsFileFilter;
-import org.apache.iotdb.db.query.reader.universal.AlignedDescPriorityMergeReader;
-import org.apache.iotdb.db.query.reader.universal.AlignedPriorityMergeReader;
-import org.apache.iotdb.db.query.reader.universal.DescPriorityMergeReader;
-import org.apache.iotdb.db.query.reader.universal.PriorityMergeReader;
-import org.apache.iotdb.db.utils.FileLoaderUtils;
-import org.apache.iotdb.tsfile.file.metadata.AlignedTimeSeriesMetadata;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.filter.basic.Filter;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-
-public class AlignedSeriesReader extends SeriesReader {
-
-  public AlignedSeriesReader(
-      PartialPath seriesPath,
-      Set<String> allSensors,
-      TSDataType dataType,
-      QueryContext context,
-      QueryDataSource dataSource,
-      Filter timeFilter,
-      Filter valueFilter,
-      TsFileFilter fileFilter,
-      boolean ascending) {
-    super(
-        seriesPath,
-        allSensors,
-        dataType,
-        context,
-        dataSource,
-        timeFilter,
-        valueFilter,
-        fileFilter,
-        ascending);
-  }
-
-  @TestOnly
-  public AlignedSeriesReader(
-      PartialPath seriesPath,
-      Set<String> allSensors,
-      TSDataType dataType,
-      QueryContext context,
-      List<TsFileResource> seqFileResource,
-      List<TsFileResource> unseqFileResource,
-      Filter timeFilter,
-      Filter valueFilter,
-      boolean ascending) {
-    super(
-        seriesPath,
-        allSensors,
-        dataType,
-        context,
-        seqFileResource,
-        unseqFileResource,
-        timeFilter,
-        valueFilter,
-        ascending);
-  }
-
-  @Override
-  protected PriorityMergeReader getPriorityMergeReader() {
-    return new AlignedPriorityMergeReader();
-  }
-
-  @Override
-  protected DescPriorityMergeReader getDescPriorityMergeReader() {
-    return new AlignedDescPriorityMergeReader();
-  }
-
-  @Override
-  protected AlignedTimeSeriesMetadata loadTimeSeriesMetadata(
-      TsFileResource resource,
-      PartialPath seriesPath,
-      QueryContext context,
-      Filter filter,
-      Set<String> allSensors)
-      throws IOException {
-    return FileLoaderUtils.loadTimeSeriesMetadata(
-        resource, (AlignedPath) seriesPath, context, filter);
-  }
-}
diff --git a/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesRawDataBatchReader.java b/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesRawDataBatchReader.java
deleted file mode 100644
index 7435ad39d0..0000000000
--- a/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesRawDataBatchReader.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.query.reader.series;
-
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.commons.utils.TestOnly;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.metadata.utils.ResourceByPathUtils;
-import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.BatchData;
-import org.apache.iotdb.tsfile.read.filter.basic.Filter;
-import org.apache.iotdb.tsfile.read.reader.IBatchReader;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class SeriesRawDataBatchReader implements IBatchReader {
-
-  private final SeriesReader seriesReader;
-
-  private BatchData batchData;
-  private boolean hasCachedBatchData = false;
-
-  @TestOnly
-  @SuppressWarnings("squid:S107")
-  public SeriesRawDataBatchReader(
-      PartialPath seriesPath,
-      TSDataType dataType,
-      QueryContext context,
-      List<TsFileResource> seqFileResource,
-      List<TsFileResource> unseqFileResource,
-      Filter timeFilter,
-      Filter valueFilter,
-      boolean ascending) {
-    Set<String> allSensors = new HashSet<>();
... 5013 lines suppressed ...