You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/12/30 07:44:50 UTC

[GitHub] [doris] morrySnow commented on a diff in pull request #14964: [Fix](Nereids)fix aggregation result error when child is empty relation

morrySnow commented on code in PR #14964:
URL: https://github.com/apache/doris/pull/14964#discussion_r1059276593


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Min.java:
##########
@@ -32,15 +31,19 @@
 import java.util.List;
 
 /** min agg function. */
-public class Min extends AggregateFunction implements UnaryExpression, PropagateNullable, CustomSignature,
+public class Min extends NullableAggregateFunction implements UnaryExpression, CustomSignature,
         ForbiddenMetricTypeArguments {
 
     public Min(Expression child) {
-        super("min", child);
+        this(false, false, child);
     }
 
     public Min(boolean isDistinct, Expression arg) {
-        super("min", false, arg);
+        this(isDistinct, false, arg);
+    }
+
+    public Min(boolean isDistinct, boolean isAlwaysNullable, Expression arg) {
+        super("min", isAlwaysNullable, isDistinct, arg);

Review Comment:
   maybe all alwaysnullable constructor should be private



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/FillUpMissingSlots.java:
##########
@@ -171,6 +172,9 @@ public void resolve(Expression expression) {
                         throw new AnalysisException("Aggregate functions in having clause can't be nested: "
                                 + expression.toSql() + ".");
                     }
+                    if (groupByExpressions.isEmpty() && expression instanceof NullableAggregateFunction) {
+                        expression = ((NullableAggregateFunction) expression).withAlwaysNullable(true);
+                    }

Review Comment:
   chould we make a new rule to process nullable only?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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