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 efea1fdf7d6e36915d2654939638ef6e645a8752
Author: minghong <[email protected]>
AuthorDate: Wed Feb 22 20:40:08 2023 +0800

    [fix](planner) create view init bug (#16890)
    
    the body of create view stmt is parsed twice.
    in the second parse, we get sql string from 
CreateViewStmt.viewDefStmt.toSql() function, which missed selectlist.
---
 fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
index 7b72f44298..003c5fa79b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
@@ -1949,7 +1949,7 @@ public class SelectStmt extends QueryStmt {
             strBuilder.append("DISTINCT ");
         }
         ConnectContext ctx = ConnectContext.get();
-        if (ctx == null || ctx.getSessionVariable().internalSession || 
toSQLWithSelectList) {
+        if (ctx == null || ctx.getSessionVariable().internalSession || 
toSQLWithSelectList || resultExprs.isEmpty()) {
             for (int i = 0; i < selectList.getItems().size(); i++) {
                 strBuilder.append(selectList.getItems().get(i).toSql());
                 strBuilder.append((i + 1 != selectList.getItems().size()) ? ", 
" : "");


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to