You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "morrySnow (via GitHub)" <gi...@apache.org> on 2023/07/19 04:13:51 UTC

[GitHub] [doris] morrySnow commented on a diff in pull request #21959: [nereids](function) add boolean type for sum agg

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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum.java:
##########
@@ -78,8 +80,9 @@ public Sum(boolean distinct, boolean alwaysNullable, Expression arg) {
     @Override
     public void checkLegalityBeforeTypeCoercion() {
         DataType argType = child().getDataType();
-        if (((!argType.isNumericType() && !argType.isNullType()) || argType.isOnlyMetricType())) {
-            throw new AnalysisException("sum requires a numeric parameter: " + this.toSql());
+        if ((!argType.isNumericType() && !argType.isBooleanType() && !argType.isNullType())
+                || argType.isOnlyMetricType()) {
+            throw new AnalysisException("sum requires a numeric or boolean parameter: " + this.toSql());

Review Comment:
   add regression test in `regression-test/suites/nereids_function_p0/agg_function/agg.groovy`



-- 
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