This is an automated email from the ASF dual-hosted git repository.
xiangweiwei pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.12 by this push:
new a7bba6d [To rel/0.12][IOTDB-2194] Fix 0.12 show timeseries (#4627)
a7bba6d is described below
commit a7bba6db30b3fa92317fac1c5b1450aca6756419
Author: ZhangHongYin <[email protected]>
AuthorDate: Fri Dec 24 10:55:45 2021 +0800
[To rel/0.12][IOTDB-2194] Fix 0.12 show timeseries (#4627)
Co-authored-by: Yifu Zhou <[email protected]>
---
.../java/org/apache/iotdb/cluster/metadata/CMManager.java | 12 ++++++++++--
.../java/org/apache/iotdb/db/qp/physical/sys/ShowPlan.java | 1 -
.../java/org/apache/iotdb/db/query/dataset/ShowDataSet.java | 12 +-----------
3 files changed, 11 insertions(+), 14 deletions(-)
diff --git
a/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
b/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
index 4ef2e12..de09f7e 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
@@ -1581,7 +1581,11 @@ public class CMManager extends MManager {
// do not use limit and offset in sub-queries unless offset is 0,
otherwise the results are
// not combinable
if (offset != 0) {
- plan.setLimit(0);
+ if (limit > Integer.MAX_VALUE - offset) {
+ plan.setLimit(0);
+ } else {
+ plan.setLimit(limit + offset);
+ }
plan.setOffset(0);
}
@@ -1634,7 +1638,11 @@ public class CMManager extends MManager {
// do not use limit and offset in sub-queries unless offset is 0,
otherwise the results are
// not combinable
if (offset != 0) {
- plan.setLimit(0);
+ if (limit > Integer.MAX_VALUE - offset) {
+ plan.setLimit(0);
+ } else {
+ plan.setLimit(limit + offset);
+ }
plan.setOffset(0);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPlan.java
b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPlan.java
index 94d74b5..9342e10 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/sys/ShowPlan.java
@@ -51,7 +51,6 @@ public class ShowPlan extends PhysicalPlan {
this.limit = limit;
this.offset = offset;
if (limit == 0) {
- this.limit = fetchSize;
this.hasLimit = false;
} else {
this.hasLimit = true;
diff --git
a/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowDataSet.java
b/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowDataSet.java
index 97b4239..626cca1 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowDataSet.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/dataset/ShowDataSet.java
@@ -28,7 +28,6 @@ import org.apache.iotdb.tsfile.read.common.RowRecord;
import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
import org.apache.iotdb.tsfile.utils.Binary;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -43,16 +42,7 @@ public abstract class ShowDataSet extends QueryDataSet {
}
@Override
- public boolean hasNextWithoutConstraint() throws IOException {
- if (index == result.size() && !hasLimit && result.size() ==
plan.getLimit()) {
- plan.setOffset(plan.getOffset() + plan.getLimit());
- try {
- result = getQueryDataSet();
- index = 0;
- } catch (MetadataException e) {
- throw new IOException(e);
- }
- }
+ public boolean hasNextWithoutConstraint() {
return index < result.size();
}