This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a commit to branch ty/TableModelGrammar
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/ty/TableModelGrammar by this
push:
new ac889ce8dc4 Try previously break if limit has been consumed up in
TableScanOperator
ac889ce8dc4 is described below
commit ac889ce8dc42746a568dc2d002493fbb84506a63
Author: Jackie Tien <[email protected]>
AuthorDate: Mon Jul 8 14:23:27 2024 +0800
Try previously break if limit has been consumed up in TableScanOperator
---
.../operator/source/relational/TableScanOperator.java | 4 ++--
.../plan/planner/plan/parameter/SeriesScanOptions.java | 11 +++++++++++
.../plan/relational/planner/node/TableScanNode.java | 4 ++++
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableScanOperator.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableScanOperator.java
index deded9e1bd6..7ceefaa9310 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableScanOperator.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/TableScanOperator.java
@@ -245,12 +245,12 @@ public class TableScanOperator extends
AbstractSeriesScanOperator {
@Override
public boolean hasNext() throws Exception {
- return currentDeviceIndex < deviceCount;
+ return !isFinished();
}
@Override
public boolean isFinished() throws Exception {
- return currentDeviceIndex >= deviceCount;
+ return currentDeviceIndex >= deviceCount ||
seriesScanOptions.limitConsumedUp();
}
@Override
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/SeriesScanOptions.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/SeriesScanOptions.java
index 1bd6892541c..dea62b9cf05 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/SeriesScanOptions.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/parameter/SeriesScanOptions.java
@@ -117,6 +117,17 @@ public class SeriesScanOptions {
return filter;
}
+ /**
+ * pushLimitToEachDevice==false means that all devices return total limit
rows.
+ *
+ * @return true only if pushLimitToEachDevice==false and limit in
paginationController has already
+ * consumed up
+ */
+ public boolean limitConsumedUp() {
+ return !pushLimitToEachDevice
+ && (paginationController != null &&
!paginationController.hasCurLimit());
+ }
+
public static class Builder {
private Filter globalTimeFilter = null;
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/node/TableScanNode.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/node/TableScanNode.java
index d8380bd892f..c4283bb654a 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/node/TableScanNode.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/node/TableScanNode.java
@@ -81,6 +81,10 @@ public class TableScanNode extends SourceNode {
// push down offset for result set. The default value is 0
private long pushDownOffset;
+ // pushLimitToEachDevice == true means that each device in TableScanNode
need to return
+ // `pushDownLimit` row number
+ // pushLimitToEachDevice == false means that all devices in TableScanNode
totally need to return
+ // `pushDownLimit` row number
private boolean pushLimitToEachDevice = false;
// The id of DataRegion where the node will run