You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ka...@apache.org on 2020/10/17 05:39:21 UTC

[incubator-doris] branch master updated: Fix bug CTE statement with nested select (#4731)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d371d36  Fix bug CTE statement with nested select (#4731)
d371d36 is described below

commit d371d363a4c68f778366ab73f44fc15bf39949e0
Author: xueyan.li <as...@163.com>
AuthorDate: Sat Oct 17 13:36:14 2020 +0800

    Fix bug CTE statement with nested select (#4731)
    
    Co-authored-by: lixueyan07 <li...@meituan.com>
---
 fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java  | 1 +
 .../src/test/java/org/apache/doris/analysis/SelectStmtTest.java     | 6 ++++++
 2 files changed, 7 insertions(+)

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 2da1133..1304474 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
@@ -282,6 +282,7 @@ public class SelectStmt extends QueryStmt {
             if (tblRef instanceof InlineViewRef) {
                 // Inline view reference
                 QueryStmt inlineStmt = ((InlineViewRef) tblRef).getViewStmt();
+                inlineStmt.withClause_ = this.withClause_;
                 inlineStmt.getDbs(analyzer, dbs);
             } else {
                 String dbName = tblRef.getName().getDb();
diff --git a/fe/fe-core/src/test/java/org/apache/doris/analysis/SelectStmtTest.java b/fe/fe-core/src/test/java/org/apache/doris/analysis/SelectStmtTest.java
index fcdaa0b..d2dc199 100755
--- a/fe/fe-core/src/test/java/org/apache/doris/analysis/SelectStmtTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/SelectStmtTest.java
@@ -526,5 +526,11 @@ public class SelectStmtTest {
         String sql = "with tmp as (select count(*) from db1.table1) select * from tmp;";
         dorisAssert.withoutUseDatabase();
         dorisAssert.query(sql).explainQuery();
+
+        sql = "with tmp as (select * from db1.table1) " +
+                "select a.siteid, b.citycode, a.siteid from (select siteid, citycode from tmp) a " +
+                "left join (select siteid, citycode from tmp) b on a.siteid = b.siteid;";
+        dorisAssert.withoutUseDatabase();
+        dorisAssert.query(sql).explainQuery();
     }
 }


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