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

yiguolei 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 477899af8e [fix](having) Fix the `with as` clause containing having 
caused a null pointer (#12007)
477899af8e is described below

commit 477899af8e6d843c5d32ece120b066a9080f2ba6
Author: luozenglin <[email protected]>
AuthorDate: Wed Aug 24 08:48:49 2022 +0800

    [fix](having) Fix the `with as` clause containing having caused a null 
pointer (#12007)
---
 fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java | 2 ++
 regression-test/data/query_p0/subquery/test_subquery.out           | 3 +++
 regression-test/suites/query_p0/subquery/test_subquery.groovy      | 5 +++++
 3 files changed, 10 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 95d1ef5ad3..b67476aa71 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
@@ -161,6 +161,8 @@ public class SelectStmt extends QueryStmt {
         whereClause = (other.whereClause != null) ? other.whereClause.clone() 
: null;
         groupByClause = (other.groupByClause != null) ? 
other.groupByClause.clone() : null;
         havingClause = (other.havingClause != null) ? 
other.havingClause.clone() : null;
+        havingClauseAfterAnaylzed =
+                other.havingClauseAfterAnaylzed != null ? 
other.havingClauseAfterAnaylzed.clone() : null;
 
         colLabels = Lists.newArrayList(other.colLabels);
         aggInfo = (other.aggInfo != null) ? other.aggInfo.clone() : null;
diff --git a/regression-test/data/query_p0/subquery/test_subquery.out 
b/regression-test/data/query_p0/subquery/test_subquery.out
index 1ab1f93610..ed330ebd33 100644
--- a/regression-test/data/query_p0/subquery/test_subquery.out
+++ b/regression-test/data/query_p0/subquery/test_subquery.out
@@ -4,3 +4,6 @@
 1001   2       1986
 1002   3       1989
 
+-- !sql2 --
+1      1989
+
diff --git a/regression-test/suites/query_p0/subquery/test_subquery.groovy 
b/regression-test/suites/query_p0/subquery/test_subquery.groovy
index e1776f0469..6e6f794a57 100644
--- a/regression-test/suites/query_p0/subquery/test_subquery.groovy
+++ b/regression-test/suites/query_p0/subquery/test_subquery.groovy
@@ -26,4 +26,9 @@ suite("test_subquery") {
                 ) t 
             where c1>0 order by 2 , 1 limit 3
             """
+
+        qt_sql2 """
+        with base as (select k1, k2 from test_query_db.test as t where k1 in 
(select k1 from test_query_db.baseall
+        where k7 = 'wangjuoo4' group by 1 having count(distinct k7) > 0)) 
select * from base limit 10;
+        """
 }


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

Reply via email to