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

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

commit 0362e7b0ead161b2767e7d0e55bc9f907dd1a764
Author: Minghui Liu <[email protected]>
AuthorDate: Sun Jan 7 22:23:31 2024 +0800

    add SeriesScanSourceNode
---
 .../plan/planner/plan/node/PlanVisitor.java        |   9 +-
 .../plan/node/source/AlignedSeriesScanNode.java    | 130 +++-------------
 .../planner/plan/node/source/SeriesScanNode.java   | 118 ++-------------
 ...riesScanNode.java => SeriesScanSourceNode.java} | 163 +++++----------------
 4 files changed, 70 insertions(+), 350 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanVisitor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanVisitor.java
index ed7072a76eb..e9a17d9d8e9 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanVisitor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanVisitor.java
@@ -97,6 +97,7 @@ import 
org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.LastQuerySc
 import 
org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.SeriesAggregationScanNode;
 import 
org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.SeriesAggregationSourceNode;
 import 
org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.SeriesScanNode;
+import 
org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.SeriesScanSourceNode;
 import 
org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.ShowQueriesNode;
 import 
org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.SourceNode;
 import 
org.apache.iotdb.db.queryengine.plan.planner.plan.node.write.DeleteDataNode;
@@ -125,12 +126,16 @@ public abstract class PlanVisitor<R, C> {
     return visitPlan(node, context);
   }
 
-  public R visitSeriesScan(SeriesScanNode node, C context) {
+  public R visitSeriesScanSource(SeriesScanSourceNode node, C context) {
     return visitSourceNode(node, context);
   }
 
+  public R visitSeriesScan(SeriesScanNode node, C context) {
+    return visitSeriesScanSource(node, context);
+  }
+
   public R visitAlignedSeriesScan(AlignedSeriesScanNode node, C context) {
-    return visitSourceNode(node, context);
+    return visitSeriesScanSource(node, context);
   }
 
   public R visitSeriesAggregationSourceNode(SeriesAggregationSourceNode node, 
C context) {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/AlignedSeriesScanNode.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/AlignedSeriesScanNode.java
index 8e0eaba141a..cb01a70ccee 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/AlignedSeriesScanNode.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/AlignedSeriesScanNode.java
@@ -34,8 +34,6 @@ import 
org.apache.iotdb.db.queryengine.plan.statement.component.Ordering;
 import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
 import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
 
-import com.google.common.collect.ImmutableList;
-
 import javax.annotation.Nullable;
 
 import java.io.DataOutputStream;
@@ -45,32 +43,15 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 
-public class AlignedSeriesScanNode extends SeriesSourceNode {
+public class AlignedSeriesScanNode extends SeriesScanSourceNode {
 
   // The paths of the target series which will be scanned.
   private final AlignedPath alignedPath;
 
-  // 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 Ordering scanOrder = Ordering.ASC;
-
-  // push down predicate for current series, could be null if it doesn't exist
-  @Nullable private Expression pushDownPredicate;
-
-  // push down limit for result set. The default value is -1, which means no 
limit
-  private long pushDownLimit;
-
-  // push down offset for result set. The default value is 0
-  private long pushDownOffset;
-
   // used for limit and offset push down optimizer, if we select all columns 
from aligned device, we
   // can use statistics to skip
   private boolean queryAllSensors = false;
 
-  // The id of DataRegion where the node will run
-  private TRegionReplicaSet regionReplicaSet;
-
   public AlignedSeriesScanNode(PlanNodeId id, AlignedPath alignedPath) {
     super(id);
     this.alignedPath = alignedPath;
@@ -78,8 +59,8 @@ public class AlignedSeriesScanNode extends SeriesSourceNode {
 
   public AlignedSeriesScanNode(
       PlanNodeId id, AlignedPath alignedPath, Ordering scanOrder, boolean 
lastLevelUseWildcard) {
-    this(id, alignedPath);
-    this.scanOrder = scanOrder;
+    super(id, scanOrder);
+    this.alignedPath = alignedPath;
     this.queryAllSensors = lastLevelUseWildcard;
   }
 
@@ -91,10 +72,9 @@ public class AlignedSeriesScanNode extends SeriesSourceNode {
       long pushDownOffset,
       TRegionReplicaSet dataRegionReplicaSet,
       boolean lastLevelUseWildcard) {
-    this(id, alignedPath, scanOrder, lastLevelUseWildcard);
-    this.pushDownLimit = pushDownLimit;
-    this.pushDownOffset = pushDownOffset;
-    this.regionReplicaSet = dataRegionReplicaSet;
+    super(id, scanOrder, pushDownLimit, pushDownOffset, dataRegionReplicaSet);
+    this.alignedPath = alignedPath;
+    this.queryAllSensors = lastLevelUseWildcard;
   }
 
   public AlignedSeriesScanNode(
@@ -106,86 +86,24 @@ public class AlignedSeriesScanNode extends 
SeriesSourceNode {
       long pushDownOffset,
       TRegionReplicaSet dataRegionReplicaSet,
       boolean lastLevelUseWildcard) {
-    this(id, alignedPath, scanOrder, lastLevelUseWildcard);
-    this.pushDownPredicate = pushDownPredicate;
-    this.pushDownLimit = pushDownLimit;
-    this.pushDownOffset = pushDownOffset;
-    this.regionReplicaSet = dataRegionReplicaSet;
-  }
-
-  public AlignedPath getAlignedPath() {
-    return alignedPath;
-  }
-
-  public Ordering getScanOrder() {
-    return scanOrder;
-  }
-
-  @Nullable
-  @Override
-  public Expression getPushDownPredicate() {
-    return pushDownPredicate;
-  }
-
-  public void setPushDownPredicate(@Nullable Expression pushDownPredicate) {
-    this.pushDownPredicate = pushDownPredicate;
-  }
-
-  public long getPushDownLimit() {
-    return pushDownLimit;
-  }
-
-  public long getPushDownOffset() {
-    return pushDownOffset;
-  }
-
-  public void setPushDownLimit(long pushDownLimit) {
-    this.pushDownLimit = pushDownLimit;
-  }
-
-  public void setPushDownOffset(long pushDownOffset) {
-    this.pushDownOffset = pushDownOffset;
-  }
-
-  @Override
-  public void open() throws Exception {
-    // Do nothing
-  }
-
-  @Override
-  public TRegionReplicaSet getRegionReplicaSet() {
-    return regionReplicaSet;
-  }
-
-  @Override
-  public void setRegionReplicaSet(TRegionReplicaSet regionReplicaSet) {
-    this.regionReplicaSet = regionReplicaSet;
-  }
-
-  @Override
-  public void close() throws Exception {
-    // Do nothing
+    super(id, scanOrder, pushDownPredicate, pushDownLimit, pushDownOffset, 
dataRegionReplicaSet);
+    this.alignedPath = alignedPath;
+    this.queryAllSensors = lastLevelUseWildcard;
   }
 
   @Override
-  public List<PlanNode> getChildren() {
-    return ImmutableList.of();
+  public String getSourceSymbol() {
+    return alignedPath.getDevice();
   }
 
-  @Override
-  public int allowedChildCount() {
-    return NO_CHILD_ALLOWED;
+  public AlignedPath getAlignedPath() {
+    return alignedPath;
   }
 
   public boolean isQueryAllSensors() {
     return queryAllSensors;
   }
 
-  @Override
-  public void addChild(PlanNode child) {
-    throw new UnsupportedOperationException("no child is allowed for 
AlignedSeriesScanNode");
-  }
-
   @Override
   public PlanNode clone() {
     return new AlignedSeriesScanNode(
@@ -195,8 +113,8 @@ public class AlignedSeriesScanNode extends SeriesSourceNode 
{
         getPushDownPredicate(),
         getPushDownLimit(),
         getPushDownOffset(),
-        this.regionReplicaSet,
-        this.queryAllSensors);
+        getRegionReplicaSet(),
+        isQueryAllSensors());
   }
 
   @Override
@@ -315,26 +233,12 @@ public class AlignedSeriesScanNode extends 
SeriesSourceNode {
       return false;
     }
     AlignedSeriesScanNode that = (AlignedSeriesScanNode) o;
-    return pushDownLimit == that.pushDownLimit
-        && pushDownOffset == that.pushDownOffset
-        && alignedPath.equals(that.alignedPath)
-        && scanOrder == that.scanOrder
-        && Objects.equals(pushDownPredicate, that.pushDownPredicate)
-        && Objects.equals(queryAllSensors, that.queryAllSensors)
-        && Objects.equals(regionReplicaSet, that.regionReplicaSet);
+    return queryAllSensors == that.queryAllSensors && 
alignedPath.equals(that.alignedPath);
   }
 
   @Override
   public int hashCode() {
-    return Objects.hash(
-        super.hashCode(),
-        alignedPath,
-        scanOrder,
-        pushDownPredicate,
-        pushDownLimit,
-        pushDownOffset,
-        regionReplicaSet,
-        queryAllSensors);
+    return Objects.hash(super.hashCode(), alignedPath, queryAllSensors);
   }
 
   public String toString() {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/SeriesScanNode.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/SeriesScanNode.java
index 1d30b6e020a..be48a51f6bd 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/SeriesScanNode.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/SeriesScanNode.java
@@ -48,36 +48,19 @@ import java.util.Objects;
  *
  * <p>Children type: no child is allowed for SeriesScanNode
  */
-public class SeriesScanNode extends SeriesSourceNode {
+public class SeriesScanNode extends SeriesScanSourceNode {
 
   // The path of the target series which will be scanned.
   private final MeasurementPath 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 Ordering scanOrder = Ordering.ASC;
-
-  // push down predicate for current series, could be null if doesn't exist
-  @Nullable private Expression pushDownPredicate;
-
-  // push down limit for result set. The default value is -1, which means no 
limit
-  private long pushDownLimit;
-
-  // push down offset for result set. The default value is 0
-  private long pushDownOffset;
-
-  // The id of DataRegion where the node will run
-  private TRegionReplicaSet regionReplicaSet;
-
   public SeriesScanNode(PlanNodeId id, MeasurementPath seriesPath) {
     super(id);
     this.seriesPath = seriesPath;
   }
 
   public SeriesScanNode(PlanNodeId id, MeasurementPath seriesPath, Ordering 
scanOrder) {
-    this(id, seriesPath);
-    this.scanOrder = scanOrder;
+    super(id, scanOrder);
+    this.seriesPath = seriesPath;
   }
 
   public SeriesScanNode(
@@ -87,10 +70,8 @@ public class SeriesScanNode extends SeriesSourceNode {
       long pushDownLimit,
       long pushDownOffset,
       TRegionReplicaSet dataRegionReplicaSet) {
-    this(id, seriesPath, scanOrder);
-    this.pushDownLimit = pushDownLimit;
-    this.pushDownOffset = pushDownOffset;
-    this.regionReplicaSet = dataRegionReplicaSet;
+    super(id, scanOrder, pushDownLimit, pushDownOffset, dataRegionReplicaSet);
+    this.seriesPath = seriesPath;
   }
 
   public SeriesScanNode(
@@ -101,82 +82,19 @@ public class SeriesScanNode extends SeriesSourceNode {
       long pushDownLimit,
       long pushDownOffset,
       TRegionReplicaSet dataRegionReplicaSet) {
-    this(id, seriesPath, scanOrder);
-    this.pushDownPredicate = pushDownPredicate;
-    this.pushDownLimit = pushDownLimit;
-    this.pushDownOffset = pushDownOffset;
-    this.regionReplicaSet = dataRegionReplicaSet;
-  }
-
-  @Override
-  public void close() throws Exception {}
-
-  @Override
-  public void open() throws Exception {}
-
-  @Override
-  public TRegionReplicaSet getRegionReplicaSet() {
-    return regionReplicaSet;
+    super(id, scanOrder, pushDownPredicate, pushDownLimit, pushDownOffset, 
dataRegionReplicaSet);
+    this.seriesPath = seriesPath;
   }
 
   @Override
-  public void setRegionReplicaSet(TRegionReplicaSet dataRegion) {
-    this.regionReplicaSet = dataRegion;
-  }
-
-  public long getPushDownLimit() {
-    return pushDownLimit;
-  }
-
-  public long getPushDownOffset() {
-    return pushDownOffset;
-  }
-
-  public void setPushDownLimit(long pushDownLimit) {
-    this.pushDownLimit = pushDownLimit;
-  }
-
-  public void setPushDownOffset(long pushDownOffset) {
-    this.pushDownOffset = pushDownOffset;
-  }
-
-  public Ordering getScanOrder() {
-    return scanOrder;
-  }
-
-  public void setScanOrder(Ordering scanOrder) {
-    this.scanOrder = scanOrder;
+  public String getSourceSymbol() {
+    return seriesPath.getFullPath();
   }
 
   public MeasurementPath getSeriesPath() {
     return seriesPath;
   }
 
-  @Nullable
-  @Override
-  public Expression getPushDownPredicate() {
-    return pushDownPredicate;
-  }
-
-  public void setPushDownPredicate(@Nullable Expression pushDownPredicate) {
-    this.pushDownPredicate = pushDownPredicate;
-  }
-
-  @Override
-  public List<PlanNode> getChildren() {
-    return ImmutableList.of();
-  }
-
-  @Override
-  public int allowedChildCount() {
-    return NO_CHILD_ALLOWED;
-  }
-
-  @Override
-  public void addChild(PlanNode child) {
-    throw new UnsupportedOperationException("no child is allowed for 
SeriesScanNode");
-  }
-
   @Override
   public PlanNode clone() {
     return new SeriesScanNode(
@@ -186,7 +104,7 @@ public class SeriesScanNode extends SeriesSourceNode {
         getPushDownPredicate(),
         getPushDownLimit(),
         getPushDownOffset(),
-        this.regionReplicaSet);
+        getRegionReplicaSet());
   }
 
   @Override
@@ -265,24 +183,12 @@ public class SeriesScanNode extends SeriesSourceNode {
       return false;
     }
     SeriesScanNode that = (SeriesScanNode) o;
-    return pushDownLimit == that.pushDownLimit
-        && pushDownOffset == that.pushDownOffset
-        && seriesPath.equals(that.seriesPath)
-        && scanOrder == that.scanOrder
-        && Objects.equals(pushDownPredicate, that.pushDownPredicate)
-        && Objects.equals(regionReplicaSet, that.regionReplicaSet);
+    return seriesPath.equals(that.seriesPath);
   }
 
   @Override
   public int hashCode() {
-    return Objects.hash(
-        super.hashCode(),
-        seriesPath,
-        scanOrder,
-        pushDownPredicate,
-        pushDownLimit,
-        pushDownOffset,
-        regionReplicaSet);
+    return Objects.hash(super.hashCode(), seriesPath);
   }
 
   @Override
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/SeriesScanNode.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/SeriesScanSourceNode.java
similarity index 51%
copy from 
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/SeriesScanNode.java
copy to 
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/SeriesScanSourceNode.java
index 1d30b6e020a..fe9589f6c40 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/SeriesScanNode.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/SeriesScanSourceNode.java
@@ -16,113 +16,80 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.iotdb.db.queryengine.plan.planner.plan.node.source;
 
 import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
-import org.apache.iotdb.commons.path.MeasurementPath;
-import org.apache.iotdb.commons.path.PartialPath;
-import org.apache.iotdb.commons.path.PathDeserializeUtil;
 import org.apache.iotdb.db.queryengine.plan.expression.Expression;
 import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
 import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId;
-import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeType;
-import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeUtil;
 import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanVisitor;
 import org.apache.iotdb.db.queryengine.plan.statement.component.Ordering;
-import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
 
 import com.google.common.collect.ImmutableList;
 
 import javax.annotation.Nullable;
 
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.List;
 import java.util.Objects;
 
-/**
- * SeriesScanNode is responsible for read data a specific series. When reading 
data, the
- * SeriesScanNode 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 SeriesSourceNode {
-
-  // The path of the target series which will be scanned.
-  private final MeasurementPath seriesPath;
+public abstract class SeriesScanSourceNode extends SeriesSourceNode {
 
   // 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 Ordering scanOrder = Ordering.ASC;
+  protected Ordering scanOrder = Ordering.ASC;
 
   // push down predicate for current series, could be null if doesn't exist
-  @Nullable private Expression pushDownPredicate;
+  @Nullable protected Expression pushDownPredicate;
 
   // push down limit for result set. The default value is -1, which means no 
limit
-  private long pushDownLimit;
+  protected long pushDownLimit;
 
   // push down offset for result set. The default value is 0
-  private long pushDownOffset;
+  protected long pushDownOffset;
 
   // The id of DataRegion where the node will run
-  private TRegionReplicaSet regionReplicaSet;
+  protected TRegionReplicaSet regionReplicaSet;
 
-  public SeriesScanNode(PlanNodeId id, MeasurementPath seriesPath) {
+  protected SeriesScanSourceNode(PlanNodeId id) {
     super(id);
-    this.seriesPath = seriesPath;
   }
 
-  public SeriesScanNode(PlanNodeId id, MeasurementPath seriesPath, Ordering 
scanOrder) {
-    this(id, seriesPath);
+  protected SeriesScanSourceNode(PlanNodeId id, Ordering scanOrder) {
+    super(id);
     this.scanOrder = scanOrder;
   }
 
-  public SeriesScanNode(
+  protected SeriesScanSourceNode(
       PlanNodeId id,
-      MeasurementPath seriesPath,
       Ordering scanOrder,
       long pushDownLimit,
       long pushDownOffset,
       TRegionReplicaSet dataRegionReplicaSet) {
-    this(id, seriesPath, scanOrder);
+    super(id);
+    this.scanOrder = scanOrder;
     this.pushDownLimit = pushDownLimit;
     this.pushDownOffset = pushDownOffset;
     this.regionReplicaSet = dataRegionReplicaSet;
   }
 
-  public SeriesScanNode(
+  protected SeriesScanSourceNode(
       PlanNodeId id,
-      MeasurementPath seriesPath,
       Ordering scanOrder,
       @Nullable Expression pushDownPredicate,
       long pushDownLimit,
       long pushDownOffset,
       TRegionReplicaSet dataRegionReplicaSet) {
-    this(id, seriesPath, scanOrder);
+    super(id);
+    this.scanOrder = scanOrder;
     this.pushDownPredicate = pushDownPredicate;
     this.pushDownLimit = pushDownLimit;
     this.pushDownOffset = pushDownOffset;
     this.regionReplicaSet = dataRegionReplicaSet;
   }
 
-  @Override
-  public void close() throws Exception {}
-
-  @Override
-  public void open() throws Exception {}
-
-  @Override
-  public TRegionReplicaSet getRegionReplicaSet() {
-    return regionReplicaSet;
-  }
-
-  @Override
-  public void setRegionReplicaSet(TRegionReplicaSet dataRegion) {
-    this.regionReplicaSet = dataRegion;
-  }
+  public abstract String getSourceSymbol();
 
   public long getPushDownLimit() {
     return pushDownLimit;
@@ -148,10 +115,6 @@ public class SeriesScanNode extends SeriesSourceNode {
     this.scanOrder = scanOrder;
   }
 
-  public MeasurementPath getSeriesPath() {
-    return seriesPath;
-  }
-
   @Nullable
   @Override
   public Expression getPushDownPredicate() {
@@ -163,94 +126,43 @@ public class SeriesScanNode extends SeriesSourceNode {
   }
 
   @Override
-  public List<PlanNode> getChildren() {
-    return ImmutableList.of();
-  }
-
-  @Override
-  public int allowedChildCount() {
-    return NO_CHILD_ALLOWED;
+  public TRegionReplicaSet getRegionReplicaSet() {
+    return regionReplicaSet;
   }
 
   @Override
-  public void addChild(PlanNode child) {
-    throw new UnsupportedOperationException("no child is allowed for 
SeriesScanNode");
+  public void setRegionReplicaSet(TRegionReplicaSet dataRegion) {
+    this.regionReplicaSet = dataRegion;
   }
 
   @Override
-  public PlanNode clone() {
-    return new SeriesScanNode(
-        getPlanNodeId(),
-        getSeriesPath(),
-        getScanOrder(),
-        getPushDownPredicate(),
-        getPushDownLimit(),
-        getPushDownOffset(),
-        this.regionReplicaSet);
+  public void close() throws Exception {
+    // do nothing
   }
 
   @Override
-  public List<String> getOutputColumnNames() {
-    return ImmutableList.of(seriesPath.getFullPath());
+  public void open() throws Exception {
+    // do nothing
   }
 
   @Override
-  public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
-    return visitor.visitSeriesScan(this, context);
+  public List<PlanNode> getChildren() {
+    return ImmutableList.of();
   }
 
   @Override
-  protected void serializeAttributes(ByteBuffer byteBuffer) {
-    PlanNodeType.SERIES_SCAN.serialize(byteBuffer);
-    seriesPath.serialize(byteBuffer);
-    ReadWriteIOUtils.write(scanOrder.ordinal(), byteBuffer);
-    if (pushDownPredicate == null) {
-      ReadWriteIOUtils.write((byte) 0, byteBuffer);
-    } else {
-      ReadWriteIOUtils.write((byte) 1, byteBuffer);
-      Expression.serialize(pushDownPredicate, byteBuffer);
-    }
-    ReadWriteIOUtils.write(pushDownLimit, byteBuffer);
-    ReadWriteIOUtils.write(pushDownOffset, byteBuffer);
+  public int allowedChildCount() {
+    return NO_CHILD_ALLOWED;
   }
 
   @Override
-  protected void serializeAttributes(DataOutputStream stream) throws 
IOException {
-    PlanNodeType.SERIES_SCAN.serialize(stream);
-    seriesPath.serialize(stream);
-    ReadWriteIOUtils.write(scanOrder.ordinal(), stream);
-    if (pushDownPredicate == null) {
-      ReadWriteIOUtils.write((byte) 0, stream);
-    } else {
-      ReadWriteIOUtils.write((byte) 1, stream);
-      Expression.serialize(pushDownPredicate, stream);
-    }
-    ReadWriteIOUtils.write(pushDownLimit, stream);
-    ReadWriteIOUtils.write(pushDownOffset, stream);
-  }
-
-  public static SeriesScanNode deserialize(ByteBuffer byteBuffer) {
-    MeasurementPath partialPath = (MeasurementPath) 
PathDeserializeUtil.deserialize(byteBuffer);
-    Ordering scanOrder = 
Ordering.values()[ReadWriteIOUtils.readInt(byteBuffer)];
-    byte isNull = ReadWriteIOUtils.readByte(byteBuffer);
-    Expression pushDownPredicate = null;
-    if (isNull == 1) {
-      pushDownPredicate = Expression.deserialize(byteBuffer);
-    }
-    long limit = ReadWriteIOUtils.readLong(byteBuffer);
-    long offset = ReadWriteIOUtils.readLong(byteBuffer);
-    PlanNodeId planNodeId = PlanNodeId.deserialize(byteBuffer);
-    return new SeriesScanNode(
-        planNodeId, partialPath, scanOrder, pushDownPredicate, limit, offset, 
null);
+  public void addChild(PlanNode child) {
+    throw new UnsupportedOperationException("no child is allowed for 
SeriesScanSourceNode");
   }
 
   @Override
-  public String toString() {
-    return String.format(
-        "SeriesScanNode-%s:[SeriesPath: %s, DataRegion: %s]",
-        this.getPlanNodeId(),
-        this.getSeriesPath(),
-        PlanNodeUtil.printRegionReplicaSet(getRegionReplicaSet()));
+  public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
+    return visitor.visitSeriesScanSource(this, context);
   }
 
   @Override
@@ -264,10 +176,9 @@ public class SeriesScanNode extends SeriesSourceNode {
     if (!super.equals(o)) {
       return false;
     }
-    SeriesScanNode that = (SeriesScanNode) o;
+    SeriesScanSourceNode that = (SeriesScanSourceNode) o;
     return pushDownLimit == that.pushDownLimit
         && pushDownOffset == that.pushDownOffset
-        && seriesPath.equals(that.seriesPath)
         && scanOrder == that.scanOrder
         && Objects.equals(pushDownPredicate, that.pushDownPredicate)
         && Objects.equals(regionReplicaSet, that.regionReplicaSet);
@@ -277,16 +188,10 @@ public class SeriesScanNode extends SeriesSourceNode {
   public int hashCode() {
     return Objects.hash(
         super.hashCode(),
-        seriesPath,
         scanOrder,
         pushDownPredicate,
         pushDownLimit,
         pushDownOffset,
         regionReplicaSet);
   }
-
-  @Override
-  public PartialPath getPartitionPath() {
-    return getSeriesPath();
-  }
 }

Reply via email to