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 2022/12/19 04:20:49 UTC
[doris] 01/04: [improvement](query)optimize select stmt with limit 0 (#14956)
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 ca97e49b7d3b785e290173ec59ebed43a57d870b
Author: chenlinzhong <49...@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 8feaaa3e6f..6b1041373d 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-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org