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

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


The following commit(s) were added to refs/heads/master by this push:
     new 6347db7  [IOTDB-2725] MPP query engine interface definition (#5250)
6347db7 is described below

commit 6347db7e208e92bdb48e9487122403f9d5510c2a
Author: Jackie Tien <[email protected]>
AuthorDate: Wed Mar 16 11:57:20 2022 +0800

    [IOTDB-2725] MPP query engine interface definition (#5250)
---
 pom.xml                                            |  5 ++
 server/pom.xml                                     |  4 +
 .../org/apache/iotdb/db/mpp/buffer/SinkHandle.java | 41 +++++++++
 .../apache/iotdb/db/mpp/buffer/SourceHandle.java   | 36 ++++++++
 .../org/apache/iotdb/db/mpp/common/Analysis.java   | 22 +++++
 .../org/apache/iotdb/db/mpp/common/FillPolicy.java | 23 ++++++
 .../iotdb/db/mpp/common/GroupByTimeParameter.java  | 27 ++++++
 .../org/apache/iotdb/db/mpp/common/OrderBy.java    | 27 ++++++
 .../apache/iotdb/db/mpp/common/QueryContext.java   | 29 +++++++
 .../org/apache/iotdb/db/mpp/common/QueryId.java    | 31 +++++++
 .../apache/iotdb/db/mpp/common/QuerySession.java   | 21 +++++
 .../org/apache/iotdb/db/mpp/common/TreeNode.java   | 41 +++++++++
 .../org/apache/iotdb/db/mpp/common/TsBlock.java    | 48 +++++++++++
 .../iotdb/db/mpp/common/TsBlockMetadata.java       | 41 +++++++++
 .../apache/iotdb/db/mpp/common/WithoutPolicy.java  | 24 ++++++
 .../apache/iotdb/db/mpp/execution/Coordinator.java | 45 ++++++++++
 .../db/mpp/execution/ExecFragmentInstance.java     | 57 +++++++++++++
 .../iotdb/db/mpp/execution/QueryExecution.java     | 96 ++++++++++++++++++++++
 .../iotdb/db/mpp/execution/QueryScheduler.java     | 51 ++++++++++++
 .../iotdb/db/mpp/execution/QueryStateMachine.java  | 25 ++++++
 .../org/apache/iotdb/db/mpp/operator/Operator.java | 49 +++++++++++
 .../iotdb/db/mpp/operator/OperatorContext.java     | 39 +++++++++
 .../iotdb/db/mpp/operator/SeriesScanOperator.java  | 39 +++++++++
 .../iotdb/db/mpp/plan/DistributedQueryPlan.java    | 34 ++++++++
 .../iotdb/db/mpp/plan/DistributionPlanner.java     | 35 ++++++++
 .../apache/iotdb/db/mpp/plan/FragmentInstance.java | 29 +++++++
 .../iotdb/db/mpp/plan/FragmentInstanceId.java      | 30 +++++++
 .../apache/iotdb/db/mpp/plan/LogicalPlanner.java   | 41 +++++++++
 .../apache/iotdb/db/mpp/plan/LogicalQueryPlan.java | 32 ++++++++
 .../org/apache/iotdb/db/mpp/plan/PlanFragment.java | 29 +++++++
 .../apache/iotdb/db/mpp/plan/PlanFragmentId.java   | 27 ++++++
 .../apache/iotdb/db/mpp/plan/node/PlanNode.java    | 34 ++++++++
 .../apache/iotdb/db/mpp/plan/node/PlanNodeId.java  | 34 ++++++++
 .../db/mpp/plan/node/PlanNodeIdAllocator.java      | 22 +++++
 .../db/mpp/plan/node/process/DeviceMergeNode.java  | 66 +++++++++++++++
 .../iotdb/db/mpp/plan/node/process/FillNode.java   | 38 +++++++++
 .../iotdb/db/mpp/plan/node/process/FilterNode.java | 38 +++++++++
 .../db/mpp/plan/node/process/FilterNullNode.java   | 38 +++++++++
 .../db/mpp/plan/node/process/GroupByLevelNode.java | 41 +++++++++
 .../iotdb/db/mpp/plan/node/process/LimitNode.java  | 37 +++++++++
 .../iotdb/db/mpp/plan/node/process/OffsetNode.java | 40 +++++++++
 .../db/mpp/plan/node/process/ProcessNode.java      | 29 +++++++
 .../node/process/RowBasedSeriesAggregateNode.java  | 59 +++++++++++++
 .../iotdb/db/mpp/plan/node/process/SortNode.java   | 40 +++++++++
 .../db/mpp/plan/node/process/TimeJoinNode.java     | 67 +++++++++++++++
 .../iotdb/db/mpp/plan/node/sink/CsvSinkNode.java   | 33 ++++++++
 .../db/mpp/plan/node/sink/FragmentSinkNode.java    | 33 ++++++++
 .../iotdb/db/mpp/plan/node/sink/SinkNode.java      | 32 ++++++++
 .../db/mpp/plan/node/sink/ThriftSinkNode.java      | 35 ++++++++
 .../db/mpp/plan/node/source/CsvSourceNode.java     | 35 ++++++++
 .../mpp/plan/node/source/SeriesAggregateNode.java  | 81 ++++++++++++++++++
 .../db/mpp/plan/node/source/SeriesScanNode.java    | 85 +++++++++++++++++++
 .../iotdb/db/mpp/plan/node/source/SourceNode.java  | 32 ++++++++
 .../db/mpp/plan/optimzation/PlanOptimizer.java     | 27 ++++++
 54 files changed, 2054 insertions(+)

diff --git a/pom.xml b/pom.xml
index 3acdb57..643bfb7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -495,6 +495,11 @@
             </dependency>
             <dependency>
                 <groupId>io.airlift</groupId>
+                <artifactId>units</artifactId>
+                <version>1.6</version>
+            </dependency>
+            <dependency>
+                <groupId>io.airlift</groupId>
                 <artifactId>airline</artifactId>
                 <version>${airline.version}</version>
             </dependency>
diff --git a/server/pom.xml b/server/pom.xml
index 97ad1ae..6db8881 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -87,6 +87,10 @@
         </dependency>
         <dependency>
             <groupId>io.airlift</groupId>
+            <artifactId>units</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.airlift</groupId>
             <artifactId>airline</artifactId>
             <exclusions>
                 <exclusion>
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SinkHandle.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SinkHandle.java
new file mode 100644
index 0000000..e80550f
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SinkHandle.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.buffer;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+import java.nio.ByteBuffer;
+
+public interface SinkHandle {
+
+  /** Get a future that will be completed when the buffer is not full. */
+  ListenableFuture<Void> isFull();
+
+  /**
+   * Sends a tsBlock to an unpartitioned buffer. If no-more-pages has been 
set, the send tsBlock
+   * call is ignored. This can happen with limit queries.
+   */
+  void send(ByteBuffer tsBlock);
+
+  /**
+   * Sends a tsBlock to a specific partition. If no-more-pages has been set, 
the send tsBlock call
+   * is ignored. This can happen with limit queries.
+   */
+  void send(int partition, ByteBuffer tsBlock);
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java
new file mode 100644
index 0000000..260c80e
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SourceHandle.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.buffer;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+import java.io.Closeable;
+import java.nio.ByteBuffer;
+
+public interface SourceHandle extends Closeable {
+
+  ByteBuffer receive();
+
+  boolean isFinished();
+
+  ListenableFuture<Void> isBlocked();
+
+  @Override
+  void close();
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/Analysis.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/Analysis.java
new file mode 100644
index 0000000..178402a
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/Analysis.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+/** Analysis used for planning a query. TODO: This class may need to store 
more info for a query. */
+public class Analysis {}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/common/FillPolicy.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/FillPolicy.java
new file mode 100644
index 0000000..1b753d5
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/FillPolicy.java
@@ -0,0 +1,23 @@
+/*
+ * 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;
+
+public enum FillPolicy {
+  PREVIOUS,
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/common/GroupByTimeParameter.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/GroupByTimeParameter.java
new file mode 100644
index 0000000..3368274
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/GroupByTimeParameter.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.common;
+
+import org.apache.iotdb.db.qp.physical.crud.GroupByTimePlan;
+
+/**
+ * In single-node IoTDB, the GroupByTimePlan is used to represent the 
parameter of `group by time`.
+ * To avoid ambiguity, we use another name `GroupByTimeParameter` here
+ */
+public class GroupByTimeParameter extends GroupByTimePlan {}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/OrderBy.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/OrderBy.java
new file mode 100644
index 0000000..a8d9b94
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/OrderBy.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.common;
+
+/** The traversal order for operators by timestamp */
+public enum OrderBy {
+  TIMESTAMP_ASC,
+  TIMESTAMP_DESC,
+  DEVICE_NAME_ASC,
+  DEVICE_NAME_DESC,
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/common/QueryContext.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/QueryContext.java
new file mode 100644
index 0000000..2f6715d
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/QueryContext.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.common;
+
+/**
+ * This class is used to record the context of a query including QueryId, 
query statement, session
+ * info and so on
+ */
+public class QueryContext {
+  private String statement;
+  private QueryId queryId;
+  private QuerySession session;
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/QueryId.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/QueryId.java
new file mode 100644
index 0000000..dd8d436
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/QueryId.java
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+public class QueryId {
+  private String Id;
+
+  public String getId() {
+    return Id;
+  }
+
+  public void setId(String id) {
+    Id = id;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/common/QuerySession.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/QuerySession.java
new file mode 100644
index 0000000..3f1d165
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/QuerySession.java
@@ -0,0 +1,21 @@
+/*
+ * 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;
+
+public class QuerySession {}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/TreeNode.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/TreeNode.java
new file mode 100644
index 0000000..4a11358
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/TreeNode.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.common;
+
+import java.util.List;
+
+/**
+ * @author A simple class to describe the tree style structure of query 
executable operators
+ * @param <T>
+ */
+public class TreeNode<T extends TreeNode<T>> {
+  protected List<T> children;
+
+  public T getChild(int i) {
+    return hasChild(i) ? children.get(i) : null;
+  }
+
+  public boolean hasChild(int i) {
+    return children.size() > i;
+  }
+
+  public void addChild(T n) {
+    children.add(n);
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/common/TsBlock.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/TsBlock.java
new file mode 100644
index 0000000..aa40205
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/TsBlock.java
@@ -0,0 +1,48 @@
+/*
+ * 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;
+
+import org.apache.iotdb.tsfile.read.common.RowRecord;
+
+/**
+ * Intermediate result for most of ExecOperators. The Tablet contains data 
from one or more columns
+ * and constructs them as a row based view The columns can be series, 
aggregation result for one
+ * series or scalar value (such as deviceName). The Tablet also contains the 
metadata to describe
+ * the columns.
+ *
+ * <p>TODO: consider the detailed data store model in memory. (using column 
based or row based ?)
+ */
+public class TsBlock {
+
+  // Describe the column info
+  private TsBlockMetadata metadata;
+
+  public boolean hasNext() {
+    return false;
+  }
+
+  // Get next row in current tablet
+  public RowRecord getNext() {
+    return null;
+  }
+
+  public TsBlockMetadata getMetadata() {
+    return metadata;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/common/TsBlockMetadata.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/TsBlockMetadata.java
new file mode 100644
index 0000000..d8e480c
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/TsBlockMetadata.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.common;
+
+import java.util.List;
+
+public class TsBlockMetadata {
+  // list of all columns in current Tablet
+  // The column list not only contains the series column, but also contains 
other column to
+  // construct the final result
+  // set such as timestamp and deviceName
+  private List<String> columnList;
+
+  // Indicate whether the result set should be aligned by device. This 
parameter can be used for
+  // downstream operators
+  // when processing data from current Tablet. The RowRecord produced by 
Tablet with
+  // `alignedByDevice = true` will contain
+  // n + 1 fields which are n series field and 1 deviceName field.
+  // For example, when the FilterOperator execute the filter operation, it may 
need the deviceName
+  // field when matching
+  // the series with corresponding column in Tablet
+  //
+  // If alignedByDevice is true, the owned series should belong to one device
+  private boolean alignedByDevice;
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/common/WithoutPolicy.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/WithoutPolicy.java
new file mode 100644
index 0000000..7a4107e
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/common/WithoutPolicy.java
@@ -0,0 +1,24 @@
+/*
+ * 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;
+
+public enum WithoutPolicy {
+  CONTAINS_NULL,
+  ALL_NULL
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/Coordinator.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/Coordinator.java
new file mode 100644
index 0000000..f6c85e8
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/Coordinator.java
@@ -0,0 +1,45 @@
+/*
+ * 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.execution;
+
+import org.apache.iotdb.db.mpp.common.QueryId;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * The coordinator for MPP. It manages all the queries which are executed in 
current Node. And it
+ * will be responsible for the lifecycle of a query. A query request will be 
represented as a
+ * QueryExecution.
+ */
+public class Coordinator {
+
+  private ConcurrentHashMap<QueryId, QueryExecution> queryExecutionMap;
+
+  private QueryExecution createQueryExecution() {
+    return null;
+  }
+
+  private QueryExecution getQueryExecutionById() {
+    return null;
+  }
+
+  //    private TQueryResponse executeQuery(TQueryRequest request) {
+  //
+  //    }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/ExecFragmentInstance.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/ExecFragmentInstance.java
new file mode 100644
index 0000000..50f46ed
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/ExecFragmentInstance.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.execution;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import io.airlift.units.Duration;
+
+import java.io.Closeable;
+
+/**
+ * ExecutableFragmentInstance encapsulates some methods which are necessary 
for execution scheduler
+ * to run a fragment instance
+ */
+public interface ExecFragmentInstance extends Closeable {
+
+  /**
+   * Used to judge whether this fragment instance has any more data to process
+   *
+   * @return true if the FragmentInstance is done, otherwise false.
+   */
+  boolean isFinished();
+
+  /**
+   * run the fragment instance for {@param duration} time slice, the time of 
this run is likely not
+   * to be equal to {@param duration}, the actual run time should be 
calculated by the caller
+   *
+   * @param duration how long should this fragment instance run
+   * @return the returned ListenableFuture<Void> is used to represent status 
of this processing if
+   *     isDone() return true, meaning that this fragment instance is not 
blocked and is ready for
+   *     next processing otherwise, meaning that this fragment instance is 
blocked and not ready for
+   *     next processing.
+   */
+  ListenableFuture<Void> processFor(Duration duration);
+
+  /** @return the information about this Fragment Instance in String format */
+  String getInfo();
+
+  /** clear resource used by this fragment instance */
+  @Override
+  void close();
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryExecution.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryExecution.java
new file mode 100644
index 0000000..2b9d8cf
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryExecution.java
@@ -0,0 +1,96 @@
+/*
+ * 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.execution;
+
+import org.apache.iotdb.db.mpp.common.Analysis;
+import org.apache.iotdb.db.mpp.common.QueryContext;
+import org.apache.iotdb.db.mpp.plan.*;
+import org.apache.iotdb.db.mpp.plan.optimzation.PlanOptimizer;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * QueryExecution stores all the status of a query which is being prepared or 
running inside the MPP
+ * frame. It takes three main responsibilities: 1. Prepare a query. Transform 
a query from statement
+ * to DistributedQueryPlan with fragment instances. 2. Dispatch all the 
fragment instances to
+ * corresponding physical nodes. 3. Collect and monitor the progress/states of 
this query.
+ */
+public class QueryExecution {
+  private QueryContext context;
+  private QueryScheduler scheduler;
+  private QueryStateMachine stateMachine;
+
+  private List<PlanOptimizer> planOptimizers;
+
+  private Analysis analysis;
+  private LogicalQueryPlan logicalPlan;
+  private DistributedQueryPlan distributedPlan;
+  private List<PlanFragment> fragments;
+  private List<FragmentInstance> fragmentInstances;
+
+  public QueryExecution(QueryContext context) {
+    this.context = context;
+  }
+
+  public void plan() {
+    analyze();
+    doLogicalPlan();
+    doDistributedPlan();
+    planFragmentInstances();
+  }
+
+  public void schedule() {
+    this.scheduler = new QueryScheduler(this.stateMachine, 
this.fragmentInstances);
+    this.scheduler.start();
+  }
+
+  // Analyze the statement in QueryContext. Generate the analysis this query 
need
+  public void analyze() {
+    // initialize the variable `analysis`
+
+  }
+
+  // Use LogicalPlanner to do the logical query plan and logical optimization
+  public void doLogicalPlan() {
+    LogicalPlanner planner = new LogicalPlanner(this.analysis, this.context, 
this.planOptimizers);
+    this.logicalPlan = planner.plan();
+  }
+
+  // Generate the distributed plan and split it into fragments
+  public void doDistributedPlan() {
+    DistributionPlanner planner = new DistributionPlanner(this.analysis, 
this.logicalPlan);
+    this.distributedPlan = planner.planFragments();
+  }
+
+  // Convert fragment to detailed instance
+  // And for parallel-able fragment, clone it into several instances with 
different params.
+  public void planFragmentInstances() {}
+
+  /**
+   * This method will be called by the request thread from client connection. 
This method will block
+   * until one of these conditions occurs: 1. There is a batch of result 2. 
There is no more result
+   * 3. The query has been cancelled 4. The query is timeout This method will 
fetch the result from
+   * DataStreamManager use the virtual ResultOperator's ID (This part will be 
designed and
+   * implemented with DataStreamManager)
+   */
+  public ByteBuffer getBatchResult() {
+    return null;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryScheduler.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryScheduler.java
new file mode 100644
index 0000000..fc5df30
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryScheduler.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.execution;
+
+import org.apache.iotdb.db.mpp.plan.FragmentInstance;
+
+import java.util.List;
+
+/**
+ * QueryScheduler is used to dispatch the fragment instances of a query to 
target nodes. And it will
+ * continue to collect and monitor the query execution before the query is 
finished.
+ *
+ * <p>Later, we can add more control logic for a QueryExecution such as retry, 
kill and so on by
+ * this scheduler.
+ */
+public class QueryScheduler {
+  // The stateMachine of the QueryExecution owned by this QueryScheduler
+  private QueryStateMachine stateMachine;
+
+  // The fragment instances which should be sent to corresponding Nodes.
+  private List<FragmentInstance> instances;
+
+  public QueryScheduler(QueryStateMachine stateMachine, List<FragmentInstance> 
instances) {
+    this.stateMachine = stateMachine;
+    this.instances = instances;
+  }
+
+  public void start() {}
+
+  // Send the instances to other nodes
+  private void sendFragmentInstances() {}
+
+  // After sending, start to collect the states of these fragment instances
+  private void startMonitorInstances() {}
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryStateMachine.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryStateMachine.java
new file mode 100644
index 0000000..d8ca6bd
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryStateMachine.java
@@ -0,0 +1,25 @@
+/*
+ * 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.execution;
+
+/**
+ * State machine for a QueryExecution. It stores the states for the 
QueryExecution. Others can
+ * register listeners when the state changes of the QueryExecution.
+ */
+public class QueryStateMachine {}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/operator/Operator.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/operator/Operator.java
new file mode 100644
index 0000000..aa7ae8a
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/operator/Operator.java
@@ -0,0 +1,49 @@
+/*
+ * 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.operator;
+
+import org.apache.iotdb.db.mpp.common.TsBlock;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+import static com.google.common.util.concurrent.Futures.immediateVoidFuture;
+
+public interface Operator extends AutoCloseable {
+  ListenableFuture<Void> NOT_BLOCKED = immediateVoidFuture();
+
+  OperatorContext getOperatorContext();
+
+  /**
+   * Returns a future that will be completed when the operator becomes 
unblocked. If the operator is
+   * not blocked, this method should return {@code NOT_BLOCKED}.
+   */
+  default ListenableFuture<Void> isBlocked() {
+    return NOT_BLOCKED;
+  }
+
+  /** Gets next tsBlock from this operator. If no data is currently available, 
return null. */
+  TsBlock next();
+
+  /** @return true if the operator has more data, otherwise false */
+  boolean hasNext();
+
+  /** This method will always be called before releasing the Operator 
reference. */
+  @Override
+  default void close() throws Exception {}
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/operator/OperatorContext.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/operator/OperatorContext.java
new file mode 100644
index 0000000..c635f74
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/operator/OperatorContext.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.operator;
+
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+/**
+ * Contains information about {@link Operator} execution.
+ *
+ * <p>Not thread-safe.
+ */
+public class OperatorContext {
+
+  private final int operatorId;
+  private final PlanNodeId planNodeId;
+  private final String operatorType;
+
+  public OperatorContext(int operatorId, PlanNodeId planNodeId, String 
operatorType) {
+    this.operatorId = operatorId;
+    this.planNodeId = planNodeId;
+    this.operatorType = operatorType;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/operator/SeriesScanOperator.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/operator/SeriesScanOperator.java
new file mode 100644
index 0000000..43969af
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/operator/SeriesScanOperator.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.operator;
+
+import org.apache.iotdb.db.mpp.common.TsBlock;
+
+public class SeriesScanOperator implements Operator {
+
+  @Override
+  public OperatorContext getOperatorContext() {
+    return null;
+  }
+
+  @Override
+  public TsBlock next() {
+    return null;
+  }
+
+  @Override
+  public boolean hasNext() {
+    return false;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/DistributedQueryPlan.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/DistributedQueryPlan.java
new file mode 100644
index 0000000..9954c74
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/DistributedQueryPlan.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan;
+
+import org.apache.iotdb.db.mpp.common.QueryContext;
+import org.apache.iotdb.db.mpp.common.TsBlock;
+import org.apache.iotdb.db.mpp.plan.node.PlanNode;
+
+import java.util.List;
+
+public class DistributedQueryPlan {
+  private QueryContext context;
+  private PlanNode<TsBlock> rootNode;
+  private PlanFragment rootFragment;
+
+  // TODO: consider whether this field is necessary when do the implementation
+  private List<PlanFragment> fragments;
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/DistributionPlanner.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/DistributionPlanner.java
new file mode 100644
index 0000000..03eb1dc
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/DistributionPlanner.java
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+import org.apache.iotdb.db.mpp.common.Analysis;
+
+public class DistributionPlanner {
+  private Analysis analysis;
+  private LogicalQueryPlan logicalPlan;
+
+  public DistributionPlanner(Analysis analysis, LogicalQueryPlan logicalPlan) {
+    this.analysis = analysis;
+    this.logicalPlan = logicalPlan;
+  }
+
+  public DistributedQueryPlan planFragments() {
+    return null;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/FragmentInstance.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/FragmentInstance.java
new file mode 100644
index 0000000..0b405b3
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/FragmentInstance.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan;
+
+public class FragmentInstance {
+  private FragmentInstanceId id;
+
+  // The reference of PlanFragment which this instance is generated from
+  private PlanFragment fragment;
+
+  // We can add some more params for a specific FragmentInstance
+  // So that we can make different FragmentInstance owns different data range.
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/FragmentInstanceId.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/FragmentInstanceId.java
new file mode 100644
index 0000000..18181cd
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/FragmentInstanceId.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan;
+
+public class FragmentInstanceId {
+  private String id;
+
+  public FragmentInstanceId(String id) {
+    this.id = id;
+  }
+
+  // A SinkOperator is needed here. So that we can know where the result of 
this instance can be
+  // sent
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/LogicalPlanner.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/LogicalPlanner.java
new file mode 100644
index 0000000..a74644b
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/LogicalPlanner.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan;
+
+import org.apache.iotdb.db.mpp.common.Analysis;
+import org.apache.iotdb.db.mpp.common.QueryContext;
+import org.apache.iotdb.db.mpp.plan.optimzation.PlanOptimizer;
+
+import java.util.List;
+
+public class LogicalPlanner {
+  private Analysis analysis;
+  private QueryContext context;
+  private List<PlanOptimizer> optimizers;
+
+  public LogicalPlanner(Analysis analysis, QueryContext context, 
List<PlanOptimizer> optimizers) {
+    this.analysis = analysis;
+    this.context = context;
+    this.optimizers = optimizers;
+  }
+
+  public LogicalQueryPlan plan() {
+    return null;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/LogicalQueryPlan.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/LogicalQueryPlan.java
new file mode 100644
index 0000000..5094df6
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/LogicalQueryPlan.java
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+import org.apache.iotdb.db.mpp.common.QueryContext;
+import org.apache.iotdb.db.mpp.common.TsBlock;
+import org.apache.iotdb.db.mpp.plan.node.PlanNode;
+
+/**
+ * LogicalQueryPlan represents a logical query plan. It stores the root node 
of corresponding query
+ * plan node tree.
+ */
+public class LogicalQueryPlan {
+  private QueryContext context;
+  private PlanNode<TsBlock> rootNode;
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/PlanFragment.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/PlanFragment.java
new file mode 100644
index 0000000..fc49264
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/PlanFragment.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan;
+
+import org.apache.iotdb.db.mpp.common.TsBlock;
+import org.apache.iotdb.db.mpp.plan.node.PlanNode;
+
+// TODO: consider whether it is necessary to make PlanFragment as a TreeNode
+/** PlanFragment contains a sub-query of distributed query. */
+public class PlanFragment {
+  private PlanFragmentId id;
+  private PlanNode<TsBlock> root;
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/PlanFragmentId.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/PlanFragmentId.java
new file mode 100644
index 0000000..39f8d17
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/PlanFragmentId.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan;
+
+public class PlanFragmentId {
+  private String id;
+
+  public PlanFragmentId(String id) {
+    this.id = id;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/PlanNode.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/PlanNode.java
new file mode 100644
index 0000000..1a3f103
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/PlanNode.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan.node;
+
+import org.apache.iotdb.db.mpp.common.TreeNode;
+
+/**
+ * @author xingtanzjr The base class of query executable operators, which is 
used to compose logical
+ *     query plan. TODO: consider how to restrict the children type for each 
type of ExecOperator
+ *     TODO: consider to fix the Template type as TsBlock
+ */
+public abstract class PlanNode<T> extends TreeNode<PlanNode<T>> {
+  private PlanNodeId id;
+
+  public PlanNode(PlanNodeId id) {
+    this.id = id;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/PlanNodeId.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/PlanNodeId.java
new file mode 100644
index 0000000..576fd64
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/PlanNodeId.java
@@ -0,0 +1,34 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.iotdb.db.mpp.plan.node;
+
+public class PlanNodeId {
+  private String id;
+
+  public PlanNodeId(String id) {
+    this.id = id;
+  }
+
+  public String getId() {
+    return this.id;
+  }
+
+  @Override
+  public String toString() {
+    return this.id;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/PlanNodeIdAllocator.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/PlanNodeIdAllocator.java
new file mode 100644
index 0000000..6e70c20
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/PlanNodeIdAllocator.java
@@ -0,0 +1,22 @@
+/*
+ * 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.node;
+
+/** A centralized PlanNodeId generator */
+public class PlanNodeIdAllocator {}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/DeviceMergeNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/DeviceMergeNode.java
new file mode 100644
index 0000000..9269545
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/DeviceMergeNode.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan.node.process;
+
+import org.apache.iotdb.db.mpp.common.OrderBy;
+import org.apache.iotdb.db.mpp.common.TsBlock;
+import org.apache.iotdb.db.mpp.common.WithoutPolicy;
+import org.apache.iotdb.db.mpp.plan.node.PlanNode;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+import java.util.Map;
+
+/**
+ * DeviceMergeOperator is responsible for constructing a device-based view of 
a set of series. And
+ * output the result with specific order. The order could be 'order by device' 
or 'order by
+ * timestamp'
+ *
+ * <p>Each output from its children should have the same schema. That means, 
the columns should be
+ * same between these TsBlocks. If the input TsBlock contains n columns, the 
device-based view will
+ * contain n+1 columns where the new column is Device column.
+ */
+public class DeviceMergeNode extends ProcessNode {
+  // The result output order that this operator
+  private OrderBy mergeOrder;
+
+  // The policy to decide whether a row should be discarded
+  // The without policy is able to be push down to the DeviceMergeNode because 
we can know whether a
+  // row contains
+  // null or not.
+  private WithoutPolicy withoutPolicy;
+
+  // The map from deviceName to corresponding query result node responsible 
for that device.
+  // DeviceNode means the node whose output TsBlock contains the data belonged 
to one device.
+  private Map<String, PlanNode<TsBlock>> childDeviceNodeMap;
+
+  public DeviceMergeNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public DeviceMergeNode(PlanNodeId id, Map<String, PlanNode<TsBlock>> 
deviceNodeMap) {
+    this(id);
+    this.childDeviceNodeMap = deviceNodeMap;
+    this.children.addAll(deviceNodeMap.values());
+  }
+
+  public void addChildDeviceNode(String deviceName, PlanNode<TsBlock> 
childNode) {
+    this.childDeviceNodeMap.put(deviceName, childNode);
+    this.children.add(childNode);
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/FillNode.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/FillNode.java
new file mode 100644
index 0000000..31e57cd
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/FillNode.java
@@ -0,0 +1,38 @@
+/*
+ * 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.node.process;
+
+import org.apache.iotdb.db.mpp.common.FillPolicy;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+/** FillNode is used to fill the empty field in one row. */
+public class FillNode extends ProcessNode {
+
+  // The policy to discard the result from upstream node
+  private FillPolicy fillPolicy;
+
+  public FillNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public FillNode(PlanNodeId id, FillPolicy fillPolicy) {
+    this(id);
+    this.fillPolicy = fillPolicy;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/FilterNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/FilterNode.java
new file mode 100644
index 0000000..a4cb88c
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/FilterNode.java
@@ -0,0 +1,38 @@
+/*
+ * 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.node.process;
+
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+import org.apache.iotdb.db.qp.logical.crud.FilterOperator;
+
+/** The FilterNode is responsible to filter the RowRecord from TsBlock. */
+public class FilterNode extends ProcessNode {
+
+  // The filter
+  private FilterOperator rowFilter;
+
+  public FilterNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public FilterNode(PlanNodeId id, FilterOperator rowFilter) {
+    this(id);
+    this.rowFilter = rowFilter;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/FilterNullNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/FilterNullNode.java
new file mode 100644
index 0000000..d7c463d
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/FilterNullNode.java
@@ -0,0 +1,38 @@
+/*
+ * 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.node.process;
+
+import org.apache.iotdb.db.mpp.common.WithoutPolicy;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+/** WithoutNode is used to discard specific rows from upstream node. */
+public class FilterNullNode extends ProcessNode {
+
+  // The policy to discard the result from upstream operator
+  private WithoutPolicy discardPolicy;
+
+  public FilterNullNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public FilterNullNode(PlanNodeId id, WithoutPolicy discardPolicy) {
+    this(id);
+    this.discardPolicy = discardPolicy;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/GroupByLevelNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/GroupByLevelNode.java
new file mode 100644
index 0000000..538d6d8
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/GroupByLevelNode.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan.node.process;
+
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+/**
+ * This node is responsible for the final aggregation merge operation. It will 
process the data from
+ * TsBlock row by row. For one row, it will rollup the fields which have the 
same aggregate function
+ * and belong to one bucket. Here, that two columns belong to one bucket means 
the partial paths of
+ * device after rolling up in specific level are the same. For example, let's 
say there are two
+ * columns `root.sg.d1.s1` and `root.sg.d2.s1`. If the group by level 
parameter is [0, 1], then
+ * these two columns will belong to one bucket and the bucket name is 
`root.sg.*.s1`. If the group
+ * by level parameter is [0, 2], then these two columns will not belong to one 
bucket. And the total
+ * buckets are `root.*.d1.s1` and `root.*.d2.s1`
+ */
+public class GroupByLevelNode extends ProcessNode {
+
+  private int[] groupByLevels;
+
+  public GroupByLevelNode(PlanNodeId id, int[] groupByLevels) {
+    super(id);
+    this.groupByLevels = groupByLevels;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/LimitNode.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/LimitNode.java
new file mode 100644
index 0000000..9596c1a
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/LimitNode.java
@@ -0,0 +1,37 @@
+/*
+ * 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.node.process;
+
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+/** LimitNode is used to select top n result. It uses the default order of 
upstream nodes */
+public class LimitNode extends ProcessNode {
+
+  // The limit count
+  private int limit;
+
+  public LimitNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public LimitNode(PlanNodeId id, int limit) {
+    this(id);
+    this.limit = limit;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/OffsetNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/OffsetNode.java
new file mode 100644
index 0000000..01e0e93
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/OffsetNode.java
@@ -0,0 +1,40 @@
+/*
+ * 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.node.process;
+
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+/**
+ * OffsetNode is used to skip top n result from upstream nodes. It uses the 
default order of
+ * upstream nodes
+ */
+public class OffsetNode extends ProcessNode {
+
+  // The limit count
+  private int offset;
+
+  public OffsetNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public OffsetNode(PlanNodeId id, int offset) {
+    this(id);
+    this.offset = offset;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/ProcessNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/ProcessNode.java
new file mode 100644
index 0000000..63e07b4
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/ProcessNode.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan.node.process;
+
+import org.apache.iotdb.db.mpp.common.TsBlock;
+import org.apache.iotdb.db.mpp.plan.node.PlanNode;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+public class ProcessNode extends PlanNode<TsBlock> {
+  public ProcessNode(PlanNodeId id) {
+    super(id);
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/RowBasedSeriesAggregateNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/RowBasedSeriesAggregateNode.java
new file mode 100644
index 0000000..9d7b943
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/RowBasedSeriesAggregateNode.java
@@ -0,0 +1,59 @@
+/*
+ * 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.node.process;
+
+import org.apache.iotdb.db.mpp.common.GroupByTimeParameter;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+import org.apache.iotdb.db.query.expression.unary.FunctionExpression;
+
+import java.util.List;
+
+/**
+ * This node is used to aggregate required series by raw data. The raw data 
will be input as a
+ * TsBlock. This node will output the series aggregated result represented by 
TsBlock Thus, the
+ * columns in output TsBlock will be different from input TsBlock.
+ */
+public class RowBasedSeriesAggregateNode extends ProcessNode {
+  // The parameter of `group by time`
+  // Its value will be null if there is no `group by time` clause,
+  private GroupByTimeParameter groupByTimeParameter;
+
+  // The list of aggregation functions, each FunctionExpression will be output 
as one column of
+  // result TsBlock
+  // (Currently we only support one series in the aggregation function)
+  // TODO: need consider whether it is suitable the aggregation function using 
FunctionExpression
+  private List<FunctionExpression> aggregateFuncList;
+
+  public RowBasedSeriesAggregateNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public RowBasedSeriesAggregateNode(PlanNodeId id, List<FunctionExpression> 
aggregateFuncList) {
+    this(id);
+    this.aggregateFuncList = aggregateFuncList;
+  }
+
+  public RowBasedSeriesAggregateNode(
+      PlanNodeId id,
+      List<FunctionExpression> aggregateFuncList,
+      GroupByTimeParameter groupByTimeParameter) {
+    this(id, aggregateFuncList);
+    this.groupByTimeParameter = groupByTimeParameter;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/SortNode.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/SortNode.java
new file mode 100644
index 0000000..1e83783
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/SortNode.java
@@ -0,0 +1,40 @@
+/*
+ * 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.node.process;
+
+import org.apache.iotdb.db.mpp.common.OrderBy;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+/**
+ * In general, the parameter in sortNode should be pushed down to the upstream 
operators. In our
+ * optimized logical query plan, the sortNode should not appear.
+ */
+public class SortNode extends ProcessNode {
+
+  private OrderBy sortOrder;
+
+  public SortNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public SortNode(PlanNodeId id, OrderBy sortOrder) {
+    this(id);
+    this.sortOrder = sortOrder;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/TimeJoinNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/TimeJoinNode.java
new file mode 100644
index 0000000..ab48cc4
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/process/TimeJoinNode.java
@@ -0,0 +1,67 @@
+/*
+ * 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.node.process;
+
+import org.apache.iotdb.db.mpp.common.OrderBy;
+import org.apache.iotdb.db.mpp.common.TsBlock;
+import org.apache.iotdb.db.mpp.common.WithoutPolicy;
+import org.apache.iotdb.db.mpp.plan.node.PlanNode;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+import java.util.Arrays;
+
+/**
+ * TimeJoinOperator is responsible for join two or more TsBlock. The join 
algorithm is like outer
+ * join by timestamp column. It will join two or more TsBlock by Timestamp 
column. The output result
+ * of TimeJoinOperator is sorted by timestamp
+ */
+// TODO: define the TimeJoinMergeNode for distributed plan
+public class TimeJoinNode extends ProcessNode {
+
+  // This parameter indicates the order when executing multiway merge sort.
+  private OrderBy mergeOrder;
+
+  // The policy to decide whether a row should be discarded
+  // The without policy is able to be push down to the TimeJoinOperator 
because we can know whether
+  // a row contains
+  // null or not.
+  private WithoutPolicy withoutPolicy;
+
+  public TimeJoinNode(PlanNodeId id) {
+    super(id);
+    this.mergeOrder = OrderBy.TIMESTAMP_ASC;
+  }
+
+  public TimeJoinNode(PlanNodeId id, PlanNode<TsBlock>... children) {
+    super(id);
+    this.children.addAll(Arrays.asList(children));
+  }
+
+  public void addChild(PlanNode<TsBlock> child) {
+    this.children.add(child);
+  }
+
+  public void setMergeOrder(OrderBy mergeOrder) {
+    this.mergeOrder = mergeOrder;
+  }
+
+  public void setWithoutPolicy(WithoutPolicy withoutPolicy) {
+    this.withoutPolicy = withoutPolicy;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/CsvSinkNode.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/CsvSinkNode.java
new file mode 100644
index 0000000..0bac6bf
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/CsvSinkNode.java
@@ -0,0 +1,33 @@
+/*
+ * 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.node.sink;
+
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+public class CsvSinkNode extends SinkNode {
+  public CsvSinkNode(PlanNodeId id) {
+    super(id);
+  }
+
+  @Override
+  public void close() throws Exception {}
+
+  @Override
+  public void send() {}
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/FragmentSinkNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/FragmentSinkNode.java
new file mode 100644
index 0000000..58c3a71
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/FragmentSinkNode.java
@@ -0,0 +1,33 @@
+/*
+ * 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.node.sink;
+
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+public class FragmentSinkNode extends SinkNode {
+  public FragmentSinkNode(PlanNodeId id) {
+    super(id);
+  }
+
+  @Override
+  public void send() {}
+
+  @Override
+  public void close() throws Exception {}
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/SinkNode.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/SinkNode.java
new file mode 100644
index 0000000..f59effb
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/SinkNode.java
@@ -0,0 +1,32 @@
+/*
+ * 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.node.sink;
+
+import org.apache.iotdb.db.mpp.common.TsBlock;
+import org.apache.iotdb.db.mpp.plan.node.PlanNode;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+public abstract class SinkNode extends PlanNode<TsBlock> implements 
AutoCloseable {
+
+  public SinkNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public abstract void send();
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/ThriftSinkNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/ThriftSinkNode.java
new file mode 100644
index 0000000..f5c48df
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/sink/ThriftSinkNode.java
@@ -0,0 +1,35 @@
+/*
+ * 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.node.sink;
+
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+/** not implemented in current IoTDB yet */
+public class ThriftSinkNode extends SinkNode {
+
+  public ThriftSinkNode(PlanNodeId id) {
+    super(id);
+  }
+
+  @Override
+  public void close() throws Exception {}
+
+  @Override
+  public void send() {}
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/CsvSourceNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/CsvSourceNode.java
new file mode 100644
index 0000000..a2a0fde
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/CsvSourceNode.java
@@ -0,0 +1,35 @@
+/*
+ * 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.node.source;
+
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+/** Not implemented in current version. */
+public class CsvSourceNode extends SourceNode {
+
+  public CsvSourceNode(PlanNodeId id) {
+    super(id);
+  }
+
+  @Override
+  public void close() throws Exception {}
+
+  @Override
+  public void open() throws Exception {}
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/SeriesAggregateNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/SeriesAggregateNode.java
new file mode 100644
index 0000000..80ea58f
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/SeriesAggregateNode.java
@@ -0,0 +1,81 @@
+/*
+ * 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.node.source;
+
+import org.apache.iotdb.db.mpp.common.GroupByTimeParameter;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+import org.apache.iotdb.db.query.expression.unary.FunctionExpression;
+import org.apache.iotdb.tsfile.read.filter.basic.Filter;
+
+/**
+ * SeriesAggregateOperator is responsible to do the aggregation calculation 
for one series. It will
+ * read the target series and calculate the aggregation result by the 
aggregation digest or raw data
+ * of this series.
+ *
+ * <p>The aggregation result will be represented as a TsBlock
+ *
+ * <p>This operator will split data of the target series into many groups by 
time range and do the
+ * aggregation calculation for each group. Each result will be one row of the 
result TsBlock. The
+ * timestamp of each row is the start time of the time range group.
+ *
+ * <p>If there is no time range split parameter, the result TsBlock will only 
contain one row, which
+ * represent the whole aggregation result of this series. And the timestamp 
will be 0, which is
+ * meaningless.
+ */
+public class SeriesAggregateNode extends SourceNode {
+
+  // The parameter of `group by time`
+  // Its value will be null if there is no `group by time` clause,
+  private GroupByTimeParameter groupByTimeParameter;
+
+  // The aggregation function, which contains the function name and related 
series.
+  // (Currently we only support one series in the aggregation function)
+  // TODO: need consider whether it is suitable the aggregation function using 
FunctionExpression
+  private FunctionExpression aggregateFunc;
+
+  private Filter filter;
+
+  public SeriesAggregateNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public SeriesAggregateNode(PlanNodeId id, FunctionExpression aggregateFunc) {
+    this(id);
+    this.aggregateFunc = aggregateFunc;
+  }
+
+  public SeriesAggregateNode(
+      PlanNodeId id, FunctionExpression aggregateFunc, GroupByTimeParameter 
groupByTimeParameter) {
+    this(id, aggregateFunc);
+    this.groupByTimeParameter = groupByTimeParameter;
+  }
+
+  @Override
+  public void open() throws Exception {}
+
+  @Override
+  public void close() throws Exception {}
+
+  // This method is used when do the PredicatePushDown.
+  // The filter is not put in the constructor because the filter is only clear 
in the predicate
+  // push-down stage
+  public void setFilter(Filter filter) {
+    this.filter = filter;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/SeriesScanNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/SeriesScanNode.java
new file mode 100644
index 0000000..ccfae5c
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/SeriesScanNode.java
@@ -0,0 +1,85 @@
+/*
+ * 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.node.source;
+
+import org.apache.iotdb.db.metadata.path.PartialPath;
+import org.apache.iotdb.db.mpp.common.OrderBy;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+import org.apache.iotdb.tsfile.read.filter.basic.Filter;
+
+/**
+ * SeriesScanOperator is responsible for read data a specific series. When 
reading data, the
+ * SeriesScanOperator can read the raw data batch by batch. And also, it can 
leverage the filter and
+ * other info to decrease the result set.
+ *
+ * <p>Children type: no child is allowed for SeriesScanNode
+ */
+public class SeriesScanNode extends SourceNode {
+
+  // The path of the target series which will be scanned.
+  private PartialPath seriesPath;
+
+  // The order to traverse the data.
+  // Currently, we only support TIMESTAMP_ASC and TIMESTAMP_DESC here.
+  // The default order is TIMESTAMP_ASC, which means "order by timestamp asc"
+  private OrderBy scanOrder = OrderBy.TIMESTAMP_ASC;
+
+  // time filter for current series, could be null if doesn't exist
+  private Filter timeFilter;
+
+  // value filter for current series, could be null if doesn't exist
+  private Filter valueFilter;
+
+  // Limit for result set. The default value is -1, which means no limit
+  private int limit;
+
+  // offset for result set. The default value is 0
+  private int offset;
+
+  public SeriesScanNode(PlanNodeId id, PartialPath seriesPath) {
+    super(id);
+    this.seriesPath = seriesPath;
+  }
+
+  public void setTimeFilter(Filter timeFilter) {
+    this.timeFilter = timeFilter;
+  }
+
+  public void setValueFilter(Filter valueFilter) {
+    this.valueFilter = valueFilter;
+  }
+
+  @Override
+  public void close() throws Exception {}
+
+  @Override
+  public void open() throws Exception {}
+
+  public void setScanOrder(OrderBy scanOrder) {
+    this.scanOrder = scanOrder;
+  }
+
+  public void setLimit(int limit) {
+    this.limit = limit;
+  }
+
+  public void setOffset(int offset) {
+    this.offset = offset;
+  }
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/SourceNode.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/SourceNode.java
new file mode 100644
index 0000000..c83da97
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/node/source/SourceNode.java
@@ -0,0 +1,32 @@
+/*
+ * 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.node.source;
+
+import org.apache.iotdb.db.mpp.common.TsBlock;
+import org.apache.iotdb.db.mpp.plan.node.PlanNode;
+import org.apache.iotdb.db.mpp.plan.node.PlanNodeId;
+
+public abstract class SourceNode extends PlanNode<TsBlock> implements 
AutoCloseable {
+
+  public SourceNode(PlanNodeId id) {
+    super(id);
+  }
+
+  public abstract void open() throws Exception;
+}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/optimzation/PlanOptimizer.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/optimzation/PlanOptimizer.java
new file mode 100644
index 0000000..b99c5db
--- /dev/null
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/optimzation/PlanOptimizer.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.db.mpp.plan.optimzation;
+
+import org.apache.iotdb.db.mpp.common.QueryContext;
+import org.apache.iotdb.db.mpp.common.TsBlock;
+import org.apache.iotdb.db.mpp.plan.node.PlanNode;
+
+public interface PlanOptimizer {
+  PlanNode<TsBlock> optimize(PlanNode<TsBlock> plan, QueryContext context);
+}

Reply via email to