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

yiguolei 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 00896d8954e [fix](agg) fix coredump of multi distinct of decimal128I 
(#27014)
00896d8954e is described below

commit 00896d8954e30c58ed88a4bb342bd789b0269f26
Author: TengJianPing <[email protected]>
AuthorDate: Wed Nov 15 17:37:20 2023 +0800

    [fix](agg) fix coredump of multi distinct of decimal128I (#27014)
    
    * [fix](agg) fix coredump of multi distinct of decimal128
    
    * fix
---
 .../aggregate_function_uniq.cpp                    |  3 ++
 .../data/correctness_p0/test_distinct_agg.out      | 11 ++++++
 .../suites/correctness_p0/test_distinct_agg.groovy | 44 +++++++++++++++++++++-
 3 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp
index a528162b287..97b0fba623c 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp
@@ -48,6 +48,9 @@ AggregateFunctionPtr create_aggregate_function_uniq(const 
std::string& name,
         } else if (which.is_decimal64()) {
             return 
creator_without_type::create<AggregateFunctionUniq<Decimal64, Data<Int64>>>(
                     argument_types, result_is_nullable);
+        } else if (which.is_decimal128i()) {
+            return 
creator_without_type::create<AggregateFunctionUniq<Decimal128I, Data<Int128>>>(
+                    argument_types, result_is_nullable);
         } else if (which.is_decimal128() || which.is_decimal128i()) {
             return 
creator_without_type::create<AggregateFunctionUniq<Decimal128, Data<Int128>>>(
                     argument_types, result_is_nullable);
diff --git a/regression-test/data/correctness_p0/test_distinct_agg.out 
b/regression-test/data/correctness_p0/test_distinct_agg.out
index b70da182eef..d75f85b923c 100644
--- a/regression-test/data/correctness_p0/test_distinct_agg.out
+++ b/regression-test/data/correctness_p0/test_distinct_agg.out
@@ -1,4 +1,15 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !distinct_1 --
+
 -- !select1 --
 本日
 
+-- !multi_distinct_1 --
+2      2
+
+-- !multi_distinct_2 --
+369    1145
+
+-- !multi_distinct_3 --
+184.5  572.5
+
diff --git a/regression-test/suites/correctness_p0/test_distinct_agg.groovy 
b/regression-test/suites/correctness_p0/test_distinct_agg.groovy
index 788f5271a6c..d69842a5fe6 100644
--- a/regression-test/suites/correctness_p0/test_distinct_agg.groovy
+++ b/regression-test/suites/correctness_p0/test_distinct_agg.groovy
@@ -56,7 +56,7 @@ suite("test_distinct_agg") {
         result([['1', '2023-01-10', 1L]])
     }
 
-    sql '''SELECT `b`.`dt` AS `dt`
+    qt_distinct_1 '''SELECT `b`.`dt` AS `dt`
             FROM 
                 (SELECT `dt`AS `dt`,
                     count(DISTINCT `role_id`) AS `pay_role`,
@@ -117,4 +117,46 @@ suite("test_distinct_agg") {
     sql 'drop view if exists dim_v2'
     sql 'drop view if exists dim_v3'
     sql 'drop table if exists test_distinct_agg_t'
+
+    sql "drop table if exists multi_distinct_agg_tab;"
+
+    sql """
+    CREATE TABLE `multi_distinct_agg_tab` (
+        `k1` bigint(20) NULL,
+        `k2` varchar(20) NULL,
+        `d1` DECIMAL(18, 0) NULL,
+        `d2` DECIMAL(38, 0) NULL
+    ) ENGINE = OLAP DUPLICATE KEY(`k1`) DISTRIBUTED BY HASH(`k1`) BUCKETS 2 
PROPERTIES (
+    "replication_allocation" = "tag.location.default: 1"
+    );
+    """
+
+    sql """
+    INSERT INTO
+        `multi_distinct_agg_tab` (`k1`, `k2`, `d1`, `d2`)
+    VALUES (1, 'aaa', 123, 356),(2, 'bbb', 123, 789), (3, 'ccc', 246, 789);
+    """
+    sql "sync"
+
+    qt_multi_distinct_1 """
+        select
+            count(distinct d1),
+            count(distinct d2)
+        from
+            multi_distinct_agg_tab;
+    """
+    qt_multi_distinct_2 """
+        select
+            sum(distinct d1),
+            sum(distinct d2)
+        from
+            multi_distinct_agg_tab;
+    """
+    qt_multi_distinct_3 """
+        select
+            avg(distinct d1),
+            avg(distinct d2)
+        from
+            multi_distinct_agg_tab;
+    """
 }
\ No newline at end of file


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

Reply via email to