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/23 08:53:43 UTC

[iotdb] 01/03: tmp save

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

hui pushed a commit to branch lmh/removeOldCode
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 404181c122c6d23e8e6b1e1a334fd3db0ab565e7
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Fri Dec 23 15:43:38 2022 +0800

    tmp save
---
 .../main/java/org/apache/iotdb/tool/ImportCsv.java |   2 +-
 .../org/apache/iotdb/db/conf/IoTDBDescriptor.java  |   2 +-
 .../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  |   6 -
 .../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 --
 .../iotdb/db/index/common/IndexConstant.java       |  36 ---
 .../apache/iotdb/db/index/common/IndexType.java    |  78 -----
 .../apache/iotdb/db/index/common/IndexUtils.java   |  35 --
 .../db/metadata/utils/ResourceByPathUtils.java     |  88 -----
 .../timerangeiterator/AggrWindowIterator.java      |   4 +-
 .../TimeRangeIteratorFactory.java                  |   2 +-
 .../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  |  10 +-
 .../execution/config/sys/sync/ShowPipeTask.java    |   2 +-
 .../iotdb/db/mpp/plan/parser/ASTVisitor.java       | 118 +++----
 .../plan/parser}/SQLParseError.java                |   2 +-
 .../db/mpp/plan/parser/StatementGenerator.java     |   1 -
 .../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 ------
 .../protocol/influxdb/input/InfluxLineParser.java  |   2 +-
 .../influxdb/sql/InfluxDBLogicalGenerator.java     |   2 +-
 .../protocol/influxdb/sql/InfluxDBSqlVisitor.java  |   2 +-
 .../db/protocol/rest/handler/ExceptionHandler.java |   3 +-
 .../apache/iotdb/db/qp/constant/SQLConstant.java   | 216 -------------
 .../org/apache/iotdb/db/qp/logical/Operator.java   |  21 --
 .../db/qp/logical/crud/BasicFunctionOperator.java  |   6 +-
 .../db/qp/logical/crud/BasicOperatorType.java      |   6 +-
 .../iotdb/db/qp/logical/crud/QueryOperator.java    |  31 --
 .../iotdb/db/qp/utils/GroupByLevelController.java  |  27 +-
 .../apache/iotdb/db/query/filter/TsFileFilter.java |  31 --
 .../query/reader/series/AlignedSeriesReader.java   |  24 --
 .../reader/series/SeriesRawDataBatchReader.java    |   1 -
 .../iotdb/db/query/reader/series/SeriesReader.java |  57 +---
 .../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      |   2 +-
 .../iotdb/db/{qp => }/utils/DateTimeUtils.java     |   2 +-
 .../apache/iotdb/db/utils/ErrorHandlingUtils.java  |   4 -
 .../timerangeiterator/AggrWindowIterator.java      |   4 +-
 .../TimeRangeIteratorFactory.java                  |   2 +-
 .../FastCrossCompactionPerformerTest.java          |  71 +++--
 .../ReadPointCompactionPerformerTest.java          |  63 ++--
 ...eCrossSpaceCompactionWithFastPerformerTest.java |  42 ++-
 .../inner/InnerCompactionMoreDataTest.java         |  28 +-
 .../compaction/utils/CompactionCheckerUtils.java   |  24 +-
 .../iotdb/db/engine/storagegroup/TTLTest.java      |  31 +-
 .../db/qp/utils/DatetimeQueryDataSetUtilsTest.java |   2 +
 .../apache/iotdb/db/utils/EnvironmentUtils.java    |   3 +
 69 files changed, 219 insertions(+), 3092 deletions(-)

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 71b14915a6..d20923b5c7 100644
--- a/cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
+++ b/cli/src/main/java/org/apache/iotdb/tool/ImportCsv.java
@@ -23,7 +23,7 @@ import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.utils.PathUtils;
 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.rpc.IoTDBConnectionException;
 import org.apache.iotdb.rpc.StatementExecutionException;
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/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
index 5a52ce6b02..a6afc8a4b4 100644
--- 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
@@ -28,12 +28,6 @@ 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());
   }
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/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/metadata/utils/ResourceByPathUtils.java b/server/src/main/java/org/apache/iotdb/db/metadata/utils/ResourceByPathUtils.java
index f13b173bce..00c04840e8 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
@@ -31,14 +31,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;
@@ -83,16 +81,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,
@@ -104,12 +92,6 @@ public abstract class ResourceByPathUtils {
       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,28 +126,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(
@@ -189,19 +149,6 @@ class AlignedResourceByPathUtils extends ResourceByPathUtils {
         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,28 +345,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(
@@ -444,19 +369,6 @@ class MeasurementResourceByPathUtils extends ResourceByPathUtils {
         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/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..6f79bec51d 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
@@ -70,7 +70,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
@@ -1255,7 +1255,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 +1268,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 +1371,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 +1384,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/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/parser/ASTVisitor.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/ASTVisitor.java
index e5ed00bc24..b49945e206 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,10 +31,7 @@ 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.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;
@@ -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;
 
@@ -271,7 +267,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       if (ctx.attributeKey() != null) {
         if (!parseAttributeKey(ctx.attributeKey())
             .equalsIgnoreCase(IoTDBConstant.COLUMN_TIMESERIES_DATATYPE)) {
-          throw new SQLParserException("expecting datatype");
+          throw new SemanticException("expecting datatype");
         }
       }
       props.put(
@@ -372,7 +368,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       if (ctx.attributeKey() != null) {
         if (!parseAttributeKey(ctx.attributeKey())
             .equalsIgnoreCase(IoTDBConstant.COLUMN_TIMESERIES_DATATYPE)) {
-          throw new SQLParserException("expecting datatype");
+          throw new SemanticException("expecting datatype");
         }
       }
       String dataTypeString = ctx.dataType.getText().toUpperCase();
@@ -435,7 +431,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) {
@@ -731,7 +727,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;
   }
@@ -957,7 +953,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 +1256,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 operand: " + text);
     }
   }
 
@@ -1421,7 +1417,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       }
       return loadTsFileStatement;
     } catch (FileNotFoundException e) {
-      throw new SQLParserException(e.getMessage());
+      throw new SemanticException(e.getMessage());
     }
   }
 
@@ -1441,7 +1437,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 +1464,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 +1574,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 +1583,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,7 +1592,7 @@ 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");
     }
@@ -1607,7 +1602,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     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,7 +1611,7 @@ 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");
     }
@@ -1626,7 +1621,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
     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 +1688,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 +1835,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 +2242,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
@@ -2328,7 +2323,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 +2376,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 +2426,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,7 +2651,7 @@ 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;
@@ -2688,7 +2659,7 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
       if (ctx.attributeKey() != null) {
         if (!parseAttributeKey(ctx.attributeKey())
             .equalsIgnoreCase(IoTDBConstant.COLUMN_TIMESERIES_DATATYPE)) {
-          throw new SQLParserException("expecting datatype");
+          throw new SemanticException("expecting datatype");
         }
       }
       String dataTypeString = ctx.dataType.getText().toUpperCase();
@@ -2751,15 +2722,15 @@ 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.");
     }
   }
 
@@ -2865,34 +2836,33 @@ public class ASTVisitor extends IoTDBSqlParserBaseVisitor<Statement> {
   }
 
   private void parseSelectStatementForPipe(
-      IoTDBSqlParser.SelectStatementContext ctx, CreatePipeStatement statement)
-      throws SQLParserException {
+      IoTDBSqlParser.SelectStatementContext ctx, CreatePipeStatement statement) {
     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("Not support for this sql 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("Not support for this sql 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("Not support for this sql 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("Not support for this sql in pipe.");
     }
 
     // parse where
@@ -2902,19 +2872,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("Not support for this sql 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.");
+        throw new SemanticException("Not support for this sql in pipe.");
       }
       if (!(right instanceof ConstantOperand)) {
-        throw new SQLParserException("Not support for this sql in pipe.");
+        throw new SemanticException("Not support for this sql in pipe.");
       }
       if (((ConstantOperand) right).getDataType() != TSDataType.INT64) {
-        throw new SQLParserException("Not support for this sql in pipe.");
+        throw new SemanticException("Not support for this sql in pipe.");
       }
       long startTime = Long.parseLong(((ConstantOperand) right).getValueString());
       statement.setStartTime(startTime);
@@ -2933,7 +2903,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 +2911,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 +2932,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 +2944,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 +2957,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 +2986,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 +3013,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 98%
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..2104b407a8 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,7 @@
  * 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;
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..4a1b97e4fc 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
@@ -60,7 +60,6 @@ import org.apache.iotdb.db.mpp.plan.statement.metadata.template.UnsetSchemaTempl
 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;
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/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/sql/InfluxDBLogicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/protocol/influxdb/sql/InfluxDBLogicalGenerator.java
index 361d105e4e..49935064df 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/sql/InfluxDBLogicalGenerator.java
@@ -18,10 +18,10 @@
  */
 package org.apache.iotdb.db.protocol.influxdb.sql;
 
+import org.apache.iotdb.db.mpp.plan.parser.SQLParseError;
 import org.apache.iotdb.db.qp.logical.Operator;
 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;
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
index 6136ac99ee..009e8bb5cd 100644
--- 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
@@ -40,7 +40,7 @@ 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;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 
 public class InfluxDBSqlVisitor extends InfluxDBSqlParserBaseVisitor<Operator> {
 
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/qp/constant/SQLConstant.java b/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
index 399566525b..c9acbe57a7 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/constant/SQLConstant.java
@@ -20,10 +20,6 @@ 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 {
@@ -36,15 +32,10 @@ public class SQLConstant {
   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";
@@ -66,220 +57,13 @@ public class SQLConstant {
 
   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
index 6efdf010ed..b1ac2c396a 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/logical/Operator.java
@@ -18,8 +18,6 @@
  */
 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 {
 
@@ -30,12 +28,6 @@ public abstract class Operator {
 
   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;
@@ -49,10 +41,6 @@ public abstract class Operator {
     return operatorType == OperatorType.QUERY;
   }
 
-  public int getTokenIntType() {
-    return tokenIntType;
-  }
-
   public void setOperatorType(OperatorType operatorType) {
     this.operatorType = operatorType;
   }
@@ -65,15 +53,6 @@ public abstract class Operator {
     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,
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
index dd992c969a..17701e54c4 100644
--- 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
@@ -21,7 +21,6 @@ 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;
@@ -51,8 +50,7 @@ public class BasicFunctionOperator extends FunctionOperator {
    * @param value value
    * @throws LogicalOperatorException Logical Operator Exception
    */
-  public BasicFunctionOperator(FilterType filterType, PartialPath path, String value)
-      throws SQLParserException {
+  public BasicFunctionOperator(FilterType filterType, PartialPath path, String value) {
     super(filterType);
     funcToken = BasicOperatorType.getBasicOpBySymbol(filterType);
     this.singlePath = path;
@@ -136,7 +134,7 @@ public class BasicFunctionOperator extends FunctionOperator {
     BasicFunctionOperator ret;
     try {
       ret = new BasicFunctionOperator(this.filterType, singlePath.clone(), value);
-    } catch (SQLParserException e) {
+    } catch (Exception e) {
       logger.error("error copy:", e);
       return null;
     }
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
index fdde4558a9..169ad30b0c 100644
--- 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
@@ -19,7 +19,6 @@
 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;
@@ -162,8 +161,7 @@ public enum BasicOperatorType {
    * @return basic operator type
    * @throws LogicalOperatorException Logical Operator Exception
    */
-  public static BasicOperatorType getBasicOpBySymbol(FilterType filterType)
-      throws SQLParserException {
+  public static BasicOperatorType getBasicOpBySymbol(FilterType filterType) {
     switch (filterType) {
       case EQUAL:
         return EQ;
@@ -178,7 +176,7 @@ public enum BasicOperatorType {
       case NOTEQUAL:
         return NOTEQUAL;
       default:
-        throw new SQLParserException(
+        throw new IllegalArgumentException(
             "unsupported type:{}" + FilterConstant.filterNames.get(filterType));
     }
   }
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
index 65a27dcf65..7b872fa4b5 100644
--- 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
@@ -18,12 +18,10 @@
  */
 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 {
 
@@ -33,21 +31,12 @@ public class QueryOperator extends Operator {
   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;
   }
@@ -80,27 +69,7 @@ public class QueryOperator extends Operator {
     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/utils/GroupByLevelController.java b/server/src/main/java/org/apache/iotdb/db/qp/utils/GroupByLevelController.java
index aebc8ffe90..7a3fc1b9f4 100644
--- 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
@@ -22,11 +22,10 @@ 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.exception.query.LogicalOperatorException;
 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;
@@ -34,7 +33,6 @@ 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;
@@ -71,19 +69,6 @@ public class GroupByLevelController {
     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)
@@ -91,7 +76,7 @@ public class GroupByLevelController {
   }
 
   public void control(ResultColumn rawColumn, List<ResultColumn> resultColumns)
-      throws LogicalOptimizeException {
+      throws LogicalOperatorException {
     Set<Integer> countWildcardIterIndices = getCountStarIndices(rawColumn);
 
     // `resultColumns` includes all result columns after removing wildcards, so we need to skip
@@ -147,7 +132,7 @@ public class GroupByLevelController {
         }
       }
       if (!hasAggregation) {
-        throw new LogicalOptimizeException(rootExpression + " can't be used in group by level.");
+        throw new LogicalOperatorException(rootExpression + " can't be used in group by level.");
       }
     }
     prevSize = resultColumns.size();
@@ -171,7 +156,7 @@ public class GroupByLevelController {
   }
 
   private void checkAliasAndUpdateAliasMap(ResultColumn rawColumn, String originName)
-      throws LogicalOptimizeException {
+      throws LogicalOperatorException {
     if (!rawColumn.hasAlias()) {
       return;
     } else if (columnToAliasMap == null) {
@@ -181,7 +166,7 @@ public class GroupByLevelController {
     // 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(
+        throw new LogicalOperatorException(
             String.format(ALIAS_ERROR_MESSAGE1, rawColumn.getAlias()));
       } else {
         columnToAliasMap.put(originName, rawColumn.getAlias());
@@ -189,7 +174,7 @@ public class GroupByLevelController {
       }
       // 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(
+      throw new LogicalOperatorException(
           String.format(
               ALIAS_ERROR_MESSAGE2,
               originName,
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
index f3689b0a50..2fdeb8d36d 100644
--- 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
@@ -21,10 +21,8 @@ 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;
@@ -40,28 +38,6 @@ 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,
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
index 7435ad39d0..6aee37c213 100644
--- 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
@@ -41,7 +41,6 @@ public class SeriesRawDataBatchReader implements IBatchReader {
   private boolean hasCachedBatchData = false;
 
   @TestOnly
-  @SuppressWarnings("squid:S107")
   public SeriesRawDataBatchReader(
       PartialPath seriesPath,
       TSDataType dataType,
diff --git a/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java b/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java
index 4084bffb63..6cf2559349 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/reader/series/SeriesReader.java
@@ -24,7 +24,6 @@ import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.metadata.idtable.IDTable;
 import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.query.filter.TsFileFilter;
 import org.apache.iotdb.db.query.reader.universal.DescPriorityMergeReader;
 import org.apache.iotdb.db.query.reader.universal.PriorityMergeReader;
 import org.apache.iotdb.db.query.reader.universal.PriorityMergeReader.MergeReaderPriority;
@@ -77,7 +76,6 @@ public class SeriesReader {
    */
   protected final Filter timeFilter;
   protected final Filter valueFilter;
-  protected final TsFileFilter fileFilter;
 
   protected final QueryDataSource dataSource;
 
@@ -124,52 +122,7 @@ public class SeriesReader {
    *     measurementList.
    * @param allSensors For querying aligned series, allSensors are not used.
    */
-  public SeriesReader(
-      PartialPath seriesPath,
-      Set<String> allSensors,
-      TSDataType dataType,
-      QueryContext context,
-      QueryDataSource dataSource,
-      Filter timeFilter,
-      Filter valueFilter,
-      TsFileFilter fileFilter,
-      boolean ascending) {
-    this.seriesPath = IDTable.translateQueryPath(seriesPath);
-    this.allSensors = allSensors;
-    this.dataType = dataType;
-    this.context = context;
-    this.dataSource = dataSource;
-    this.timeFilter = timeFilter;
-    this.valueFilter = valueFilter;
-    this.fileFilter = fileFilter;
-    if (ascending) {
-      this.orderUtils = new AscTimeOrderUtils();
-      mergeReader = getPriorityMergeReader();
-      this.curSeqFileIndex = 0;
-      this.curUnseqFileIndex = 0;
-    } else {
-      this.orderUtils = new DescTimeOrderUtils();
-      mergeReader = getDescPriorityMergeReader();
-      this.curSeqFileIndex = dataSource.getSeqResourcesSize() - 1;
-      this.curUnseqFileIndex = 0;
-    }
-
-    unSeqTimeSeriesMetadata =
-        new PriorityQueue<>(
-            orderUtils.comparingLong(
-                timeSeriesMetadata -> orderUtils.getOrderTime(timeSeriesMetadata.getStatistics())));
-    cachedChunkMetadata =
-        new PriorityQueue<>(
-            orderUtils.comparingLong(
-                chunkMetadata -> orderUtils.getOrderTime(chunkMetadata.getStatistics())));
-    unSeqPageReaders =
-        new PriorityQueue<>(
-            orderUtils.comparingLong(
-                versionPageReader -> orderUtils.getOrderTime(versionPageReader.getStatistics())));
-  }
-
   @TestOnly
-  @SuppressWarnings("squid:S107")
   public SeriesReader(
       PartialPath seriesPath,
       Set<String> allSensors,
@@ -188,7 +141,7 @@ public class SeriesReader {
     QueryUtils.fillOrderIndexes(dataSource, seriesPath.getDevice(), ascending);
     this.timeFilter = timeFilter;
     this.valueFilter = valueFilter;
-    this.fileFilter = null;
+
     if (ascending) {
       this.orderUtils = new AscTimeOrderUtils();
       mergeReader = getPriorityMergeReader();
@@ -1265,7 +1218,7 @@ public class SeriesReader {
         TsFileResource tsFileResource = dataSource.getSeqResourceByIndex(curSeqFileIndex);
         if (tsFileResource != null
             && tsFileResource.isSatisfied(
-                seriesPath.getDevice(), timeFilter, fileFilter, true, context.isDebug())) {
+                seriesPath.getDevice(), timeFilter, true, context.isDebug())) {
           break;
         }
         curSeqFileIndex--;
@@ -1279,7 +1232,7 @@ public class SeriesReader {
         TsFileResource tsFileResource = dataSource.getUnseqResourceByIndex(curUnseqFileIndex);
         if (tsFileResource != null
             && tsFileResource.isSatisfied(
-                seriesPath.getDevice(), timeFilter, fileFilter, false, context.isDebug())) {
+                seriesPath.getDevice(), timeFilter, false, context.isDebug())) {
           break;
         }
         curUnseqFileIndex++;
@@ -1378,7 +1331,7 @@ public class SeriesReader {
         TsFileResource tsFileResource = dataSource.getSeqResourceByIndex(curSeqFileIndex);
         if (tsFileResource != null
             && tsFileResource.isSatisfied(
-                seriesPath.getDevice(), timeFilter, fileFilter, true, context.isDebug())) {
+                seriesPath.getDevice(), timeFilter, true, context.isDebug())) {
           break;
         }
         curSeqFileIndex++;
@@ -1392,7 +1345,7 @@ public class SeriesReader {
         TsFileResource tsFileResource = dataSource.getUnseqResourceByIndex(curUnseqFileIndex);
         if (tsFileResource != null
             && tsFileResource.isSatisfied(
-                seriesPath.getDevice(), timeFilter, fileFilter, false, context.isDebug())) {
+                seriesPath.getDevice(), timeFilter, false, context.isDebug())) {
           break;
         }
         curUnseqFileIndex++;
diff --git a/server/src/main/java/org/apache/iotdb/db/sync/SyncService.java b/server/src/main/java/org/apache/iotdb/db/sync/SyncService.java
index ccc95932b5..d6559f1a9e 100644
--- a/server/src/main/java/org/apache/iotdb/db/sync/SyncService.java
+++ b/server/src/main/java/org/apache/iotdb/db/sync/SyncService.java
@@ -41,7 +41,6 @@ import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.mpp.plan.analyze.IPartitionFetcher;
 import org.apache.iotdb.db.mpp.plan.analyze.ISchemaFetcher;
 import org.apache.iotdb.db.mpp.plan.statement.sys.sync.CreatePipeSinkStatement;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
 import org.apache.iotdb.db.sync.common.ClusterSyncInfoFetcher;
 import org.apache.iotdb.db.sync.common.ISyncInfoFetcher;
 import org.apache.iotdb.db.sync.common.LocalSyncInfoFetcher;
@@ -53,6 +52,7 @@ import org.apache.iotdb.db.sync.sender.pipe.Pipe;
 import org.apache.iotdb.db.sync.sender.pipe.TsFilePipe;
 import org.apache.iotdb.db.sync.transport.client.SenderManager;
 import org.apache.iotdb.db.sync.transport.server.ReceiverManager;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.db.utils.sync.SyncPipeUtil;
 import org.apache.iotdb.pipe.external.api.IExternalPipeSinkWriterFactory;
 import org.apache.iotdb.rpc.TSStatusCode;
diff --git a/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java b/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java
index 31daedc3c0..b9cd280fca 100644
--- a/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java
+++ b/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java
@@ -21,7 +21,7 @@ package org.apache.iotdb.db.tools;
 
 import org.apache.iotdb.commons.file.SystemFileFactory;
 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.fileSystem.FSFactoryProducer;
 
 import java.io.File;
diff --git a/server/src/main/java/org/apache/iotdb/db/tools/TsFileResourcePrinter.java b/server/src/main/java/org/apache/iotdb/db/tools/TsFileResourcePrinter.java
index 82a4b30147..94a6ab05de 100644
--- a/server/src/main/java/org/apache/iotdb/db/tools/TsFileResourcePrinter.java
+++ b/server/src/main/java/org/apache/iotdb/db/tools/TsFileResourcePrinter.java
@@ -21,7 +21,7 @@ package org.apache.iotdb.db.tools;
 
 import org.apache.iotdb.commons.file.SystemFileFactory;
 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.fileSystem.FSFactoryProducer;
 
 import java.io.File;
diff --git a/server/src/main/java/org/apache/iotdb/db/tools/watermark/WatermarkDetector.java b/server/src/main/java/org/apache/iotdb/db/tools/watermark/WatermarkDetector.java
index 96037915fd..b242912331 100644
--- a/server/src/main/java/org/apache/iotdb/db/tools/watermark/WatermarkDetector.java
+++ b/server/src/main/java/org/apache/iotdb/db/tools/watermark/WatermarkDetector.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.db.tools.watermark;
 
 import org.apache.iotdb.db.exception.query.LogicalOperatorException;
-import org.apache.iotdb.db.qp.utils.DateTimeUtils;
+import org.apache.iotdb.db.utils.DateTimeUtils;
 
 import org.apache.thrift.EncodingUtils;
 
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/utils/DateTimeUtils.java b/server/src/main/java/org/apache/iotdb/db/utils/DateTimeUtils.java
similarity index 99%
rename from server/src/main/java/org/apache/iotdb/db/qp/utils/DateTimeUtils.java
rename to server/src/main/java/org/apache/iotdb/db/utils/DateTimeUtils.java
index 6ae319e698..f7514da9ea 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/utils/DateTimeUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/DateTimeUtils.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.iotdb.db.qp.utils;
+package org.apache.iotdb.db.utils;
 
 import org.apache.iotdb.commons.utils.TestOnly;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java b/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
index c993bf74a0..067eef1bec 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
@@ -26,7 +26,6 @@ import org.apache.iotdb.db.exception.QueryInBatchStatementException;
 import org.apache.iotdb.db.exception.StorageGroupNotReadyException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
 import org.apache.iotdb.db.exception.query.QueryTimeoutRuntimeException;
-import org.apache.iotdb.db.exception.sql.SQLParserException;
 import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.rpc.RpcUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
@@ -117,9 +116,6 @@ public class ErrorHandlingUtils {
     } else if (t instanceof ParseCancellationException) {
       return RpcUtils.getStatus(
           TSStatusCode.SQL_PARSE_ERROR, INFO_PARSING_SQL_ERROR + rootCause.getMessage());
-    } else if (t instanceof SQLParserException) {
-      return RpcUtils.getStatus(
-          TSStatusCode.METADATA_ERROR, INFO_CHECK_METADATA_ERROR + rootCause.getMessage());
     } else if (t instanceof QueryProcessException) {
       return RpcUtils.getStatus(
           TSStatusCode.QUERY_PROCESS_ERROR, INFO_QUERY_PROCESS_ERROR + rootCause.getMessage());
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/timerangeiterator/AggrWindowIterator.java b/server/src/main/java/org/apache/iotdb/db/utils/timerangeiterator/AggrWindowIterator.java
index 684928436f..c6327eeae9 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/timerangeiterator/AggrWindowIterator.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/timerangeiterator/AggrWindowIterator.java
@@ -19,10 +19,10 @@
 
 package org.apache.iotdb.db.utils.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/utils/timerangeiterator/TimeRangeIteratorFactory.java b/server/src/main/java/org/apache/iotdb/db/utils/timerangeiterator/TimeRangeIteratorFactory.java
index 5e89ea0f6b..f88969595b 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/timerangeiterator/TimeRangeIteratorFactory.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/timerangeiterator/TimeRangeIteratorFactory.java
@@ -19,7 +19,7 @@
 
 package org.apache.iotdb.db.utils.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/test/java/org/apache/iotdb/db/engine/compaction/FastCrossCompactionPerformerTest.java b/server/src/test/java/org/apache/iotdb/db/engine/compaction/FastCrossCompactionPerformerTest.java
index f744dda9ce..c251835272 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/compaction/FastCrossCompactionPerformerTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/compaction/FastCrossCompactionPerformerTest.java
@@ -33,16 +33,13 @@ import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.mpp.execution.fragment.FragmentInstanceContext;
 import org.apache.iotdb.db.query.control.FileReaderManager;
-import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
 import org.apache.iotdb.db.tools.validate.TsFileValidationTool;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.BatchData;
 import org.apache.iotdb.tsfile.read.common.IBatchDataIterator;
 import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.reader.IBatchReader;
 import org.apache.iotdb.tsfile.utils.TsFileGeneratorUtils;
 import org.apache.iotdb.tsfile.utils.TsPrimitiveType;
 import org.apache.iotdb.tsfile.write.schema.IMeasurementSchema;
@@ -62,6 +59,7 @@ import java.util.List;
 import java.util.Map;
 
 import static org.apache.iotdb.commons.conf.IoTDBConstant.PATH_SEPARATOR;
+import static org.apache.iotdb.db.utils.EnvironmentUtils.TEST_QUERY_JOB_ID;
 import static org.junit.Assert.assertEquals;
 
 public class FastCrossCompactionPerformerTest extends AbstractCompactionTest {
@@ -2450,30 +2448,32 @@ public class FastCrossCompactionPerformerTest extends AbstractCompactionTest {
                 COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i,
                 "s" + j,
                 new MeasurementSchema("s" + j, TSDataType.TEXT));
-        IBatchReader tsFilesReader =
-            new SeriesRawDataBatchReader(
+        IDataBlockReader tsFilesReader =
+            new SeriesDataBlockReader(
                 path,
                 TSDataType.VECTOR,
-                EnvironmentUtils.TEST_QUERY_CONTEXT,
+                FragmentInstanceContext.createFragmentInstanceContextForCompaction(
+                    TEST_QUERY_JOB_ID),
                 targetResources,
                 new ArrayList<>(),
-                null,
-                null,
                 true);
+
         int count = 0;
         while (tsFilesReader.hasNextBatch()) {
-          BatchData batchData = tsFilesReader.nextBatch();
-          while (batchData.hasCurrent()) {
+          TsBlock batchData = tsFilesReader.nextBatch();
+          for (int readIndex = 0, size = batchData.getPositionCount();
+              readIndex < size;
+              readIndex++) {
+            long currentTime = batchData.getTimeByIndex(readIndex);
             if (measurementMaxTime.get(
                     COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i + PATH_SEPARATOR + "s" + j)
-                >= batchData.currentTime()) {
+                >= currentTime) {
               Assert.fail();
             }
             measurementMaxTime.put(
                 COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i + PATH_SEPARATOR + "s" + j,
-                batchData.currentTime());
+                currentTime);
             count++;
-            batchData.next();
           }
         }
         tsFilesReader.close();
@@ -2585,30 +2585,33 @@ public class FastCrossCompactionPerformerTest extends AbstractCompactionTest {
                 COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i,
                 "s" + j,
                 new MeasurementSchema("s" + j, TSDataType.TEXT));
-        IBatchReader tsFilesReader =
-            new SeriesRawDataBatchReader(
+
+        IDataBlockReader tsFilesReader =
+            new SeriesDataBlockReader(
                 path,
                 TSDataType.VECTOR,
-                EnvironmentUtils.TEST_QUERY_CONTEXT,
+                FragmentInstanceContext.createFragmentInstanceContextForCompaction(
+                    TEST_QUERY_JOB_ID),
                 targetResources,
                 new ArrayList<>(),
-                null,
-                null,
                 true);
+
         int count = 0;
         while (tsFilesReader.hasNextBatch()) {
-          BatchData batchData = tsFilesReader.nextBatch();
-          while (batchData.hasCurrent()) {
+          TsBlock batchData = tsFilesReader.nextBatch();
+          for (int readIndex = 0, size = batchData.getPositionCount();
+              readIndex < size;
+              readIndex++) {
+            long currentTime = batchData.getTimeByIndex(readIndex);
             if (measurementMaxTime.get(
                     COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i + PATH_SEPARATOR + "s" + j)
-                >= batchData.currentTime()) {
+                >= currentTime) {
               Assert.fail();
             }
             measurementMaxTime.put(
                 COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i + PATH_SEPARATOR + "s" + j,
-                batchData.currentTime());
+                currentTime);
             count++;
-            batchData.next();
           }
         }
         tsFilesReader.close();
@@ -3515,20 +3518,23 @@ public class FastCrossCompactionPerformerTest extends AbstractCompactionTest {
                     + (TsFileGeneratorUtils.getAlignDeviceOffset() + i),
                 Collections.singletonList("s" + j),
                 schemas);
-        IBatchReader tsFilesReader =
-            new SeriesRawDataBatchReader(
+
+        IDataBlockReader tsFilesReader =
+            new SeriesDataBlockReader(
                 path,
                 TSDataType.VECTOR,
-                EnvironmentUtils.TEST_QUERY_CONTEXT,
+                FragmentInstanceContext.createFragmentInstanceContextForCompaction(
+                    EnvironmentUtils.TEST_QUERY_CONTEXT.getQueryId()),
                 targetResources,
                 new ArrayList<>(),
-                null,
-                null,
                 true);
         int count = 0;
         while (tsFilesReader.hasNextBatch()) {
-          BatchData batchData = tsFilesReader.nextBatch();
-          while (batchData.hasCurrent()) {
+          TsBlock batchData = tsFilesReader.nextBatch();
+          for (int readIndex = 0, size = batchData.getPositionCount();
+              readIndex < size;
+              readIndex++) {
+            long currentTime = batchData.getTimeByIndex(readIndex);
             if (measurementMaxTime.get(
                     COMPACTION_TEST_SG
                         + PATH_SEPARATOR
@@ -3537,7 +3543,7 @@ public class FastCrossCompactionPerformerTest extends AbstractCompactionTest {
                         + PATH_SEPARATOR
                         + "s"
                         + j)
-                >= batchData.currentTime()) {
+                >= currentTime) {
               Assert.fail();
             }
             measurementMaxTime.put(
@@ -3548,9 +3554,8 @@ public class FastCrossCompactionPerformerTest extends AbstractCompactionTest {
                     + PATH_SEPARATOR
                     + "s"
                     + j,
-                batchData.currentTime());
+                currentTime);
             count++;
-            batchData.next();
           }
         }
         tsFilesReader.close();
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/compaction/ReadPointCompactionPerformerTest.java b/server/src/test/java/org/apache/iotdb/db/engine/compaction/ReadPointCompactionPerformerTest.java
index 1e53a8ee37..591831c07e 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/compaction/ReadPointCompactionPerformerTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/compaction/ReadPointCompactionPerformerTest.java
@@ -33,15 +33,12 @@ import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.mpp.execution.fragment.FragmentInstanceContext;
 import org.apache.iotdb.db.query.control.FileReaderManager;
-import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.BatchData;
 import org.apache.iotdb.tsfile.read.common.IBatchDataIterator;
 import org.apache.iotdb.tsfile.read.common.block.TsBlock;
-import org.apache.iotdb.tsfile.read.reader.IBatchReader;
 import org.apache.iotdb.tsfile.utils.Pair;
 import org.apache.iotdb.tsfile.utils.TsFileGeneratorUtils;
 import org.apache.iotdb.tsfile.utils.TsPrimitiveType;
@@ -3920,30 +3917,30 @@ public class ReadPointCompactionPerformerTest extends AbstractCompactionTest {
                 COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i,
                 "s" + j,
                 new MeasurementSchema("s" + j, TSDataType.TEXT));
-        IBatchReader tsFilesReader =
-            new SeriesRawDataBatchReader(
+        IDataBlockReader tsFilesReader =
+            new SeriesDataBlockReader(
                 path,
                 TSDataType.VECTOR,
-                EnvironmentUtils.TEST_QUERY_CONTEXT,
+                EnvironmentUtils.TEST_QUERY_FI_CONTEXT,
                 targetResources,
                 new ArrayList<>(),
-                null,
-                null,
                 true);
         int count = 0;
         while (tsFilesReader.hasNextBatch()) {
-          BatchData batchData = tsFilesReader.nextBatch();
-          while (batchData.hasCurrent()) {
+          TsBlock batchData = tsFilesReader.nextBatch();
+          for (int readIndex = 0, size = batchData.getPositionCount();
+              readIndex < size;
+              readIndex++) {
+            long currentTime = batchData.getTimeByIndex(readIndex);
             if (measurementMaxTime.get(
                     COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i + PATH_SEPARATOR + "s" + j)
-                >= batchData.currentTime()) {
+                >= currentTime) {
               Assert.fail();
             }
             measurementMaxTime.put(
                 COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i + PATH_SEPARATOR + "s" + j,
-                batchData.currentTime());
+                currentTime);
             count++;
-            batchData.next();
           }
         }
         tsFilesReader.close();
@@ -4058,30 +4055,30 @@ public class ReadPointCompactionPerformerTest extends AbstractCompactionTest {
                 COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i,
                 "s" + j,
                 new MeasurementSchema("s" + j, TSDataType.TEXT));
-        IBatchReader tsFilesReader =
-            new SeriesRawDataBatchReader(
+        IDataBlockReader tsFilesReader =
+            new SeriesDataBlockReader(
                 path,
                 TSDataType.VECTOR,
-                EnvironmentUtils.TEST_QUERY_CONTEXT,
+                EnvironmentUtils.TEST_QUERY_FI_CONTEXT,
                 targetResources,
                 new ArrayList<>(),
-                null,
-                null,
                 true);
         int count = 0;
         while (tsFilesReader.hasNextBatch()) {
-          BatchData batchData = tsFilesReader.nextBatch();
-          while (batchData.hasCurrent()) {
+          TsBlock batchData = tsFilesReader.nextBatch();
+          for (int readIndex = 0, size = batchData.getPositionCount();
+              readIndex < size;
+              readIndex++) {
+            long currentTime = batchData.getTimeByIndex(readIndex);
             if (measurementMaxTime.get(
                     COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i + PATH_SEPARATOR + "s" + j)
-                >= batchData.currentTime()) {
+                >= currentTime) {
               Assert.fail();
             }
             measurementMaxTime.put(
                 COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i + PATH_SEPARATOR + "s" + j,
-                batchData.currentTime());
+                currentTime);
             count++;
-            batchData.next();
           }
         }
         tsFilesReader.close();
@@ -5134,20 +5131,21 @@ public class ReadPointCompactionPerformerTest extends AbstractCompactionTest {
                     + (TsFileGeneratorUtils.getAlignDeviceOffset() + i),
                 Collections.singletonList("s" + j),
                 schemas);
-        IBatchReader tsFilesReader =
-            new SeriesRawDataBatchReader(
+        IDataBlockReader tsFilesReader =
+            new SeriesDataBlockReader(
                 path,
                 TSDataType.VECTOR,
-                EnvironmentUtils.TEST_QUERY_CONTEXT,
+                EnvironmentUtils.TEST_QUERY_FI_CONTEXT,
                 targetResources,
                 new ArrayList<>(),
-                null,
-                null,
                 true);
         int count = 0;
         while (tsFilesReader.hasNextBatch()) {
-          BatchData batchData = tsFilesReader.nextBatch();
-          while (batchData.hasCurrent()) {
+          TsBlock batchData = tsFilesReader.nextBatch();
+          for (int readIndex = 0, size = batchData.getPositionCount();
+              readIndex < size;
+              readIndex++) {
+            long currentTime = batchData.getTimeByIndex(readIndex);
             if (measurementMaxTime.get(
                     COMPACTION_TEST_SG
                         + PATH_SEPARATOR
@@ -5156,7 +5154,7 @@ public class ReadPointCompactionPerformerTest extends AbstractCompactionTest {
                         + PATH_SEPARATOR
                         + "s"
                         + j)
-                >= batchData.currentTime()) {
+                >= currentTime) {
               Assert.fail();
             }
             measurementMaxTime.put(
@@ -5167,9 +5165,8 @@ public class ReadPointCompactionPerformerTest extends AbstractCompactionTest {
                     + PATH_SEPARATOR
                     + "s"
                     + j,
-                batchData.currentTime());
+                currentTime);
             count++;
-            batchData.next();
           }
         }
         tsFilesReader.close();
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/RewriteCrossSpaceCompactionWithFastPerformerTest.java b/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/RewriteCrossSpaceCompactionWithFastPerformerTest.java
index d6abe8ff14..9ce94bac17 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/RewriteCrossSpaceCompactionWithFastPerformerTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/compaction/cross/RewriteCrossSpaceCompactionWithFastPerformerTest.java
@@ -25,6 +25,8 @@ import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.engine.compaction.AbstractCompactionTest;
 import org.apache.iotdb.db.engine.compaction.performer.impl.FastCompactionPerformer;
+import org.apache.iotdb.db.engine.compaction.reader.IDataBlockReader;
+import org.apache.iotdb.db.engine.compaction.reader.SeriesDataBlockReader;
 import org.apache.iotdb.db.engine.compaction.utils.CompactionFileGeneratorUtils;
 import org.apache.iotdb.db.engine.flush.TsFileFlushPolicy;
 import org.apache.iotdb.db.engine.storagegroup.DataRegion;
@@ -41,6 +43,7 @@ import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.read.common.BatchData;
+import org.apache.iotdb.tsfile.read.common.block.TsBlock;
 import org.apache.iotdb.tsfile.read.reader.IBatchReader;
 import org.apache.iotdb.tsfile.utils.Pair;
 import org.apache.iotdb.tsfile.utils.TsFileGeneratorUtils;
@@ -159,40 +162,35 @@ public class RewriteCrossSpaceCompactionWithFastPerformerTest extends AbstractCo
                 COMPACTION_TEST_SG + PATH_SEPARATOR + "d" + i,
                 Collections.singletonList("s" + j),
                 schemas);
-        IBatchReader tsFilesReader =
-            new SeriesRawDataBatchReader(
+        IDataBlockReader tsFilesReader =
+            new SeriesDataBlockReader(
                 path,
                 TSDataType.VECTOR,
-                EnvironmentUtils.TEST_QUERY_CONTEXT,
+                EnvironmentUtils.TEST_QUERY_FI_CONTEXT,
                 seqResources,
                 unseqResources,
-                null,
-                null,
                 true);
         int count = 0;
         while (tsFilesReader.hasNextBatch()) {
-          BatchData batchData = tsFilesReader.nextBatch();
-          while (batchData.hasCurrent()) {
+          TsBlock batchData = tsFilesReader.nextBatch();
+          for (int readIndex = 0, size = batchData.getPositionCount();
+              readIndex < size;
+              readIndex++) {
+            long currentTime = batchData.getTimeByIndex(readIndex);
+            long currentValue = batchData.getColumn(0).getLong(readIndex);
             if (i == TsFileGeneratorUtils.getAlignDeviceOffset()
-                && ((450 <= batchData.currentTime() && batchData.currentTime() < 550)
-                    || (550 <= batchData.currentTime() && batchData.currentTime() < 650))) {
-              assertEquals(
-                  batchData.currentTime() + 20000,
-                  ((TsPrimitiveType[]) (batchData.currentValue()))[0].getValue());
+                && ((450 <= currentTime && currentTime < 550)
+                    || (550 <= currentTime && currentTime < 650))) {
+              assertEquals(currentTime + 20000, currentValue);
             } else if ((i < TsFileGeneratorUtils.getAlignDeviceOffset() + 3 && j < 4)
-                && ((20 <= batchData.currentTime() && batchData.currentTime() < 220)
-                    || (250 <= batchData.currentTime() && batchData.currentTime() < 450)
-                    || (480 <= batchData.currentTime() && batchData.currentTime() < 680))) {
-              assertEquals(
-                  batchData.currentTime() + 10000,
-                  ((TsPrimitiveType[]) (batchData.currentValue()))[0].getValue());
+                && ((20 <= currentTime && currentTime < 220)
+                    || (250 <= currentTime && currentTime < 450)
+                    || (480 <= currentTime && currentTime < 680))) {
+              assertEquals(currentTime + 10000, currentValue);
             } else {
-              assertEquals(
-                  batchData.currentTime(),
-                  ((TsPrimitiveType[]) (batchData.currentValue()))[0].getValue());
+              assertEquals(currentTime, currentValue);
             }
             count++;
-            batchData.next();
           }
         }
         tsFilesReader.close();
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
index 3c39d5f1c2..df93af526a 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/compaction/inner/InnerCompactionMoreDataTest.java
@@ -26,18 +26,17 @@ import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.constant.TestConstant;
 import org.apache.iotdb.db.engine.compaction.CompactionScheduler;
 import org.apache.iotdb.db.engine.compaction.CompactionTaskManager;
+import org.apache.iotdb.db.engine.compaction.reader.IDataBlockReader;
+import org.apache.iotdb.db.engine.compaction.reader.SeriesDataBlockReader;
 import org.apache.iotdb.db.engine.storagegroup.TsFileManager;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
 import org.apache.iotdb.db.engine.storagegroup.TsFileResourceStatus;
 import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
 import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.BatchData;
 import org.apache.iotdb.tsfile.read.common.Path;
-import org.apache.iotdb.tsfile.read.reader.IBatchReader;
+import org.apache.iotdb.tsfile.read.common.block.TsBlock;
 import org.apache.iotdb.tsfile.write.TsFileWriter;
 import org.apache.iotdb.tsfile.write.record.TSRecord;
 import org.apache.iotdb.tsfile.write.record.datapoint.DataPoint;
@@ -54,6 +53,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 
 import static org.apache.iotdb.commons.conf.IoTDBConstant.PATH_SEPARATOR;
+import static org.apache.iotdb.db.utils.EnvironmentUtils.TEST_QUERY_FI_CONTEXT;
 import static org.junit.Assert.assertEquals;
 
 public class InnerCompactionMoreDataTest extends InnerCompactionTest {
@@ -156,29 +156,29 @@ public class InnerCompactionMoreDataTest extends InnerCompactionTest {
     CompactionScheduler.scheduleCompaction(tsFileManager, 0);
     try {
       Thread.sleep(500);
-    } catch (Exception e) {
+    } catch (Exception ignored) {
 
     }
     CompactionTaskManager.getInstance().waitAllCompactionFinish();
-    QueryContext context = new QueryContext();
+
     MeasurementPath path =
         new MeasurementPath(
             new PartialPath(deviceIds[0], measurementSchemas[2688].getMeasurementId()),
             measurementSchemas[2688].getType());
-    IBatchReader tsFilesReader =
-        new SeriesRawDataBatchReader(
+    IDataBlockReader tsFilesReader =
+        new SeriesDataBlockReader(
             path,
             measurementSchemas[2688].getType(),
-            context,
+            TEST_QUERY_FI_CONTEXT,
             tsFileManager.getTsFileList(true),
             new ArrayList<>(),
-            null,
-            null,
             true);
+
     while (tsFilesReader.hasNextBatch()) {
-      BatchData batchData = tsFilesReader.nextBatch();
-      for (int i = 0; i < batchData.length(); i++) {
-        assertEquals(batchData.getTimeByIndex(i) + 2688, batchData.getDoubleByIndex(i), 0.001);
+      TsBlock batchData = tsFilesReader.nextBatch();
+      for (int i = 0, size = batchData.getPositionCount(); i < size; i++) {
+        assertEquals(
+            batchData.getTimeByIndex(i) + 2688, batchData.getColumn(0).getDouble(i), 0.001);
       }
     }
   }
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/compaction/utils/CompactionCheckerUtils.java b/server/src/test/java/org/apache/iotdb/db/engine/compaction/utils/CompactionCheckerUtils.java
index 9454297236..7b847045e0 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/compaction/utils/CompactionCheckerUtils.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/compaction/utils/CompactionCheckerUtils.java
@@ -24,12 +24,13 @@ import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.engine.cache.BloomFilterCache;
 import org.apache.iotdb.db.engine.cache.ChunkCache;
 import org.apache.iotdb.db.engine.cache.TimeSeriesMetadataCache;
+import org.apache.iotdb.db.engine.compaction.reader.IDataBlockReader;
+import org.apache.iotdb.db.engine.compaction.reader.SeriesDataBlockReader;
 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.storagegroup.TsFileResource;
 import org.apache.iotdb.db.query.control.FileReaderManager;
-import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
 import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
@@ -47,7 +48,7 @@ import org.apache.iotdb.tsfile.read.common.BatchData;
 import org.apache.iotdb.tsfile.read.common.Chunk;
 import org.apache.iotdb.tsfile.read.common.IBatchDataIterator;
 import org.apache.iotdb.tsfile.read.common.Path;
-import org.apache.iotdb.tsfile.read.reader.IBatchReader;
+import org.apache.iotdb.tsfile.read.common.block.TsBlock;
 import org.apache.iotdb.tsfile.read.reader.chunk.ChunkReader;
 import org.apache.iotdb.tsfile.read.reader.page.PageReader;
 import org.apache.iotdb.tsfile.utils.TsPrimitiveType;
@@ -511,22 +512,21 @@ public class CompactionCheckerUtils {
 
       PartialPath path = fullPaths.get(i);
       List<TimeValuePair> dataList = new LinkedList<>();
-      IBatchReader reader =
-          new SeriesRawDataBatchReader(
+
+      IDataBlockReader reader =
+          new SeriesDataBlockReader(
               path,
               path.getSeriesType(),
-              EnvironmentUtils.TEST_QUERY_CONTEXT,
+              EnvironmentUtils.TEST_QUERY_FI_CONTEXT,
               sequenceResources,
               unsequenceResources,
-              null,
-              null,
               true);
       while (reader.hasNextBatch()) {
-        BatchData batchData = reader.nextBatch();
-        while (batchData.hasCurrent()) {
-          dataList.add(
-              new TimeValuePair(batchData.currentTime(), batchData.currentTsPrimitiveType()));
-          batchData.next();
+        TsBlock batchData = reader.nextBatch();
+        TsBlock.TsBlockSingleColumnIterator batchDataIterator =
+            batchData.getTsBlockSingleColumnIterator();
+        while (batchDataIterator.hasNextTimeValuePair()) {
+          dataList.add(batchDataIterator.nextTimeValuePair());
         }
       }
       pathDataMap.put(fullPaths.get(i), dataList);
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
index 02ccab25c1..c374fcf4c4 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
@@ -28,6 +28,8 @@ import org.apache.iotdb.commons.path.MeasurementPath;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.conf.directories.DirectoryManager;
+import org.apache.iotdb.db.engine.compaction.reader.IDataBlockReader;
+import org.apache.iotdb.db.engine.compaction.reader.SeriesDataBlockReader;
 import org.apache.iotdb.db.engine.flush.TsFileFlushPolicy.DirectFlushPolicy;
 import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
 import org.apache.iotdb.db.exception.DataRegionException;
@@ -35,20 +37,19 @@ import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.exception.WriteProcessException;
 import org.apache.iotdb.db.exception.query.OutOfTTLException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
+import org.apache.iotdb.db.mpp.execution.fragment.FragmentInstanceContext;
 import org.apache.iotdb.db.mpp.plan.parser.StatementGenerator;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.PlanNodeId;
 import org.apache.iotdb.db.mpp.plan.planner.plan.node.write.InsertRowNode;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.SetTTLStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.ShowTTLStatement;
 import org.apache.iotdb.db.mpp.plan.statement.metadata.UnSetTTLStatement;
-import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 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.BatchData;
-import org.apache.iotdb.tsfile.read.reader.IBatchReader;
+import org.apache.iotdb.tsfile.read.common.block.TsBlock;
 import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
 
 import org.junit.After;
@@ -60,11 +61,10 @@ import java.io.IOException;
 import java.time.ZoneId;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 import java.util.stream.Collectors;
 
+import static org.apache.iotdb.db.utils.EnvironmentUtils.TEST_QUERY_JOB_ID;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -169,8 +169,7 @@ public class TTLTest {
 
   @Test
   public void testTTLRead()
-      throws IOException, WriteProcessException, StorageEngineException, QueryProcessException,
-          MetadataException {
+      throws IOException, WriteProcessException, QueryProcessException, MetadataException {
     prepareData();
 
     // files before ttl
@@ -199,26 +198,20 @@ public class TTLTest {
     assertTrue(seqResource.size() < 4);
     assertEquals(0, unseqResource.size());
     MeasurementPath path = mockMeasurementPath();
-    Set<String> allSensors = new HashSet<>();
-    allSensors.add(s1);
-    IBatchReader reader =
-        new SeriesRawDataBatchReader(
+
+    IDataBlockReader reader =
+        new SeriesDataBlockReader(
             path,
             TSDataType.INT64,
-            EnvironmentUtils.TEST_QUERY_CONTEXT,
+            FragmentInstanceContext.createFragmentInstanceContextForCompaction(TEST_QUERY_JOB_ID),
             seqResource,
             unseqResource,
-            null,
-            null,
             true);
 
     int cnt = 0;
     while (reader.hasNextBatch()) {
-      BatchData batchData = reader.nextBatch();
-      while (batchData.hasCurrent()) {
-        batchData.next();
-        cnt++;
-      }
+      TsBlock tsblock = reader.nextBatch();
+      cnt += tsblock.getPositionCount();
     }
     reader.close();
     // we cannot offer the exact number since when exactly ttl will be checked is unknown
diff --git a/server/src/test/java/org/apache/iotdb/db/qp/utils/DatetimeQueryDataSetUtilsTest.java b/server/src/test/java/org/apache/iotdb/db/qp/utils/DatetimeQueryDataSetUtilsTest.java
index 35ea2d0067..ddc6a8dabc 100644
--- a/server/src/test/java/org/apache/iotdb/db/qp/utils/DatetimeQueryDataSetUtilsTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/qp/utils/DatetimeQueryDataSetUtilsTest.java
@@ -18,6 +18,8 @@
  */
 package org.apache.iotdb.db.qp.utils;
 
+import org.apache.iotdb.db.utils.DateTimeUtils;
+
 import org.junit.Assert;
 import org.junit.Test;
 
diff --git a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
index fd9cd3c390..3832331eeb 100644
--- a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
+++ b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
@@ -40,6 +40,7 @@ import org.apache.iotdb.db.localconfignode.LocalConfigNode;
 import org.apache.iotdb.db.metadata.idtable.IDTableManager;
 import org.apache.iotdb.db.metadata.idtable.entry.DeviceIDFactory;
 import org.apache.iotdb.db.metadata.schemaregion.SchemaEngine;
+import org.apache.iotdb.db.mpp.execution.fragment.FragmentInstanceContext;
 import org.apache.iotdb.db.query.context.QueryContext;
 import org.apache.iotdb.db.query.control.FileReaderManager;
 import org.apache.iotdb.db.query.control.QueryResourceManager;
@@ -85,6 +86,8 @@ public class EnvironmentUtils {
 
   public static long TEST_QUERY_JOB_ID = 1;
   public static QueryContext TEST_QUERY_CONTEXT = new QueryContext(TEST_QUERY_JOB_ID);
+  public static FragmentInstanceContext TEST_QUERY_FI_CONTEXT =
+      FragmentInstanceContext.createFragmentInstanceContextForCompaction(TEST_QUERY_JOB_ID);
 
   private static final long oldSeqTsFileSize = config.getSeqTsFileSize();
   private static final long oldUnSeqTsFileSize = config.getUnSeqTsFileSize();