This is an automated email from the ASF dual-hosted git repository.
morrysnow 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 fb41265c27 [opt](Nereids) add boolean type signature for sum aggregate
function (#21959)
fb41265c27 is described below
commit fb41265c27196e4bb20e1d8b7fe621aa0ed8b801
Author: zhangstar333 <[email protected]>
AuthorDate: Thu Jul 27 09:41:19 2023 +0800
[opt](Nereids) add boolean type signature for sum aggregate function
(#21959)
---
.../trees/expressions/functions/agg/Sum.java | 7 +-
.../nereids/trees/expressions/GetDataTypeTest.java | 2 +-
.../data/nereids_function_p0/agg_function/agg.out | 776 +++++++++------------
.../nereids_function_p0/agg_function/agg.groovy | 4 +
4 files changed, 341 insertions(+), 448 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum.java
index e91875902c..b8ee59c81f 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Sum.java
@@ -26,6 +26,7 @@ import
org.apache.doris.nereids.trees.expressions.functions.window.SupportWindow
import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.BigIntType;
+import org.apache.doris.nereids.types.BooleanType;
import org.apache.doris.nereids.types.DataType;
import org.apache.doris.nereids.types.DecimalV2Type;
import org.apache.doris.nereids.types.DecimalV3Type;
@@ -47,6 +48,7 @@ public class Sum extends NullableAggregateFunction
implements UnaryExpression, ExplicitlyCastableSignature,
ComputePrecisionForSum, SupportWindowAnalytic {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
+
FunctionSignature.ret(BigIntType.INSTANCE).args(BooleanType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(TinyIntType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(SmallIntType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(IntegerType.INSTANCE),
@@ -78,8 +80,9 @@ public class Sum extends NullableAggregateFunction
@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());
}
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/GetDataTypeTest.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/GetDataTypeTest.java
index bf346c1993..62019d8bac 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/GetDataTypeTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/GetDataTypeTest.java
@@ -66,7 +66,7 @@ public class GetDataTypeTest {
@Test
public void testSum() {
Assertions.assertEquals(BigIntType.INSTANCE, checkAndGetDataType(new
Sum(nullLiteral)));
- Assertions.assertThrows(RuntimeException.class, () ->
checkAndGetDataType(new Sum(booleanLiteral)));
+ Assertions.assertEquals(BigIntType.INSTANCE, checkAndGetDataType(new
Sum(booleanLiteral)));
Assertions.assertEquals(BigIntType.INSTANCE, checkAndGetDataType(new
Sum(tinyIntLiteral)));
Assertions.assertEquals(BigIntType.INSTANCE, checkAndGetDataType(new
Sum(smallIntLiteral)));
Assertions.assertEquals(BigIntType.INSTANCE, checkAndGetDataType(new
Sum(integerLiteral)));
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 275451c349..14497cc83c 100644
--- a/regression-test/data/nereids_function_p0/agg_function/agg.out
+++ b/regression-test/data/nereids_function_p0/agg_function/agg.out
@@ -302,7 +302,7 @@
1.0
-- !sql_avg_Double_notnull --
-0.6499999999999999
+0.65
-- !sql_avg_Double_agg_phase_1_notnull --
1 0.1
@@ -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 --
@@ -331,69 +331,69 @@
-- !sql_avg_DecimalV2_gb --
\N
-0.400000000
-1.000000000
+0.4000
+1.0000
-- !sql_avg_DecimalV2 --
-0.650000000
+0.6500
-- !sql_avg_DecimalV2_agg_phase_1 --
0 \N
-1 0.100000000
-1 0.200000000
-1 0.300000000
-1 0.400000000
-1 0.500000000
-1 0.600000000
-1 0.700000000
-1 0.800000000
-1 0.900000000
-1 1.000000000
-1 1.100000000
-1 1.200000000
+1 0.1000
+1 0.2000
+1 0.3000
+1 0.4000
+1 0.5000
+1 0.6000
+1 0.7000
+1 0.8000
+1 0.9000
+1 1.0000
+1 1.1000
+1 1.2000
-- !sql_avg_DecimalV2_agg_phase_2 --
-12 0.650000000
+12 0.6500
-- !sql_avg_DecimalV2_agg_phase_3 --
0 \N
-7 0.400000000
-5 1.000000000
+7 0.4000
+5 1.0000
-- !sql_avg_DecimalV2_agg_phase_4 --
-12 0.650000000
+12 0.6500
-- !sql_avg_DecimalV2_gb_notnull --
-0.400000000
-1.000000000
+0.4000
+1.0000
-- !sql_avg_DecimalV2_notnull --
-0.650000000
+0.6500
-- !sql_avg_DecimalV2_agg_phase_1_notnull --
-1 0.100000000
-1 0.200000000
-1 0.300000000
-1 0.400000000
-1 0.500000000
-1 0.600000000
-1 0.700000000
-1 0.800000000
-1 0.900000000
-1 1.000000000
-1 1.100000000
-1 1.200000000
+1 0.1000
+1 0.2000
+1 0.3000
+1 0.4000
+1 0.5000
+1 0.6000
+1 0.7000
+1 0.8000
+1 0.9000
+1 1.0000
+1 1.1000
+1 1.2000
-- !sql_avg_DecimalV2_agg_phase_2_notnull --
-12 0.650000000
+12 0.6500
-- !sql_avg_DecimalV2_agg_phase_3_notnull --
0 \N
-7 0.400000000
-5 1.000000000
+7 0.4000
+5 1.0000
-- !sql_avg_DecimalV2_agg_phase_4_notnull --
-12 0.650000000
+12 0.6500
-- !sql_avg_weighted_TinyInt_Double_gb --
\N
@@ -401,7 +401,7 @@
10.2
-- !sql_avg_weighted_TinyInt_Double --
-8.333333333333332
+8.333333333333334
-- !sql_avg_weighted_TinyInt_Double_agg_phase_1 --
0 \N
@@ -423,11 +423,11 @@
-- !sql_avg_weighted_TinyInt_Double_agg_phase_3 --
0 \N
-7 4.999999999999999
+7 5.0
5 10.2
-- !sql_avg_weighted_TinyInt_Double_agg_phase_4 --
-12 8.333333333333332
+12 8.333333333333334
-- !sql_avg_weighted_TinyInt_Double_gb_notnull --
5.0
@@ -451,7 +451,7 @@
1 12.0
-- !sql_avg_weighted_TinyInt_Double_agg_phase_2_notnull --
-12 8.333333333333334
+12 8.333333333333332
-- !sql_avg_weighted_TinyInt_Double_agg_phase_3_notnull --
0 \N
@@ -459,15 +459,15 @@
5 10.2
-- !sql_avg_weighted_TinyInt_Double_agg_phase_4_notnull --
-12 8.333333333333332
+12 8.333333333333334
-- !sql_avg_weighted_SmallInt_Double_gb --
\N
-4.999999999999999
+5.0
10.2
-- !sql_avg_weighted_SmallInt_Double --
-8.333333333333334
+8.333333333333332
-- !sql_avg_weighted_SmallInt_Double_agg_phase_1 --
0 \N
@@ -489,18 +489,18 @@
-- !sql_avg_weighted_SmallInt_Double_agg_phase_3 --
0 \N
-7 4.999999999999999
-5 10.2
+7 5.0
+5 10.199999999999998
-- !sql_avg_weighted_SmallInt_Double_agg_phase_4 --
-12 8.333333333333334
+12 8.333333333333332
-- !sql_avg_weighted_SmallInt_Double_gb_notnull --
-4.999999999999999
+5.0
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.999999999999999
5 10.2
-- !sql_avg_weighted_SmallInt_Double_agg_phase_4_notnull --
-12 8.333333333333332
+12 8.333333333333334
-- !sql_avg_weighted_Integer_Double_gb --
\N
-4.999999999999999
+5.0
10.2
-- !sql_avg_weighted_Integer_Double --
-8.333333333333334
+8.333333333333332
-- !sql_avg_weighted_Integer_Double_agg_phase_1 --
0 \N
@@ -551,22 +551,22 @@
1 12.0
-- !sql_avg_weighted_Integer_Double_agg_phase_2 --
-12 8.333333333333332
+12 8.333333333333334
-- !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.333333333333332
+12 8.333333333333334
-- !sql_avg_weighted_Integer_Double_gb_notnull --
4.999999999999999
10.2
-- !sql_avg_weighted_Integer_Double_notnull --
-8.333333333333334
+8.333333333333332
-- !sql_avg_weighted_Integer_Double_agg_phase_1_notnull --
1 1.0
@@ -588,7 +588,7 @@
-- !sql_avg_weighted_Integer_Double_agg_phase_3_notnull --
0 \N
7 5.0
-5 10.2
+5 10.199999999999998
-- !sql_avg_weighted_Integer_Double_agg_phase_4_notnull --
12 8.333333333333334
@@ -599,7 +599,7 @@
10.2
-- !sql_avg_weighted_BigInt_Double --
-8.333333333333334
+8.333333333333332
-- !sql_avg_weighted_BigInt_Double_agg_phase_1 --
0 \N
@@ -621,18 +621,18 @@
-- !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.333333333333332
+12 8.333333333333334
-- !sql_avg_weighted_BigInt_Double_gb_notnull --
-4.999999999999999
+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,11 +653,11 @@
-- !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.333333333333332
+12 8.333333333333334
-- !sql_avg_weighted_Float_Double_gb --
\N
@@ -683,7 +683,7 @@
1 1.2000000476837158
-- !sql_avg_weighted_Float_Double_agg_phase_2 --
-12 0.8333333441271231
+12 0.833333344127123
-- !sql_avg_weighted_Float_Double_agg_phase_3 --
0 \N
@@ -695,10 +695,10 @@
-- !sql_avg_weighted_Float_Double_gb_notnull --
0.5000000045235667
-1.0200000143051144
+1.0200000143051149
-- !sql_avg_weighted_Float_Double_notnull --
-0.8333333441271232
+0.8333333441271231
-- !sql_avg_weighted_Float_Double_agg_phase_1_notnull --
1 0.10000000149011612
@@ -719,15 +719,15 @@
-- !sql_avg_weighted_Float_Double_agg_phase_3_notnull --
0 \N
-7 0.5000000045235666
-5 1.0200000143051149
+7 0.5000000045235667
+5 1.0200000143051147
-- !sql_avg_weighted_Float_Double_agg_phase_4_notnull --
-12 0.833333344127123
+12 0.8333333441271231
-- !sql_avg_weighted_Double_Double_gb --
\N
-0.5000000000000001
+0.5
1.02
-- !sql_avg_weighted_Double_Double --
@@ -749,22 +749,22 @@
1 1.2
-- !sql_avg_weighted_Double_Double_agg_phase_2 --
-12 0.8333333333333334
+12 0.8333333333333333
-- !sql_avg_weighted_Double_Double_agg_phase_3 --
0 \N
-7 0.49999999999999983
+7 0.49999999999999994
5 1.02
-- !sql_avg_weighted_Double_Double_agg_phase_4 --
12 0.8333333333333334
-- !sql_avg_weighted_Double_Double_gb_notnull --
-0.49999999999999994
+0.5
1.02
-- !sql_avg_weighted_Double_Double_notnull --
-0.8333333333333334
+0.8333333333333333
-- !sql_avg_weighted_Double_Double_agg_phase_1_notnull --
1 0.10000000000000002
@@ -785,7 +785,7 @@
-- !sql_avg_weighted_Double_Double_agg_phase_3_notnull --
0 \N
-7 0.5000000000000001
+7 0.49999999999999994
5 1.02
-- !sql_avg_weighted_Double_Double_agg_phase_4_notnull --
@@ -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,8 +819,8 @@
-- !sql_avg_weighted_DecimalV2_Double_agg_phase_3 --
0 \N
-7 0.5000000000000001
-5 1.0199999999999998
+7 0.49999999999999983
+5 1.02
-- !sql_avg_weighted_DecimalV2_Double_agg_phase_4 --
12 0.8333333333333333
@@ -830,7 +830,7 @@
1.02
-- !sql_avg_weighted_DecimalV2_Double_notnull --
-0.8333333333333334
+0.8333333333333335
-- !sql_avg_weighted_DecimalV2_Double_agg_phase_1_notnull --
1 0.10000000000000002
@@ -851,7 +851,7 @@
-- !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 --
@@ -2441,120 +2441,6 @@
-- !sql_group_bitmap_xor_Bitmap_agg_phase_4_notnull --
12 \N
--- !sql_group_concat_Varchar_gb --
-\N
-1, 2, 3, 4, 5, 6, 7
-8, 9, 10, 11, 12
-
--- !sql_group_concat_Varchar_agg_phase_1 --
-0 \N
-1 1
-1 2
-1 3
-1 4
-1 5
-1 6
-1 7
-1 8
-1 9
-1 10
-1 11
-1 12
-
--- !sql_group_concat_Varchar_gb_notnull --
-1, 2, 3, 4, 5, 6, 7
-8, 9, 10, 11, 12
-
--- !sql_group_concat_Varchar_agg_phase_1_notnull --
-1 1
-1 2
-1 3
-1 4
-1 5
-1 6
-1 7
-1 8
-1 9
-1 10
-1 11
-1 12
-
--- !sql_group_concat_Varchar_AnyData_gb --
-\N
-1, 2, 3, 4, 5, 6, 7
-8, 9, 10, 11, 12
-
--- !sql_group_concat_Varchar_AnyData_agg_phase_1 --
-0 \N
-1 1
-1 2
-1 3
-1 4
-1 5
-1 6
-1 7
-1 8
-1 9
-1 10
-1 11
-1 12
-
--- !sql_group_concat_Varchar_AnyData_gb_notnull --
-1, 2, 3, 4, 5, 6, 7
-8, 9, 10, 11, 12
-
--- !sql_group_concat_Varchar_AnyData_agg_phase_1_notnull --
-1 1
-1 2
-1 3
-1 4
-1 5
-1 6
-1 7
-1 8
-1 9
-1 10
-1 11
-1 12
-
--- !sql_group_concat_Varchar_Varchar_AnyData_gb --
-\N
-1_x_2_x_3_x_4_x_5_x_6_x_7
-8_x_9_x_10_x_11_x_12
-
--- !sql_group_concat_Varchar_Varchar_AnyData_agg_phase_1 --
-0 \N
-1 1
-1 2
-1 3
-1 4
-1 5
-1 6
-1 7
-1 8
-1 9
-1 10
-1 11
-1 12
-
--- !sql_group_concat_Varchar_Varchar_AnyData_gb_notnull --
-1_x_2_x_3_x_4_x_5_x_6_x_7
-8_x_9_x_10_x_11_x_12
-
--- !sql_group_concat_Varchar_Varchar_AnyData_agg_phase_1_notnull --
-1 1
-1 2
-1 3
-1 4
-1 5
-1 6
-1 7
-1 8
-1 9
-1 10
-1 11
-1 12
-
-- !sql_max_by_AnyData_AnyData_gb --
\N
7
@@ -2753,11 +2639,6 @@
-- !sql_ndv_AnyData_agg_phase_4_notnull --
12 12
--- !sql_orthogonal_bitmap_union_count_Bitmap_gb --
-0
-7
-5
-
-- !sql_orthogonal_bitmap_union_count_Bitmap --
12
@@ -2776,18 +2657,9 @@
1 1
1 1
--- !sql_orthogonal_bitmap_union_count_Bitmap_agg_phase_3 --
-0 0
-7 0
-5 0
-
-- !sql_orthogonal_bitmap_union_count_Bitmap_agg_phase_4 --
12 0
--- !sql_orthogonal_bitmap_union_count_Bitmap_gb_notnull --
-7
-5
-
-- !sql_orthogonal_bitmap_union_count_Bitmap_notnull --
12
@@ -2805,11 +2677,6 @@
1 1
1 1
--- !sql_orthogonal_bitmap_union_count_Bitmap_agg_phase_3_notnull --
-0 0
-7 0
-5 0
-
-- !sql_orthogonal_bitmap_union_count_Bitmap_agg_phase_4_notnull --
12 0
@@ -3467,8 +3334,8 @@ true
-- !sql_stddev_TinyInt_agg_phase_3_notnull --
0 \N
-7 1.9999999999999998
-5 1.414213562373095
+7 2.0
+5 1.4142135623730951
-- !sql_stddev_TinyInt_agg_phase_4_notnull --
12 3.452052529534663
@@ -3512,7 +3379,7 @@ true
1.4142135623730951
-- !sql_stddev_SmallInt_notnull --
-3.452052529534663
+3.452052529534664
-- !sql_stddev_SmallInt_agg_phase_1_notnull --
1 0.0
@@ -3533,7 +3400,7 @@ true
-- !sql_stddev_SmallInt_agg_phase_3_notnull --
0 \N
-7 2.0
+7 1.9999999999999998
5 1.4142135623730951
-- !sql_stddev_SmallInt_agg_phase_4_notnull --
@@ -3542,10 +3409,10 @@ true
-- !sql_stddev_Integer_gb --
\N
2.0
-1.4142135623730954
+1.4142135623730951
-- !sql_stddev_Integer --
-3.452052529534663
+3.452052529534664
-- !sql_stddev_Integer_agg_phase_1 --
0 \N
@@ -3574,11 +3441,11 @@ true
12 3.452052529534663
-- !sql_stddev_Integer_gb_notnull --
-1.9999999999999998
+2.0
1.4142135623730951
-- !sql_stddev_Integer_notnull --
-3.452052529534663
+3.452052529534664
-- !sql_stddev_Integer_agg_phase_1_notnull --
1 0.0
@@ -3599,16 +3466,16 @@ true
-- !sql_stddev_Integer_agg_phase_3_notnull --
0 \N
-7 1.9999999999999998
-5 1.414213562373095
+7 2.0
+5 1.4142135623730951
-- !sql_stddev_Integer_agg_phase_4_notnull --
12 3.452052529534663
-- !sql_stddev_BigInt_gb --
\N
-2.0
-1.414213562373095
+1.9999999999999998
+1.4142135623730951
-- !sql_stddev_BigInt --
3.452052529534663
@@ -3644,7 +3511,7 @@ true
1.4142135623730951
-- !sql_stddev_BigInt_notnull --
-3.452052529534664
+3.452052529534663
-- !sql_stddev_BigInt_agg_phase_1_notnull --
1 0.0
@@ -3677,7 +3544,7 @@ true
0.1414213730960499
-- !sql_stddev_Float --
-0.34520525854707257
+0.3452052585470726
-- !sql_stddev_Float_agg_phase_1 --
0 \N
@@ -3710,7 +3577,7 @@ true
0.1414213730960499
-- !sql_stddev_Float_notnull --
-0.3452052585470726
+0.3452052585470727
-- !sql_stddev_Float_agg_phase_1_notnull --
1 0.0
@@ -3727,7 +3594,7 @@ true
1 0.0
-- !sql_stddev_Float_agg_phase_2_notnull --
-12 0.34520525854707257
+12 0.3452052585470726
-- !sql_stddev_Float_agg_phase_3_notnull --
0 \N
@@ -3735,11 +3602,11 @@ true
5 0.1414213730960499
-- !sql_stddev_Float_agg_phase_4_notnull --
-12 0.34520525854707257
+12 0.3452052585470726
-- !sql_stddev_Double_gb --
\N
-0.19999999999999998
+0.2
0.1414213562373095
-- !sql_stddev_Double --
@@ -3805,63 +3672,63 @@ true
-- !sql_stddev_DecimalV2_gb --
\N
-0.200000000
-0.141421356
+0.19999999999999998
+0.1414213562373095
-- !sql_stddev_DecimalV2_agg_phase_1 --
0 \N
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
-- !sql_stddev_DecimalV2_agg_phase_2 --
-12 0.345205253
+12 0.3452052529534663
-- !sql_stddev_DecimalV2_agg_phase_3 --
0 \N
-7 0.200000000
-5 0.141421356
+7 0.19999999999999996
+5 0.14142135623730948
-- !sql_stddev_DecimalV2_agg_phase_4 --
-12 0.345205253
+12 0.3452052529534663
-- !sql_stddev_DecimalV2_gb_notnull --
-0.200000000
-0.141421356
+0.19999999999999998
+0.14142135623730948
-- !sql_stddev_DecimalV2_agg_phase_1_notnull --
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
-- !sql_stddev_DecimalV2_agg_phase_2_notnull --
-12 0.345205253
+12 0.3452052529534663
-- !sql_stddev_DecimalV2_agg_phase_3_notnull --
0 \N
-7 0.200000000
-5 0.141421356
+7 0.19999999999999998
+5 0.1414213562373095
-- !sql_stddev_DecimalV2_agg_phase_4_notnull --
-12 0.345205253
+12 0.3452052529534663
-- !sql_stddev_samp_TinyInt_gb --
\N
@@ -3892,7 +3759,7 @@ true
-- !sql_stddev_samp_TinyInt_agg_phase_3 --
0 \N
7 2.160246899469287
-5 1.58113883008419
+5 1.5811388300841898
-- !sql_stddev_samp_TinyInt_agg_phase_4 --
12 3.605551275463989
@@ -3923,8 +3790,8 @@ true
-- !sql_stddev_samp_TinyInt_agg_phase_3_notnull --
0 \N
-7 2.160246899469287
-5 1.5811388300841898
+7 2.1602468994692865
+5 1.5811388300841893
-- !sql_stddev_samp_TinyInt_agg_phase_4_notnull --
12 3.605551275463989
@@ -3968,7 +3835,7 @@ true
1.5811388300841898
-- !sql_stddev_samp_SmallInt_notnull --
-3.605551275463989
+3.6055512754639896
-- !sql_stddev_samp_SmallInt_agg_phase_1_notnull --
1 \N
@@ -3998,10 +3865,10 @@ true
-- !sql_stddev_samp_Integer_gb --
\N
2.160246899469287
-1.58113883008419
+1.5811388300841898
-- !sql_stddev_samp_Integer --
-3.605551275463989
+3.6055512754639896
-- !sql_stddev_samp_Integer_agg_phase_1 --
0 \N
@@ -4024,7 +3891,7 @@ true
-- !sql_stddev_samp_Integer_agg_phase_3 --
0 \N
7 2.1602468994692865
-5 1.5811388300841898
+5 1.5811388300841893
-- !sql_stddev_samp_Integer_agg_phase_4 --
12 3.605551275463989
@@ -4055,8 +3922,8 @@ true
-- !sql_stddev_samp_Integer_agg_phase_3_notnull --
0 \N
-7 2.1602468994692865
-5 1.5811388300841893
+7 2.160246899469287
+5 1.5811388300841898
-- !sql_stddev_samp_Integer_agg_phase_4_notnull --
12 3.605551275463989
@@ -4064,7 +3931,7 @@ true
-- !sql_stddev_samp_BigInt_gb --
\N
2.160246899469287
-1.58113883008419
+1.5811388300841898
-- !sql_stddev_samp_BigInt --
3.605551275463989
@@ -4122,7 +3989,7 @@ true
-- !sql_stddev_samp_BigInt_agg_phase_3_notnull --
0 \N
7 2.160246899469287
-5 1.5811388300841898
+5 1.58113883008419
-- !sql_stddev_samp_BigInt_agg_phase_4_notnull --
12 3.605551275463989
@@ -4151,18 +4018,18 @@ true
1 \N
-- !sql_stddev_samp_Float_agg_phase_2 --
-12 0.36055513338873013
+12 0.3605551333887302
-- !sql_stddev_samp_Float_agg_phase_3 --
0 \N
7 0.2160246891421743
-5 0.15811390185706375
+5 0.15811390185706373
-- !sql_stddev_samp_Float_agg_phase_4 --
-12 0.36055513338873013
+12 0.3605551333887302
-- !sql_stddev_samp_Float_gb_notnull --
-0.2160246891421743
+0.21602468914217424
0.15811390185706375
-- !sql_stddev_samp_Float_notnull --
@@ -4183,7 +4050,7 @@ true
1 \N
-- !sql_stddev_samp_Float_agg_phase_2_notnull --
-12 0.36055513338873013
+12 0.3605551333887302
-- !sql_stddev_samp_Float_agg_phase_3_notnull --
0 \N
@@ -4196,7 +4063,7 @@ true
-- !sql_stddev_samp_Double_gb --
\N
0.21602468994692867
-0.15811388300841897
+0.15811388300841894
-- !sql_stddev_samp_Double --
0.36055512754639896
@@ -4222,14 +4089,14 @@ true
-- !sql_stddev_samp_Double_agg_phase_3 --
0 \N
7 0.21602468994692864
-5 0.15811388300841897
+5 0.15811388300841892
-- !sql_stddev_samp_Double_agg_phase_4 --
12 0.36055512754639896
-- !sql_stddev_samp_Double_gb_notnull --
-0.21602468994692864
-0.15811388300841897
+0.21602468994692867
+0.15811388300841894
-- !sql_stddev_samp_Double_notnull --
0.36055512754639896
@@ -4254,7 +4121,7 @@ true
-- !sql_stddev_samp_Double_agg_phase_3_notnull --
0 \N
7 0.21602468994692867
-5 0.15811388300841894
+5 0.15811388300841897
-- !sql_stddev_samp_Double_agg_phase_4_notnull --
12 0.36055512754639896
@@ -4275,15 +4142,15 @@ true
1 \N
-- !sql_stddev_samp_DecimalV2_agg_phase_2 --
-12 0.360555127
+12 0.36055512754639896
-- !sql_stddev_samp_DecimalV2_agg_phase_3 --
0 \N
-7 0.216024690
-5 0.158113883
+7 0.21602468994692864
+5 0.15811388300841897
-- !sql_stddev_samp_DecimalV2_agg_phase_4 --
-12 0.360555127
+12 0.36055512754639896
-- !sql_stddev_samp_DecimalV2_agg_phase_1_notnull --
1 \N
@@ -4300,15 +4167,33 @@ true
1 \N
-- !sql_stddev_samp_DecimalV2_agg_phase_2_notnull --
-12 0.360555127
+12 0.36055512754639896
-- !sql_stddev_samp_DecimalV2_agg_phase_3_notnull --
0 \N
-7 0.216024690
-5 0.158113883
+7 0.21602468994692867
+5 0.15811388300841897
-- !sql_stddev_samp_DecimalV2_agg_phase_4_notnull --
-12 0.360555127
+12 0.36055512754639896
+
+-- !sql_sum_Boolean --
+5
+
+-- !sql_sum_Boolean_gb --
+\N
+0
+0
+0
+0
+0
+0
+0
+1
+1
+1
+1
+1
-- !sql_sum_TinyInt_gb --
\N
@@ -4576,7 +4461,7 @@ true
-- !sql_sum_Double_gb --
\N
-2.8000000000000003
+2.8
5.0
-- !sql_sum_Double --
@@ -4598,18 +4483,18 @@ 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.8
+7 2.8000000000000007
5 5.0
-- !sql_sum_Double_agg_phase_4 --
-12 7.800000000000001
+12 7.8
-- !sql_sum_Double_gb_notnull --
-2.8000000000000003
+2.8
5.0
-- !sql_sum_Double_notnull --
@@ -4634,7 +4519,7 @@ true
-- !sql_sum_Double_agg_phase_3_notnull --
0 \N
-7 2.8000000000000007
+7 2.8
5 5.0
-- !sql_sum_Double_agg_phase_4_notnull --
@@ -4642,69 +4527,69 @@ true
-- !sql_sum_DecimalV2_gb --
\N
-2.800000000
-5.000000000
+2.800
+5.000
-- !sql_sum_DecimalV2 --
-7.800000000
+7.800
-- !sql_sum_DecimalV2_agg_phase_1 --
0 \N
-1 0.100000000
-1 0.200000000
-1 0.300000000
-1 0.400000000
-1 0.500000000
-1 0.600000000
-1 0.700000000
-1 0.800000000
-1 0.900000000
-1 1.000000000
-1 1.100000000
-1 1.200000000
+1 0.100
+1 0.200
+1 0.300
+1 0.400
+1 0.500
+1 0.600
+1 0.700
+1 0.800
+1 0.900
+1 1.000
+1 1.100
+1 1.200
-- !sql_sum_DecimalV2_agg_phase_2 --
-12 7.800000000
+12 7.800
-- !sql_sum_DecimalV2_agg_phase_3 --
0 \N
-7 2.800000000
-5 5.000000000
+7 2.800
+5 5.000
-- !sql_sum_DecimalV2_agg_phase_4 --
-12 7.800000000
+12 7.800
-- !sql_sum_DecimalV2_gb_notnull --
-2.800000000
-5.000000000
+2.800
+5.000
-- !sql_sum_DecimalV2_notnull --
-7.800000000
+7.800
-- !sql_sum_DecimalV2_agg_phase_1_notnull --
-1 0.100000000
-1 0.200000000
-1 0.300000000
-1 0.400000000
-1 0.500000000
-1 0.600000000
-1 0.700000000
-1 0.800000000
-1 0.900000000
-1 1.000000000
-1 1.100000000
-1 1.200000000
+1 0.100
+1 0.200
+1 0.300
+1 0.400
+1 0.500
+1 0.600
+1 0.700
+1 0.800
+1 0.900
+1 1.000
+1 1.100
+1 1.200
-- !sql_sum_DecimalV2_agg_phase_2_notnull --
-12 7.800000000
+12 7.800
-- !sql_sum_DecimalV2_agg_phase_3_notnull --
0 \N
-7 2.800000000
-5 5.000000000
+7 2.800
+5 5.000
-- !sql_sum_DecimalV2_agg_phase_4_notnull --
-12 7.800000000
+12 7.800
-- !sql_sum_LargeInt_gb --
\N
@@ -5042,7 +4927,7 @@ true
2.0
-- !sql_variance_TinyInt --
-11.916666666666666
+11.91666666666667
-- !sql_variance_TinyInt_agg_phase_1 --
0 \N
@@ -5071,8 +4956,8 @@ true
12 11.916666666666666
-- !sql_variance_TinyInt_gb_notnull --
-4.0
-2.0
+3.9999999999999996
+2.0000000000000004
-- !sql_variance_TinyInt_notnull --
11.916666666666666
@@ -5096,7 +4981,7 @@ true
-- !sql_variance_TinyInt_agg_phase_3_notnull --
0 \N
-7 3.9999999999999996
+7 4.0
5 2.0
-- !sql_variance_TinyInt_agg_phase_4_notnull --
@@ -5108,7 +4993,7 @@ true
2.0
-- !sql_variance_SmallInt --
-11.916666666666666
+11.91666666666667
-- !sql_variance_SmallInt_agg_phase_1 --
0 \N
@@ -5137,8 +5022,8 @@ true
12 11.916666666666666
-- !sql_variance_SmallInt_gb_notnull --
-4.0
-2.0
+3.9999999999999996
+2.0000000000000004
-- !sql_variance_SmallInt_notnull --
11.916666666666666
@@ -5162,7 +5047,7 @@ true
-- !sql_variance_SmallInt_agg_phase_3_notnull --
0 \N
-7 4.0
+7 4.000000000000001
5 2.0
-- !sql_variance_SmallInt_agg_phase_4_notnull --
@@ -5170,11 +5055,11 @@ true
-- !sql_variance_Integer_gb --
\N
-3.999999999999999
+4.0
2.0
-- !sql_variance_Integer --
-11.91666666666667
+11.916666666666666
-- !sql_variance_Integer_agg_phase_1 --
0 \N
@@ -5196,18 +5081,18 @@ true
-- !sql_variance_Integer_agg_phase_3 --
0 \N
-7 4.000000000000001
+7 3.9999999999999996
5 2.0
-- !sql_variance_Integer_agg_phase_4 --
12 11.916666666666666
-- !sql_variance_Integer_gb_notnull --
-4.0
-2.0
+3.9999999999999996
+2.0000000000000004
-- !sql_variance_Integer_notnull --
-11.916666666666666
+11.91666666666667
-- !sql_variance_Integer_agg_phase_1_notnull --
1 0.0
@@ -5228,7 +5113,7 @@ true
-- !sql_variance_Integer_agg_phase_3_notnull --
0 \N
-7 4.0
+7 3.9999999999999996
5 2.0
-- !sql_variance_Integer_agg_phase_4_notnull --
@@ -5236,7 +5121,7 @@ true
-- !sql_variance_BigInt_gb --
\N
-3.9999999999999996
+4.0
2.0
-- !sql_variance_BigInt --
@@ -5262,7 +5147,7 @@ true
-- !sql_variance_BigInt_agg_phase_3 --
0 \N
-7 3.9999999999999996
+7 4.0
5 2.0
-- !sql_variance_BigInt_agg_phase_4 --
@@ -5270,7 +5155,7 @@ true
-- !sql_variance_BigInt_gb_notnull --
3.9999999999999996
-2.0
+2.0000000000000004
-- !sql_variance_BigInt_notnull --
11.91666666666667
@@ -5306,7 +5191,7 @@ true
0.02000000476837215
-- !sql_variance_Float --
-0.11916667052855127
+0.11916667052855125
-- !sql_variance_Float_agg_phase_1 --
0 \N
@@ -5328,7 +5213,7 @@ true
-- !sql_variance_Float_agg_phase_3 --
0 \N
-7 0.03999999970197688
+7 0.039999999701976874
5 0.020000004768372152
-- !sql_variance_Float_agg_phase_4 --
@@ -5339,7 +5224,7 @@ true
0.020000004768372152
-- !sql_variance_Float_notnull --
-0.11916667052855127
+0.11916667052855125
-- !sql_variance_Float_agg_phase_1_notnull --
1 0.0
@@ -5356,7 +5241,7 @@ true
1 0.0
-- !sql_variance_Float_agg_phase_2_notnull --
-12 0.11916667052855123
+12 0.11916667052855125
-- !sql_variance_Float_agg_phase_3_notnull --
0 \N
@@ -5369,10 +5254,10 @@ true
-- !sql_variance_Double_gb --
\N
0.039999999999999994
-0.01999999999999999
+0.019999999999999993
-- !sql_variance_Double --
-0.11916666666666668
+0.11916666666666666
-- !sql_variance_Double_agg_phase_1 --
0 \N
@@ -5390,22 +5275,22 @@ true
1 0.0
-- !sql_variance_Double_agg_phase_2 --
-12 0.11916666666666668
+12 0.11916666666666666
-- !sql_variance_Double_agg_phase_3 --
0 \N
7 0.039999999999999994
-5 0.02
+5 0.019999999999999997
-- !sql_variance_Double_agg_phase_4 --
-12 0.11916666666666664
+12 0.11916666666666668
-- !sql_variance_Double_gb_notnull --
0.039999999999999994
-0.019999999999999997
+0.02
-- !sql_variance_Double_notnull --
-0.1191666666666667
+0.11916666666666666
-- !sql_variance_Double_agg_phase_1_notnull --
1 0.0
@@ -5434,74 +5319,74 @@ true
-- !sql_variance_DecimalV2_gb --
\N
-0.040000000
-0.020000000
+0.039999999999999994
+0.02
-- !sql_variance_DecimalV2 --
-0.119166667
+0.11916666666666668
-- !sql_variance_DecimalV2_agg_phase_1 --
0 \N
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
-- !sql_variance_DecimalV2_agg_phase_2 --
-12 0.119166667
+12 0.11916666666666668
-- !sql_variance_DecimalV2_agg_phase_3 --
0 \N
-7 0.040000000
-5 0.020000000
+7 0.03999999999999999
+5 0.019999999999999993
-- !sql_variance_DecimalV2_agg_phase_4 --
-12 0.119166667
+12 0.11916666666666668
-- !sql_variance_DecimalV2_gb_notnull --
-0.040000000
-0.020000000
+0.04
+0.019999999999999997
-- !sql_variance_DecimalV2_notnull --
-0.119166667
+0.11916666666666666
-- !sql_variance_DecimalV2_agg_phase_1_notnull --
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
-1 0E-9
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
+1 0.0
-- !sql_variance_DecimalV2_agg_phase_2_notnull --
-12 0.119166667
+12 0.11916666666666668
-- !sql_variance_DecimalV2_agg_phase_3_notnull --
0 \N
-7 0.040000000
-5 0.020000000
+7 0.03999999999999999
+5 0.01999999999999999
-- !sql_variance_DecimalV2_agg_phase_4_notnull --
-12 0.119166667
+12 0.11916666666666666
-- !sql_variance_samp_TinyInt_gb --
\N
4.666666666666667
-2.5
+2.5000000000000004
-- !sql_variance_samp_TinyInt --
13.0
@@ -5533,8 +5418,8 @@ true
12 13.0
-- !sql_variance_samp_TinyInt_gb_notnull --
-4.666666666666665
-2.5
+4.666666666666667
+2.5000000000000004
-- !sql_variance_samp_TinyInt_notnull --
13.0
@@ -5570,7 +5455,7 @@ true
2.5
-- !sql_variance_samp_SmallInt --
-13.0
+13.000000000000002
-- !sql_variance_samp_SmallInt_agg_phase_1 --
0 \N
@@ -5600,7 +5485,7 @@ true
-- !sql_variance_samp_SmallInt_gb_notnull --
4.666666666666667
-2.5000000000000004
+2.5
-- !sql_variance_samp_SmallInt_notnull --
13.0
@@ -5624,7 +5509,7 @@ true
-- !sql_variance_samp_SmallInt_agg_phase_3_notnull --
0 \N
-7 4.666666666666667
+7 4.666666666666668
5 2.5
-- !sql_variance_samp_SmallInt_agg_phase_4_notnull --
@@ -5633,7 +5518,7 @@ true
-- !sql_variance_samp_Integer_gb --
\N
4.666666666666667
-2.5000000000000004
+2.5
-- !sql_variance_samp_Integer --
13.0
@@ -5658,15 +5543,15 @@ true
-- !sql_variance_samp_Integer_agg_phase_3 --
0 \N
-7 4.666666666666668
-5 2.5
+7 4.666666666666666
+5 2.499999999999999
-- !sql_variance_samp_Integer_agg_phase_4 --
12 13.0
-- !sql_variance_samp_Integer_gb_notnull --
-4.666666666666667
-2.5
+4.666666666666666
+2.5000000000000004
-- !sql_variance_samp_Integer_notnull --
13.0
@@ -5724,7 +5609,7 @@ true
-- !sql_variance_samp_BigInt_agg_phase_3 --
0 \N
-7 4.666666666666667
+7 4.666666666666665
5 2.5
-- !sql_variance_samp_BigInt_agg_phase_4 --
@@ -5732,10 +5617,10 @@ true
-- !sql_variance_samp_BigInt_gb_notnull --
4.666666666666667
-2.499999999999999
+2.5000000000000004
-- !sql_variance_samp_BigInt_notnull --
-13.000000000000002
+13.0
-- !sql_variance_samp_BigInt_agg_phase_1_notnull --
1 \N
@@ -5765,10 +5650,10 @@ true
-- !sql_variance_samp_Float_gb --
\N
0.04666666631897303
-0.02500000596046519
+0.025000005960465192
-- !sql_variance_samp_Float --
-0.130000004212965
+0.13000000421296504
-- !sql_variance_samp_Float_agg_phase_1 --
0 \N
@@ -5790,15 +5675,15 @@ true
-- !sql_variance_samp_Float_agg_phase_3 --
0 \N
-7 0.04666666631897303
+7 0.04666666631897302
5 0.02500000596046519
-- !sql_variance_samp_Float_agg_phase_4 --
12 0.130000004212965
-- !sql_variance_samp_Float_gb_notnull --
-0.04666666631897303
-0.025000005960465182
+0.04666666631897302
+0.02500000596046519
-- !sql_variance_samp_Float_notnull --
0.130000004212965
@@ -5818,7 +5703,7 @@ true
1 \N
-- !sql_variance_samp_Float_agg_phase_2_notnull --
-12 0.13000000421296498
+12 0.130000004212965
-- !sql_variance_samp_Float_agg_phase_3_notnull --
0 \N
@@ -5831,7 +5716,7 @@ true
-- !sql_variance_samp_Double_gb --
\N
0.04666666666666666
-0.024999999999999994
+0.02499999999999999
-- !sql_variance_samp_Double --
0.13
@@ -5856,15 +5741,15 @@ true
-- !sql_variance_samp_Double_agg_phase_3 --
0 \N
-7 0.04666666666666666
+7 0.046666666666666655
5 0.025
-- !sql_variance_samp_Double_agg_phase_4 --
12 0.13
-- !sql_variance_samp_Double_gb_notnull --
-0.046666666666666655
-0.025
+0.04666666666666666
+0.024999999999999994
-- !sql_variance_samp_Double_notnull --
0.13
@@ -5889,7 +5774,7 @@ true
-- !sql_variance_samp_Double_agg_phase_3_notnull --
0 \N
7 0.04666666666666666
-5 0.024999999999999994
+5 0.025
-- !sql_variance_samp_Double_agg_phase_4_notnull --
12 0.13
@@ -5910,15 +5795,15 @@ true
1 \N
-- !sql_variance_samp_DecimalV2_agg_phase_2 --
-12 0.130000000
+12 0.13
-- !sql_variance_samp_DecimalV2_agg_phase_3 --
0 \N
-7 0.046666667
-5 0.025000000
+7 0.04666666666666666
+5 0.025
-- !sql_variance_samp_DecimalV2_agg_phase_4 --
-12 0.130000000
+12 0.13
-- !sql_variance_samp_DecimalV2_agg_phase_1_notnull --
1 \N
@@ -5935,15 +5820,15 @@ true
1 \N
-- !sql_variance_samp_DecimalV2_agg_phase_2_notnull --
-12 0.130000000
+12 0.13
-- !sql_variance_samp_DecimalV2_agg_phase_3_notnull --
0 \N
-7 0.046666667
-5 0.025000000
+7 0.04666666666666666
+5 0.024999999999999988
-- !sql_variance_samp_DecimalV2_agg_phase_4_notnull --
-12 0.130000000
+12 0.13
-- !sql_window_funnel_BigInt_String_DateTime_Boolean_gb --
0
@@ -6079,3 +5964,4 @@ true
-- !max_null --
\N
+
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 cac0148fca..1eecbf0030 100644
--- a/regression-test/suites/nereids_function_p0/agg_function/agg.groovy
+++ b/regression-test/suites/nereids_function_p0/agg_function/agg.groovy
@@ -2060,6 +2060,10 @@ suite("nereids_agg_fn") {
qt_sql_stddev_samp_DecimalV2_agg_phase_4_notnull '''
select
/*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_DISTINCT,
TWO_PHASE_AGGREGATE_WITH_DISTINCT')*/ count(distinct id), stddev_samp(kdcmls1)
from fn_test'''
+ qt_sql_sum_Boolean '''
+ select sum(kbool) from fn_test'''
+ qt_sql_sum_Boolean_gb '''
+ select sum(kbool) from fn_test group by id order by id'''
qt_sql_sum_TinyInt_gb '''
select sum(ktint) from fn_test group by kbool order by kbool'''
qt_sql_sum_TinyInt '''
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]