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

yangzhg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 9d6a81d1e3 [improvement](query)optimize select stmt with limit 0  
(#14956)
9d6a81d1e3 is described below

commit 9d6a81d1e3496511399cbef0bc9c1a831899517b
Author: chenlinzhong <490103...@qq.com>
AuthorDate: Wed Dec 14 13:48:09 2022 +0800

    [improvement](query)optimize select stmt with limit 0  (#14956)
---
 .../src/main/java/org/apache/doris/qe/StmtExecutor.java      | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index dcfc83d608..f8d40ac857 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -1105,6 +1105,18 @@ public class StmtExecutor implements ProfileWriter {
             handleCacheStmt(cacheAnalyzer, channel, (SelectStmt) queryStmt);
             return;
         }
+
+        // handle select .. from xx  limit 0
+        if (parsedStmt instanceof SelectStmt) {
+            SelectStmt parsedSelectStmt = (SelectStmt) parsedStmt;
+            if (parsedSelectStmt.getLimit() == 0) {
+                LOG.info("ignore handle limit 0 ,sql:{}", 
parsedSelectStmt.toSql());
+                sendFields(queryStmt.getColLabels(), 
exprToType(queryStmt.getResultExprs()));
+                context.getState().setEof();
+                return;
+            }
+        }
+
         sendResult(isOutfileQuery, false, queryStmt, channel, null, null);
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to