You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/07/19 06:30:27 UTC

[doris] 01/38: [branch-1.2][Fix](planner)replace limit to -1 if is Long.MAX_VALUE (#21521)

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

commit 8106524d1e38033214e2e5b9f0773acc189c595b
Author: mch_ucchi <41...@users.noreply.github.com>
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: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org