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 <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 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-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org