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

dataroaring 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 95561baddd [fix](planner) throw NPE when all group by expr is constant 
and no agg expr in select list (#13087)
95561baddd is described below

commit 95561baddd887b8178c501d8701012e880082c48
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Fri Sep 30 18:47:01 2022 +0800

    [fix](planner) throw NPE when all group by expr is constant and no agg expr 
in select list (#13087)
---
 .../src/main/java/org/apache/doris/analysis/SelectStmt.java       | 8 ++++++++
 1 file changed, 8 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 5645219af7..4b9015be9d 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
@@ -1079,6 +1079,11 @@ public class SelectStmt extends QueryStmt {
         } else {
             createAggInfo(new ArrayList<>(), aggExprs, analyzer);
         }
+        // we remove all constant in group by expressions, when all exprs are 
constant
+        // and no aggregate expr in select list, we do not generate aggInfo at 
all.
+        if (aggInfo == null) {
+            return;
+        }
 
         // combine avg smap with the one that produces the final agg output
         AggregateInfo finalAggInfo =
@@ -1285,6 +1290,9 @@ public class SelectStmt extends QueryStmt {
             Preconditions.checkState(aggExprs.isEmpty());
             aggInfo = AggregateInfo.create(Expr.cloneList(resultExprs), null, 
null, analyzer);
         } else {
+            if (CollectionUtils.isEmpty(groupingExprs) && 
CollectionUtils.isEmpty(aggExprs)) {
+                return;
+            }
             aggInfo = AggregateInfo.create(groupingExprs, aggExprs, null, 
analyzer);
         }
     }


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

Reply via email to