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

englefly 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 181c58c691 [fix](Nereids) count_by_enum signature is wrong (#25167)
181c58c691 is described below

commit 181c58c69178e4459b2f3845874577aebb04b024
Author: morrySnow <[email protected]>
AuthorDate: Tue Oct 10 13:05:20 2023 +0800

    [fix](Nereids) count_by_enum signature is wrong (#25167)
---
 .../expressions/functions/agg/CountByEnum.java     |  22 +-
 .../data/nereids_function_p0/agg_function/agg.out  | 405 +++++++++++----------
 .../nereids_function_p0/agg_function/agg.groovy    |   6 +-
 3 files changed, 224 insertions(+), 209 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/CountByEnum.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/CountByEnum.java
index 8232e9e403..721471add6 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/CountByEnum.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/CountByEnum.java
@@ -22,11 +22,9 @@ import org.apache.doris.nereids.trees.expressions.Expression;
 import org.apache.doris.nereids.trees.expressions.functions.AlwaysNotNullable;
 import 
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
-import org.apache.doris.nereids.types.ArrayType;
 import org.apache.doris.nereids.types.StringType;
 import org.apache.doris.nereids.util.ExpressionUtils;
 
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 
 import java.util.List;
@@ -35,20 +33,24 @@ import java.util.List;
 public class CountByEnum extends AggregateFunction implements 
ExplicitlyCastableSignature, AlwaysNotNullable {
 
     public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
-            
FunctionSignature.ret(ArrayType.of(StringType.INSTANCE)).args(StringType.INSTANCE)
+            
FunctionSignature.ret(StringType.INSTANCE).varArgs(StringType.INSTANCE)
     );
 
-    /**
-     * constructor with 1 or more arguments.
-     */
-    public CountByEnum(Expression arg, Expression... varArgs) {
-        super("count_by_enum", ExpressionUtils.mergeArguments(arg, varArgs));
+    public CountByEnum(Expression arg0, Expression... varArgs) {
+        super("count_by_enum", ExpressionUtils.mergeArguments(arg0, varArgs));
+    }
+
+    public CountByEnum(boolean distinct, Expression arg0, Expression... 
varArgs) {
+        super("count_by_enum", distinct, ExpressionUtils.mergeArguments(arg0, 
varArgs));
+    }
+
+    private CountByEnum(boolean distinct, Expression... varArgs) {
+        super("count_by_enum", distinct, varArgs);
     }
 
     @Override
     public AggregateFunction withDistinctAndChildren(boolean distinct, 
List<Expression> children) {
-        Preconditions.checkArgument(children.size() == 1);
-        return new CollectList(distinct, children.get(0));
+        return new CountByEnum(distinct, children.toArray(new Expression[0]));
     }
 
     @Override
diff --git a/regression-test/data/nereids_function_p0/agg_function/agg.out 
b/regression-test/data/nereids_function_p0/agg_function/agg.out
index 83a9d43e75..91e473ced0 100644
--- a/regression-test/data/nereids_function_p0/agg_function/agg.out
+++ b/regression-test/data/nereids_function_p0/agg_function/agg.out
@@ -265,7 +265,7 @@
 
 -- !sql_avg_Double_gb --
 \N
-0.39999999999999997
+0.4000000000000001
 1.0
 
 -- !sql_avg_Double --
@@ -291,7 +291,7 @@
 
 -- !sql_avg_Double_agg_phase_3 --
 0      \N
-7      0.4
+7      0.39999999999999997
 5      1.0
 
 -- !sql_avg_Double_agg_phase_4 --
@@ -299,7 +299,7 @@
 
 -- !sql_avg_Double_gb_notnull --
 0.39999999999999997
-1.0
+1.0000000000000002
 
 -- !sql_avg_Double_notnull --
 0.65
@@ -323,7 +323,7 @@
 
 -- !sql_avg_Double_agg_phase_3_notnull --
 0      \N
-7      0.4000000000000001
+7      0.39999999999999997
 5      1.0
 
 -- !sql_avg_Double_agg_phase_4_notnull --
@@ -397,11 +397,11 @@
 
 -- !sql_avg_weighted_TinyInt_Double_gb --
 \N
-5.0
+4.999999999999999
 10.2
 
 -- !sql_avg_weighted_TinyInt_Double --
-8.333333333333332
+8.333333333333334
 
 -- !sql_avg_weighted_TinyInt_Double_agg_phase_1 --
 0      \N
@@ -419,7 +419,7 @@
 1      12.0
 
 -- !sql_avg_weighted_TinyInt_Double_agg_phase_2 --
-12     8.333333333333332
+12     8.333333333333334
 
 -- !sql_avg_weighted_TinyInt_Double_agg_phase_3 --
 0      \N
@@ -427,14 +427,14 @@
 5      10.2
 
 -- !sql_avg_weighted_TinyInt_Double_agg_phase_4 --
-12     8.333333333333334
+12     8.333333333333332
 
 -- !sql_avg_weighted_TinyInt_Double_gb_notnull --
-5.0
+4.999999999999999
 10.2
 
 -- !sql_avg_weighted_TinyInt_Double_notnull --
-8.333333333333332
+8.333333333333334
 
 -- !sql_avg_weighted_TinyInt_Double_agg_phase_1_notnull --
 1      1.0
@@ -455,7 +455,7 @@
 
 -- !sql_avg_weighted_TinyInt_Double_agg_phase_3_notnull --
 0      \N
-7      4.999999999999999
+7      5.0
 5      10.2
 
 -- !sql_avg_weighted_TinyInt_Double_agg_phase_4_notnull --
@@ -463,7 +463,7 @@
 
 -- !sql_avg_weighted_SmallInt_Double_gb --
 \N
-4.999999999999999
+5.0
 10.2
 
 -- !sql_avg_weighted_SmallInt_Double --
@@ -485,22 +485,22 @@
 1      12.0
 
 -- !sql_avg_weighted_SmallInt_Double_agg_phase_2 --
-12     8.333333333333334
+12     8.333333333333332
 
 -- !sql_avg_weighted_SmallInt_Double_agg_phase_3 --
 0      \N
-7      4.999999999999999
+7      5.0
 5      10.2
 
 -- !sql_avg_weighted_SmallInt_Double_agg_phase_4 --
 12     8.333333333333334
 
 -- !sql_avg_weighted_SmallInt_Double_gb_notnull --
-5.0
+4.999999999999999
 10.2
 
 -- !sql_avg_weighted_SmallInt_Double_notnull --
-8.333333333333334
+8.333333333333332
 
 -- !sql_avg_weighted_SmallInt_Double_agg_phase_1_notnull --
 1      1.0
@@ -521,19 +521,19 @@
 
 -- !sql_avg_weighted_SmallInt_Double_agg_phase_3_notnull --
 0      \N
-7      5.0
+7      4.999999999999998
 5      10.2
 
 -- !sql_avg_weighted_SmallInt_Double_agg_phase_4_notnull --
-12     8.333333333333334
+12     8.333333333333332
 
 -- !sql_avg_weighted_Integer_Double_gb --
 \N
 5.0
-10.2
+10.200000000000001
 
 -- !sql_avg_weighted_Integer_Double --
-8.333333333333334
+8.333333333333332
 
 -- !sql_avg_weighted_Integer_Double_agg_phase_1 --
 0      \N
@@ -555,18 +555,18 @@
 
 -- !sql_avg_weighted_Integer_Double_agg_phase_3 --
 0      \N
-7      4.999999999999999
+7      5.0
 5      10.2
 
 -- !sql_avg_weighted_Integer_Double_agg_phase_4 --
-12     8.333333333333334
+12     8.333333333333332
 
 -- !sql_avg_weighted_Integer_Double_gb_notnull --
-5.0
+4.999999999999999
 10.2
 
 -- !sql_avg_weighted_Integer_Double_notnull --
-8.333333333333332
+8.333333333333334
 
 -- !sql_avg_weighted_Integer_Double_agg_phase_1_notnull --
 1      1.0
@@ -583,7 +583,7 @@
 1      12.0
 
 -- !sql_avg_weighted_Integer_Double_agg_phase_2_notnull --
-12     8.333333333333332
+12     8.333333333333334
 
 -- !sql_avg_weighted_Integer_Double_agg_phase_3_notnull --
 0      \N
@@ -596,10 +596,10 @@
 -- !sql_avg_weighted_BigInt_Double_gb --
 \N
 5.0
-10.2
+10.200000000000001
 
 -- !sql_avg_weighted_BigInt_Double --
-8.333333333333332
+8.333333333333334
 
 -- !sql_avg_weighted_BigInt_Double_agg_phase_1 --
 0      \N
@@ -617,22 +617,22 @@
 1      12.0
 
 -- !sql_avg_weighted_BigInt_Double_agg_phase_2 --
-12     8.333333333333334
+12     8.333333333333332
 
 -- !sql_avg_weighted_BigInt_Double_agg_phase_3 --
 0      \N
-7      4.999999999999999
+7      5.0
 5      10.2
 
 -- !sql_avg_weighted_BigInt_Double_agg_phase_4 --
-12     8.333333333333334
+12     8.333333333333332
 
 -- !sql_avg_weighted_BigInt_Double_gb_notnull --
 5.0
 10.2
 
 -- !sql_avg_weighted_BigInt_Double_notnull --
-8.333333333333334
+8.333333333333332
 
 -- !sql_avg_weighted_BigInt_Double_agg_phase_1_notnull --
 1      1.0
@@ -653,15 +653,15 @@
 
 -- !sql_avg_weighted_BigInt_Double_agg_phase_3_notnull --
 0      \N
-7      4.999999999999999
+7      5.0
 5      10.2
 
 -- !sql_avg_weighted_BigInt_Double_agg_phase_4_notnull --
-12     8.333333333333334
+12     8.333333333333332
 
 -- !sql_avg_weighted_Float_Double_gb --
 \N
-0.5000000045235666
+0.5000000045235669
 1.0200000143051147
 
 -- !sql_avg_weighted_Float_Double --
@@ -687,18 +687,18 @@
 
 -- !sql_avg_weighted_Float_Double_agg_phase_3 --
 0      \N
-7      0.5000000045235667
-5      1.0200000143051144
+7      0.5000000045235666
+5      1.0200000143051147
 
 -- !sql_avg_weighted_Float_Double_agg_phase_4 --
 12     0.8333333441271231
 
 -- !sql_avg_weighted_Float_Double_gb_notnull --
-0.5000000045235667
+0.5000000045235666
 1.0200000143051147
 
 -- !sql_avg_weighted_Float_Double_notnull --
-0.8333333441271231
+0.833333344127123
 
 -- !sql_avg_weighted_Float_Double_agg_phase_1_notnull --
 1      0.10000000149011612
@@ -720,10 +720,10 @@
 -- !sql_avg_weighted_Float_Double_agg_phase_3_notnull --
 0      \N
 7      0.5000000045235667
-5      1.0200000143051147
+5      1.0200000143051144
 
 -- !sql_avg_weighted_Float_Double_agg_phase_4_notnull --
-12     0.8333333441271232
+12     0.8333333441271231
 
 -- !sql_avg_weighted_Double_Double_gb --
 \N
@@ -731,7 +731,7 @@
 1.02
 
 -- !sql_avg_weighted_Double_Double --
-0.8333333333333334
+0.8333333333333333
 
 -- !sql_avg_weighted_Double_Double_agg_phase_1 --
 0      \N
@@ -749,22 +749,22 @@
 1      1.2
 
 -- !sql_avg_weighted_Double_Double_agg_phase_2 --
-12     0.8333333333333333
+12     0.8333333333333334
 
 -- !sql_avg_weighted_Double_Double_agg_phase_3 --
 0      \N
-7      0.5000000000000001
+7      0.5
 5      1.02
 
 -- !sql_avg_weighted_Double_Double_agg_phase_4 --
-12     0.8333333333333333
+12     0.8333333333333334
 
 -- !sql_avg_weighted_Double_Double_gb_notnull --
-0.5
+0.5000000000000001
 1.02
 
 -- !sql_avg_weighted_Double_Double_notnull --
-0.8333333333333335
+0.8333333333333334
 
 -- !sql_avg_weighted_Double_Double_agg_phase_1_notnull --
 1      0.10000000000000002
@@ -781,15 +781,15 @@
 1      1.2
 
 -- !sql_avg_weighted_Double_Double_agg_phase_2_notnull --
-12     0.8333333333333335
+12     0.8333333333333333
 
 -- !sql_avg_weighted_Double_Double_agg_phase_3_notnull --
 0      \N
-7      0.5000000000000001
+7      0.49999999999999983
 5      1.02
 
 -- !sql_avg_weighted_Double_Double_agg_phase_4_notnull --
-12     0.8333333333333334
+12     0.8333333333333333
 
 -- !sql_avg_weighted_DecimalV2_Double_gb --
 \N
@@ -797,7 +797,7 @@
 1.02
 
 -- !sql_avg_weighted_DecimalV2_Double --
-0.8333333333333334
+0.8333333333333333
 
 -- !sql_avg_weighted_DecimalV2_Double_agg_phase_1 --
 0      \N
@@ -819,18 +819,18 @@
 
 -- !sql_avg_weighted_DecimalV2_Double_agg_phase_3 --
 0      \N
-7      0.5
+7      0.49999999999999994
 5      1.02
 
 -- !sql_avg_weighted_DecimalV2_Double_agg_phase_4 --
 12     0.8333333333333333
 
 -- !sql_avg_weighted_DecimalV2_Double_gb_notnull --
-0.5
+0.49999999999999994
 1.02
 
 -- !sql_avg_weighted_DecimalV2_Double_notnull --
-0.8333333333333334
+0.8333333333333333
 
 -- !sql_avg_weighted_DecimalV2_Double_agg_phase_1_notnull --
 1      0.10000000000000002
@@ -847,11 +847,11 @@
 1      1.2
 
 -- !sql_avg_weighted_DecimalV2_Double_agg_phase_2_notnull --
-12     0.8333333333333333
+12     0.8333333333333334
 
 -- !sql_avg_weighted_DecimalV2_Double_agg_phase_3_notnull --
 0      \N
-7      0.49999999999999994
+7      0.5
 5      1.02
 
 -- !sql_avg_weighted_DecimalV2_Double_agg_phase_4_notnull --
@@ -1385,6 +1385,15 @@
 -- !sql_count_AnyData_agg_phase_4_notnull --
 12     12
 
+-- !sql_count_by_enum_string --
+[{"cbe":{"null":1},"notnull":1,"null":0,"all":1}]
+[{"cbe":{"string2":2,"string1":3,"string3":2},"notnull":7,"null":0,"all":7}]
+[{"cbe":{"string2":2,"string1":1,"string3":2},"notnull":5,"null":0,"all":5}]
+
+-- !sql_count_by_enum_string_notnull --
+[{"cbe":{"string1":3,"string2":2,"string3":2},"notnull":7,"null":0,"all":7}]
+[{"cbe":{"string1":1,"string2":2,"string3":2},"notnull":5,"null":0,"all":5}]
+
 -- !sql_group_bit_and_TinyInt_gb --
 \N
 0
@@ -3276,7 +3285,7 @@ true
 
 -- !sql_stddev_TinyInt_gb --
 \N
-2.0
+1.9999999999999998
 1.4142135623730951
 
 -- !sql_stddev_TinyInt --
@@ -3313,7 +3322,7 @@ true
 1.4142135623730951
 
 -- !sql_stddev_TinyInt_notnull --
-3.452052529534664
+3.452052529534663
 
 -- !sql_stddev_TinyInt_agg_phase_1_notnull --
 1      0.0
@@ -3334,19 +3343,19 @@ true
 
 -- !sql_stddev_TinyInt_agg_phase_3_notnull --
 0      \N
-7      2.0
-5      1.4142135623730954
+7      1.9999999999999998
+5      1.4142135623730951
 
 -- !sql_stddev_TinyInt_agg_phase_4_notnull --
 12     3.452052529534663
 
 -- !sql_stddev_SmallInt_gb --
 \N
-2.0
+1.9999999999999998
 1.4142135623730951
 
 -- !sql_stddev_SmallInt --
-3.452052529534663
+3.452052529534664
 
 -- !sql_stddev_SmallInt_agg_phase_1 --
 0      \N
@@ -3368,8 +3377,8 @@ true
 
 -- !sql_stddev_SmallInt_agg_phase_3 --
 0      \N
-7      1.9999999999999998
-5      1.414213562373095
+7      2.0
+5      1.4142135623730951
 
 -- !sql_stddev_SmallInt_agg_phase_4 --
 12     3.452052529534663
@@ -3379,7 +3388,7 @@ true
 1.4142135623730951
 
 -- !sql_stddev_SmallInt_notnull --
-3.452052529534664
+3.452052529534663
 
 -- !sql_stddev_SmallInt_agg_phase_1_notnull --
 1      0.0
@@ -3412,7 +3421,7 @@ true
 1.4142135623730951
 
 -- !sql_stddev_Integer --
-3.452052529534664
+3.452052529534663
 
 -- !sql_stddev_Integer_agg_phase_1 --
 0      \N
@@ -3434,18 +3443,18 @@ true
 
 -- !sql_stddev_Integer_agg_phase_3 --
 0      \N
-7      1.9999999999999998
+7      2.0
 5      1.4142135623730951
 
 -- !sql_stddev_Integer_agg_phase_4 --
 12     3.452052529534663
 
 -- !sql_stddev_Integer_gb_notnull --
-2.0
+1.9999999999999998
 1.4142135623730951
 
 -- !sql_stddev_Integer_notnull --
-3.452052529534664
+3.452052529534663
 
 -- !sql_stddev_Integer_agg_phase_1_notnull --
 1      0.0
@@ -3478,7 +3487,7 @@ true
 1.4142135623730951
 
 -- !sql_stddev_BigInt --
-3.452052529534663
+3.452052529534664
 
 -- !sql_stddev_BigInt_agg_phase_1 --
 0      \N
@@ -3507,11 +3516,11 @@ true
 12     3.452052529534663
 
 -- !sql_stddev_BigInt_gb_notnull --
-2.0
+1.9999999999999998
 1.4142135623730951
 
 -- !sql_stddev_BigInt_notnull --
-3.452052529534664
+3.452052529534663
 
 -- !sql_stddev_BigInt_agg_phase_1_notnull --
 1      0.0
@@ -3532,7 +3541,7 @@ true
 
 -- !sql_stddev_BigInt_agg_phase_3_notnull --
 0      \N
-7      2.0
+7      1.9999999999999998
 5      1.4142135623730951
 
 -- !sql_stddev_BigInt_agg_phase_4_notnull --
@@ -3544,7 +3553,7 @@ true
 0.1414213730960499
 
 -- !sql_stddev_Float --
-0.3452052585470726
+0.34520525854707257
 
 -- !sql_stddev_Float_agg_phase_1 --
 0      \N
@@ -3570,14 +3579,14 @@ true
 5      0.1414213730960499
 
 -- !sql_stddev_Float_agg_phase_4 --
-12     0.3452052585470726
+12     0.34520525854707257
 
 -- !sql_stddev_Float_gb_notnull --
 0.1999999992549422
 0.1414213730960499
 
 -- !sql_stddev_Float_notnull --
-0.3452052585470726
+0.34520525854707257
 
 -- !sql_stddev_Float_agg_phase_1_notnull --
 1      0.0
@@ -3633,13 +3642,13 @@ true
 -- !sql_stddev_Double_agg_phase_3 --
 0      \N
 7      0.19999999999999998
-5      0.14142135623730948
+5      0.1414213562373095
 
 -- !sql_stddev_Double_agg_phase_4 --
-12     0.3452052529534664
+12     0.3452052529534663
 
 -- !sql_stddev_Double_gb_notnull --
-0.19999999999999998
+0.19999999999999996
 0.1414213562373095
 
 -- !sql_stddev_Double_notnull --
@@ -3665,15 +3674,15 @@ true
 -- !sql_stddev_Double_agg_phase_3_notnull --
 0      \N
 7      0.19999999999999998
-5      0.14142135623730945
+5      0.1414213562373095
 
 -- !sql_stddev_Double_agg_phase_4_notnull --
 12     0.3452052529534663
 
 -- !sql_stddev_DecimalV2_gb --
 \N
-0.2
-0.14142135623730948
+0.19999999999999998
+0.1414213562373095
 
 -- !sql_stddev_DecimalV2_agg_phase_1 --
 0      \N
@@ -3691,18 +3700,18 @@ true
 1      0.0
 
 -- !sql_stddev_DecimalV2_agg_phase_2 --
-12     0.3452052529534664
+12     0.3452052529534663
 
 -- !sql_stddev_DecimalV2_agg_phase_3 --
 0      \N
-7      0.19999999999999998
-5      0.14142135623730948
+7      0.19999999999999996
+5      0.1414213562373095
 
 -- !sql_stddev_DecimalV2_agg_phase_4 --
 12     0.3452052529534663
 
 -- !sql_stddev_DecimalV2_gb_notnull --
-0.2
+0.19999999999999998
 0.1414213562373095
 
 -- !sql_stddev_DecimalV2_agg_phase_1_notnull --
@@ -3724,8 +3733,8 @@ true
 
 -- !sql_stddev_DecimalV2_agg_phase_3_notnull --
 0      \N
-7      0.2
-5      0.1414213562373095
+7      0.19999999999999998
+5      0.14142135623730945
 
 -- !sql_stddev_DecimalV2_agg_phase_4_notnull --
 12     0.3452052529534663
@@ -3769,7 +3778,7 @@ true
 1.5811388300841898
 
 -- !sql_stddev_samp_TinyInt_notnull --
-3.6055512754639896
+3.605551275463989
 
 -- !sql_stddev_samp_TinyInt_agg_phase_1_notnull --
 1      \N
@@ -3790,8 +3799,8 @@ true
 
 -- !sql_stddev_samp_TinyInt_agg_phase_3_notnull --
 0      \N
-7      2.1602468994692865
-5      1.5811388300841893
+7      2.160246899469287
+5      1.5811388300841898
 
 -- !sql_stddev_samp_TinyInt_agg_phase_4_notnull --
 12     3.605551275463989
@@ -3802,7 +3811,7 @@ true
 1.5811388300841898
 
 -- !sql_stddev_samp_SmallInt --
-3.605551275463989
+3.6055512754639896
 
 -- !sql_stddev_samp_SmallInt_agg_phase_1 --
 0      \N
@@ -3824,18 +3833,18 @@ true
 
 -- !sql_stddev_samp_SmallInt_agg_phase_3 --
 0      \N
-7      2.160246899469287
+7      2.1602468994692865
 5      1.5811388300841898
 
 -- !sql_stddev_samp_SmallInt_agg_phase_4 --
 12     3.605551275463989
 
 -- !sql_stddev_samp_SmallInt_gb_notnull --
-2.160246899469287
+2.1602468994692865
 1.5811388300841898
 
 -- !sql_stddev_samp_SmallInt_notnull --
-3.6055512754639896
+3.605551275463989
 
 -- !sql_stddev_samp_SmallInt_agg_phase_1_notnull --
 1      \N
@@ -3856,7 +3865,7 @@ true
 
 -- !sql_stddev_samp_SmallInt_agg_phase_3_notnull --
 0      \N
-7      2.1602468994692865
+7      2.160246899469287
 5      1.5811388300841898
 
 -- !sql_stddev_samp_SmallInt_agg_phase_4_notnull --
@@ -3890,8 +3899,8 @@ true
 
 -- !sql_stddev_samp_Integer_agg_phase_3 --
 0      \N
-7      2.160246899469287
-5      1.5811388300841898
+7      2.1602468994692865
+5      1.5811388300841893
 
 -- !sql_stddev_samp_Integer_agg_phase_4 --
 12     3.605551275463989
@@ -3901,7 +3910,7 @@ true
 1.5811388300841898
 
 -- !sql_stddev_samp_Integer_notnull --
-3.6055512754639896
+3.605551275463989
 
 -- !sql_stddev_samp_Integer_agg_phase_1_notnull --
 1      \N
@@ -3963,7 +3972,7 @@ true
 12     3.605551275463989
 
 -- !sql_stddev_samp_BigInt_gb_notnull --
-2.160246899469287
+2.1602468994692865
 1.5811388300841898
 
 -- !sql_stddev_samp_BigInt_notnull --
@@ -4026,14 +4035,14 @@ true
 5      0.15811390185706375
 
 -- !sql_stddev_samp_Float_agg_phase_4 --
-12     0.3605551333887302
+12     0.36055513338873013
 
 -- !sql_stddev_samp_Float_gb_notnull --
-0.21602468914217424
+0.2160246891421743
 0.15811390185706375
 
 -- !sql_stddev_samp_Float_notnull --
-0.3605551333887302
+0.36055513338873013
 
 -- !sql_stddev_samp_Float_agg_phase_1_notnull --
 1      \N
@@ -4055,14 +4064,14 @@ true
 -- !sql_stddev_samp_Float_agg_phase_3_notnull --
 0      \N
 7      0.2160246891421743
-5      0.15811390185706373
+5      0.15811390185706375
 
 -- !sql_stddev_samp_Float_agg_phase_4_notnull --
-12     0.3605551333887302
+12     0.36055513338873013
 
 -- !sql_stddev_samp_Double_gb --
 \N
-0.21602468994692867
+0.21602468994692864
 0.15811388300841897
 
 -- !sql_stddev_samp_Double --
@@ -4088,15 +4097,15 @@ true
 
 -- !sql_stddev_samp_Double_agg_phase_3 --
 0      \N
-7      0.21602468994692867
-5      0.15811388300841897
+7      0.21602468994692864
+5      0.15811388300841894
 
 -- !sql_stddev_samp_Double_agg_phase_4 --
 12     0.36055512754639896
 
 -- !sql_stddev_samp_Double_gb_notnull --
 0.21602468994692867
-0.15811388300841894
+0.15811388300841897
 
 -- !sql_stddev_samp_Double_notnull --
 0.36055512754639896
@@ -4120,11 +4129,11 @@ true
 
 -- !sql_stddev_samp_Double_agg_phase_3_notnull --
 0      \N
-7      0.21602468994692864
+7      0.21602468994692867
 5      0.15811388300841894
 
 -- !sql_stddev_samp_Double_agg_phase_4_notnull --
-12     0.36055512754639896
+12     0.3605551275463989
 
 -- !sql_stddev_samp_DecimalV2_agg_phase_1 --
 0      \N
@@ -4142,11 +4151,11 @@ true
 1      \N
 
 -- !sql_stddev_samp_DecimalV2_agg_phase_2 --
-12     0.36055512754639896
+12     0.3605551275463989
 
 -- !sql_stddev_samp_DecimalV2_agg_phase_3 --
 0      \N
-7      0.21602468994692864
+7      0.21602468994692867
 5      0.15811388300841897
 
 -- !sql_stddev_samp_DecimalV2_agg_phase_4 --
@@ -4172,7 +4181,7 @@ true
 -- !sql_stddev_samp_DecimalV2_agg_phase_3_notnull --
 0      \N
 7      0.21602468994692867
-5      0.15811388300841897
+5      0.15811388300841894
 
 -- !sql_stddev_samp_DecimalV2_agg_phase_4_notnull --
 12     0.36055512754639896
@@ -4462,7 +4471,7 @@ true
 -- !sql_sum_Double_gb --
 \N
 2.8
-5.0
+5.000000000000001
 
 -- !sql_sum_Double --
 7.8
@@ -4483,22 +4492,22 @@ true
 1      1.2
 
 -- !sql_sum_Double_agg_phase_2 --
-12     7.8
+12     7.800000000000001
 
 -- !sql_sum_Double_agg_phase_3 --
 0      \N
-7      2.8000000000000003
+7      2.8000000000000007
 5      5.0
 
 -- !sql_sum_Double_agg_phase_4 --
-12     7.800000000000001
+12     7.8
 
 -- !sql_sum_Double_gb_notnull --
 2.8
 5.0
 
 -- !sql_sum_Double_notnull --
-7.8
+7.800000000000001
 
 -- !sql_sum_Double_agg_phase_1_notnull --
 1      0.1
@@ -4923,11 +4932,11 @@ true
 
 -- !sql_variance_TinyInt_gb --
 \N
-4.0
+3.9999999999999996
 2.0
 
 -- !sql_variance_TinyInt --
-11.91666666666667
+11.916666666666666
 
 -- !sql_variance_TinyInt_agg_phase_1 --
 0      \N
@@ -4981,8 +4990,8 @@ true
 
 -- !sql_variance_TinyInt_agg_phase_3_notnull --
 0      \N
-7      4.000000000000001
-5      2.0
+7      4.0
+5      2.000000000000001
 
 -- !sql_variance_TinyInt_agg_phase_4_notnull --
 12     11.916666666666666
@@ -4990,7 +4999,7 @@ true
 -- !sql_variance_SmallInt_gb --
 \N
 3.9999999999999996
-2.0
+2.0000000000000004
 
 -- !sql_variance_SmallInt --
 11.916666666666666
@@ -5015,7 +5024,7 @@ true
 
 -- !sql_variance_SmallInt_agg_phase_3 --
 0      \N
-7      4.0
+7      3.999999999999999
 5      2.0
 
 -- !sql_variance_SmallInt_agg_phase_4 --
@@ -5023,10 +5032,10 @@ true
 
 -- !sql_variance_SmallInt_gb_notnull --
 4.0
-2.0
+2.0000000000000004
 
 -- !sql_variance_SmallInt_notnull --
-11.916666666666666
+11.91666666666667
 
 -- !sql_variance_SmallInt_agg_phase_1_notnull --
 1      0.0
@@ -5047,8 +5056,8 @@ true
 
 -- !sql_variance_SmallInt_agg_phase_3_notnull --
 0      \N
-7      4.0
-5      2.0
+7      3.9999999999999996
+5      1.9999999999999993
 
 -- !sql_variance_SmallInt_agg_phase_4_notnull --
 12     11.916666666666666
@@ -5081,14 +5090,14 @@ true
 
 -- !sql_variance_Integer_agg_phase_3 --
 0      \N
-7      4.000000000000001
+7      4.0
 5      2.0
 
 -- !sql_variance_Integer_agg_phase_4 --
 12     11.916666666666666
 
 -- !sql_variance_Integer_gb_notnull --
-4.0
+3.9999999999999996
 2.0
 
 -- !sql_variance_Integer_notnull --
@@ -5109,23 +5118,23 @@ true
 1      0.0
 
 -- !sql_variance_Integer_agg_phase_2_notnull --
-12     11.916666666666664
+12     11.916666666666666
 
 -- !sql_variance_Integer_agg_phase_3_notnull --
 0      \N
-7      4.0
-5      2.0
+7      3.9999999999999996
+5      2.0000000000000004
 
 -- !sql_variance_Integer_agg_phase_4_notnull --
 12     11.916666666666666
 
 -- !sql_variance_BigInt_gb --
 \N
-4.0
+3.9999999999999996
 2.0
 
 -- !sql_variance_BigInt --
-11.91666666666667
+11.916666666666666
 
 -- !sql_variance_BigInt_agg_phase_1 --
 0      \N
@@ -5147,18 +5156,18 @@ true
 
 -- !sql_variance_BigInt_agg_phase_3 --
 0      \N
-7      3.9999999999999996
-5      1.9999999999999993
+7      4.0
+5      2.0
 
 -- !sql_variance_BigInt_agg_phase_4 --
 12     11.916666666666666
 
 -- !sql_variance_BigInt_gb_notnull --
-3.9999999999999996
+4.0
 2.0
 
 -- !sql_variance_BigInt_notnull --
-11.91666666666667
+11.916666666666666
 
 -- !sql_variance_BigInt_agg_phase_1_notnull --
 1      0.0
@@ -5179,19 +5188,19 @@ true
 
 -- !sql_variance_BigInt_agg_phase_3_notnull --
 0      \N
-7      3.9999999999999996
-5      1.9999999999999993
+7      3.999999999999999
+5      2.0
 
 -- !sql_variance_BigInt_agg_phase_4_notnull --
 12     11.916666666666666
 
 -- !sql_variance_Float_gb --
 \N
-0.03999999970197688
+0.03999999970197689
 0.020000004768372152
 
 -- !sql_variance_Float --
-0.11916667052855127
+0.11916667052855125
 
 -- !sql_variance_Float_agg_phase_1 --
 0      \N
@@ -5214,7 +5223,7 @@ true
 -- !sql_variance_Float_agg_phase_3 --
 0      \N
 7      0.03999999970197688
-5      0.020000004768372152
+5      0.020000004768372145
 
 -- !sql_variance_Float_agg_phase_4 --
 12     0.11916667052855125
@@ -5275,22 +5284,22 @@ true
 1      0.0
 
 -- !sql_variance_Double_agg_phase_2 --
-12     0.11916666666666666
+12     0.11916666666666664
 
 -- !sql_variance_Double_agg_phase_3 --
 0      \N
-7      0.03999999999999999
-5      0.019999999999999997
+7      0.039999999999999994
+5      0.02
 
 -- !sql_variance_Double_agg_phase_4 --
-12     0.1191666666666667
+12     0.11916666666666668
 
 -- !sql_variance_Double_gb_notnull --
-0.04
+0.03999999999999999
 0.019999999999999997
 
 -- !sql_variance_Double_notnull --
-0.11916666666666666
+0.11916666666666668
 
 -- !sql_variance_Double_agg_phase_1_notnull --
 1      0.0
@@ -5307,20 +5316,20 @@ true
 1      0.0
 
 -- !sql_variance_Double_agg_phase_2_notnull --
-12     0.11916666666666668
+12     0.11916666666666666
 
 -- !sql_variance_Double_agg_phase_3_notnull --
 0      \N
-7      0.03999999999999999
-5      0.02
+7      0.039999999999999994
+5      0.019999999999999997
 
 -- !sql_variance_Double_agg_phase_4_notnull --
-12     0.11916666666666666
+12     0.11916666666666664
 
 -- !sql_variance_DecimalV2_gb --
 \N
 0.039999999999999994
-0.019999999999999997
+0.019999999999999993
 
 -- !sql_variance_DecimalV2 --
 0.11916666666666666
@@ -5345,11 +5354,11 @@ true
 
 -- !sql_variance_DecimalV2_agg_phase_3 --
 0      \N
-7      0.039999999999999994
-5      0.02
+7      0.03999999999999999
+5      0.019999999999999997
 
 -- !sql_variance_DecimalV2_agg_phase_4 --
-12     0.1191666666666667
+12     0.11916666666666664
 
 -- !sql_variance_DecimalV2_gb_notnull --
 0.03999999999999999
@@ -5373,15 +5382,15 @@ true
 1      0.0
 
 -- !sql_variance_DecimalV2_agg_phase_2_notnull --
-12     0.11916666666666666
+12     0.11916666666666668
 
 -- !sql_variance_DecimalV2_agg_phase_3_notnull --
 0      \N
-7      0.03999999999999999
-5      0.019999999999999993
+7      0.039999999999999994
+5      0.02
 
 -- !sql_variance_DecimalV2_agg_phase_4_notnull --
-12     0.11916666666666666
+12     0.11916666666666664
 
 -- !sql_variance_samp_TinyInt_gb --
 \N
@@ -5407,22 +5416,22 @@ true
 1      \N
 
 -- !sql_variance_samp_TinyInt_agg_phase_2 --
-12     12.999999999999998
+12     13.0
 
 -- !sql_variance_samp_TinyInt_agg_phase_3 --
 0      \N
 7      4.666666666666667
-5      2.5
+5      2.500000000000001
 
 -- !sql_variance_samp_TinyInt_agg_phase_4 --
 12     13.0
 
 -- !sql_variance_samp_TinyInt_gb_notnull --
-4.666666666666667
-2.5
+4.666666666666666
+2.499999999999999
 
 -- !sql_variance_samp_TinyInt_notnull --
-13.000000000000002
+13.0
 
 -- !sql_variance_samp_TinyInt_agg_phase_1_notnull --
 1      \N
@@ -5451,11 +5460,11 @@ true
 
 -- !sql_variance_samp_SmallInt_gb --
 \N
-4.666666666666667
+4.666666666666666
 2.5
 
 -- !sql_variance_samp_SmallInt --
-13.0
+13.000000000000002
 
 -- !sql_variance_samp_SmallInt_agg_phase_1 --
 0      \N
@@ -5484,7 +5493,7 @@ true
 12     13.0
 
 -- !sql_variance_samp_SmallInt_gb_notnull --
-4.666666666666667
+4.666666666666665
 2.5
 
 -- !sql_variance_samp_SmallInt_notnull --
@@ -5505,15 +5514,15 @@ true
 1      \N
 
 -- !sql_variance_samp_SmallInt_agg_phase_2_notnull --
-12     12.999999999999998
+12     13.0
 
 -- !sql_variance_samp_SmallInt_agg_phase_3_notnull --
 0      \N
-7      4.666666666666667
+7      4.666666666666665
 5      2.5
 
 -- !sql_variance_samp_SmallInt_agg_phase_4_notnull --
-12     12.999999999999998
+12     13.0
 
 -- !sql_variance_samp_Integer_gb --
 \N
@@ -5550,11 +5559,11 @@ true
 12     13.0
 
 -- !sql_variance_samp_Integer_gb_notnull --
-4.666666666666667
-2.5
+4.666666666666666
+2.5000000000000004
 
 -- !sql_variance_samp_Integer_notnull --
-13.000000000000002
+13.0
 
 -- !sql_variance_samp_Integer_agg_phase_1_notnull --
 1      \N
@@ -5571,12 +5580,12 @@ true
 1      \N
 
 -- !sql_variance_samp_Integer_agg_phase_2_notnull --
-12     12.999999999999998
+12     13.0
 
 -- !sql_variance_samp_Integer_agg_phase_3_notnull --
 0      \N
 7      4.666666666666667
-5      2.5
+5      2.5000000000000004
 
 -- !sql_variance_samp_Integer_agg_phase_4_notnull --
 12     13.0
@@ -5587,7 +5596,7 @@ true
 2.5
 
 -- !sql_variance_samp_BigInt --
-13.000000000000002
+13.0
 
 -- !sql_variance_samp_BigInt_agg_phase_1 --
 0      \N
@@ -5609,8 +5618,8 @@ true
 
 -- !sql_variance_samp_BigInt_agg_phase_3 --
 0      \N
-7      4.666666666666666
-5      2.499999999999999
+7      4.666666666666667
+5      2.500000000000001
 
 -- !sql_variance_samp_BigInt_agg_phase_4 --
 12     13.0
@@ -5641,7 +5650,7 @@ true
 
 -- !sql_variance_samp_BigInt_agg_phase_3_notnull --
 0      \N
-7      4.666666666666668
+7      4.666666666666667
 5      2.5
 
 -- !sql_variance_samp_BigInt_agg_phase_4_notnull --
@@ -5676,14 +5685,14 @@ true
 -- !sql_variance_samp_Float_agg_phase_3 --
 0      \N
 7      0.04666666631897303
-5      0.025000005960465182
+5      0.02500000596046519
 
 -- !sql_variance_samp_Float_agg_phase_4 --
 12     0.130000004212965
 
 -- !sql_variance_samp_Float_gb_notnull --
-0.04666666631897302
-0.02500000596046519
+0.04666666631897303
+0.025000005960465185
 
 -- !sql_variance_samp_Float_notnull --
 0.130000004212965
@@ -5708,7 +5717,7 @@ true
 -- !sql_variance_samp_Float_agg_phase_3_notnull --
 0      \N
 7      0.04666666631897302
-5      0.025000005960465192
+5      0.02500000596046519
 
 -- !sql_variance_samp_Float_agg_phase_4_notnull --
 12     0.130000004212965
@@ -5716,7 +5725,7 @@ true
 -- !sql_variance_samp_Double_gb --
 \N
 0.04666666666666666
-0.024999999999999994
+0.025
 
 -- !sql_variance_samp_Double --
 0.13
@@ -5737,19 +5746,19 @@ true
 1      \N
 
 -- !sql_variance_samp_Double_agg_phase_2 --
-12     0.13000000000000003
+12     0.13
 
 -- !sql_variance_samp_Double_agg_phase_3 --
 0      \N
 7      0.046666666666666655
-5      0.02499999999999999
+5      0.024999999999999994
 
 -- !sql_variance_samp_Double_agg_phase_4 --
-12     0.13000000000000003
+12     0.13
 
 -- !sql_variance_samp_Double_gb_notnull --
-0.04666666666666666
-0.024999999999999988
+0.04666666666666667
+0.025
 
 -- !sql_variance_samp_Double_notnull --
 0.13
@@ -5769,15 +5778,15 @@ true
 1      \N
 
 -- !sql_variance_samp_Double_agg_phase_2_notnull --
-12     0.13
+12     0.12999999999999998
 
 -- !sql_variance_samp_Double_agg_phase_3_notnull --
 0      \N
-7      0.04666666666666667
+7      0.04666666666666666
 5      0.025
 
 -- !sql_variance_samp_Double_agg_phase_4_notnull --
-12     0.13000000000000003
+12     0.13
 
 -- !sql_variance_samp_DecimalV2_agg_phase_1 --
 0      \N
@@ -5799,8 +5808,8 @@ true
 
 -- !sql_variance_samp_DecimalV2_agg_phase_3 --
 0      \N
-7      0.046666666666666655
-5      0.02499999999999999
+7      0.04666666666666666
+5      0.024999999999999994
 
 -- !sql_variance_samp_DecimalV2_agg_phase_4 --
 12     0.13
@@ -5825,7 +5834,7 @@ true
 -- !sql_variance_samp_DecimalV2_agg_phase_3_notnull --
 0      \N
 7      0.046666666666666655
-5      0.024999999999999994
+5      0.025
 
 -- !sql_variance_samp_DecimalV2_agg_phase_4_notnull --
 12     0.13
diff --git a/regression-test/suites/nereids_function_p0/agg_function/agg.groovy 
b/regression-test/suites/nereids_function_p0/agg_function/agg.groovy
index 1eecbf0030..7e32f97206 100644
--- a/regression-test/suites/nereids_function_p0/agg_function/agg.groovy
+++ b/regression-test/suites/nereids_function_p0/agg_function/agg.groovy
@@ -43,6 +43,11 @@ suite("nereids_agg_fn") {
                select 
/*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_DISTINCT, 
TWO_PHASE_AGGREGATE_WITH_DISTINCT')*/ count(distinct id, kint), any_value(kint) 
from fn_test group by kbool order by kbool'''
        sql '''
                select 
/*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_DISTINCT, 
TWO_PHASE_AGGREGATE_WITH_DISTINCT')*/ count(distinct id), any_value(kint) from 
fn_test'''
+       // count_by_enum_string result is unstable in one line, so just check 
not core
+       sql '''
+               select count_by_enum(kstr) from fn_test group by kbool order by 
kbool'''
+       sql '''
+               select count_by_enum(kstr) from fn_test_not_nullable group by 
kbool order by kbool'''
 
        qt_sql_avg_TinyInt_gb '''
                select avg(ktint) from fn_test group by kbool order by kbool'''
@@ -568,7 +573,6 @@ suite("nereids_agg_fn") {
                select 
/*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_DISTINCT, 
TWO_PHASE_AGGREGATE_WITH_DISTINCT')*/ count(distinct id, kint), count(kint) 
from fn_test group by kbool order by kbool'''
        qt_sql_count_AnyData_agg_phase_4_notnull '''
                select 
/*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_DISTINCT, 
TWO_PHASE_AGGREGATE_WITH_DISTINCT')*/ count(distinct id), count(kint) from 
fn_test'''
-
        qt_sql_group_bit_and_TinyInt_gb '''
                select group_bit_and(ktint) from fn_test group by kbool order 
by kbool'''
        qt_sql_group_bit_and_TinyInt '''


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

Reply via email to