This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
new 19df0bb2d6 [branch-1.2][Fix](planner)replace limit to -1 if is
Long.MAX_VALUE (#21521)
19df0bb2d6 is described below
commit 19df0bb2d6f2c17c1ce1b9a5327d8cd274fba100
Author: mch_ucchi <[email protected]>
AuthorDate: Wed Jul 5 15:40:53 2023 +0800
[branch-1.2][Fix](planner)replace limit to -1 if is Long.MAX_VALUE (#21521)
sqlSelectLimit is Long.MAX_VALUE default, we replace it to -1 to eliminate
limit, then data will no be gathered to one node.
---
.../src/main/java/org/apache/doris/planner/SingleNodePlanner.java | 8 ++++++--
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
index ef080ba6ab..a145b6e9f1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java
@@ -302,7 +302,11 @@ public class SingleNodePlanner {
if (sqlSelectLimit > -1) {
newDefaultOrderByLimit = Math.min(newDefaultOrderByLimit,
sqlSelectLimit);
}
- root.setLimit(limit != -1 ? limit : newDefaultOrderByLimit);
+ if (newDefaultOrderByLimit == Long.MAX_VALUE) {
+ root.setLimit(limit);
+ } else {
+ root.setLimit(limit != -1 ? limit :
newDefaultOrderByLimit);
+ }
} else {
root.setLimit(limit);
}
@@ -312,7 +316,7 @@ public class SingleNodePlanner {
// from SelectStmt outside
root = addUnassignedConjuncts(analyzer, root);
} else {
- if (!stmt.hasLimit()) {
+ if (!stmt.hasLimit() && sqlSelectLimit < Long.MAX_VALUE) {
root.setLimitAndOffset(sqlSelectLimit, stmt.getOffset());
} else {
root.setLimitAndOffset(stmt.getLimit(), stmt.getOffset());
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index 2b87524107..a57b3e542e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -351,7 +351,7 @@ public class SessionVariable implements Serializable,
Writable {
public boolean sqlAutoIsNull = false;
@VariableMgr.VarAttr(name = SQL_SELECT_LIMIT)
- public long sqlSelectLimit = 9223372036854775807L;
+ public long sqlSelectLimit = -1;
// this is used to make c3p0 library happy
@VariableMgr.VarAttr(name = MAX_ALLOWED_PACKET)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]