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

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 433fe653e8b branch-4.0: [Bug](function) add ndv decimalv2 support 
#61546 (#61577)
433fe653e8b is described below

commit 433fe653e8b8ce4eb1e4dad175d8199901a21373
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Mar 21 20:27:36 2026 +0800

    branch-4.0: [Bug](function) add ndv decimalv2 support #61546 (#61577)
    
    Cherry-picked from #61546
    
    Co-authored-by: Pxl <[email protected]>
---
 .../aggregate_function_approx_count_distinct.cpp   |  5 +-
 .../data/nereids_p0/datatype/test_decimalv2.out    | 59 ++++++++++++----------
 .../nereids_p0/datatype/test_decimalv2.groovy      |  2 +
 3 files changed, 36 insertions(+), 30 deletions(-)

diff --git 
a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp
index b3d46a89152..81fb8462db1 100644
--- 
a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp
+++ 
b/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp
@@ -29,8 +29,9 @@ AggregateFunctionPtr 
create_aggregate_function_approx_count_distinct(
         const bool result_is_nullable, const AggregateFunctionAttr& attr) {
     return creator_with_type_list<
             TYPE_BOOLEAN, TYPE_TINYINT, TYPE_SMALLINT, TYPE_INT, TYPE_BIGINT, 
TYPE_LARGEINT,
-            TYPE_FLOAT, TYPE_DOUBLE, TYPE_DECIMAL32, TYPE_DECIMAL64, 
TYPE_DECIMAL128I,
-            TYPE_DECIMAL256, TYPE_VARCHAR, TYPE_DATEV2, TYPE_DATETIMEV2, 
TYPE_IPV4, TYPE_IPV6,
+            TYPE_FLOAT, TYPE_DOUBLE, TYPE_DECIMALV2, TYPE_DECIMAL32, 
TYPE_DECIMAL64,
+            TYPE_DECIMAL128I, TYPE_DECIMAL256, TYPE_VARCHAR, TYPE_DATEV2, 
TYPE_DATETIMEV2,
+            TYPE_IPV4, TYPE_IPV6,
             
TYPE_TIMESTAMPTZ>::create<AggregateFunctionApproxCountDistinct>(argument_types,
                                                                             
result_is_nullable,
                                                                             
attr);
diff --git a/regression-test/data/nereids_p0/datatype/test_decimalv2.out 
b/regression-test/data/nereids_p0/datatype/test_decimalv2.out
index 70c7ed37cbb..7df088d5649 100644
--- a/regression-test/data/nereids_p0/datatype/test_decimalv2.out
+++ b/regression-test/data/nereids_p0/datatype/test_decimalv2.out
@@ -1,52 +1,55 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !sql1 --
-1.230
+1.230000000
 
 -- !sql2 --
 1.230
 
 -- !sql1 --
-1      1.230
-2      2.340
-3      3.450
+1      1.230000000
+2      2.340000000
+3      3.450000000
 
 -- !sql2 --
-1      1.230   1       1.230
-2      2.340   2       2.340
-3      3.450   3       3.450
+1      1.230000000     1       1.230000000
+2      2.340000000     2       2.340000000
+3      3.450000000     3       3.450000000
 
 -- !sql2 --
-1      1.230   1       1.230
-2      2.340   2       2.340
-3      3.450   3       3.450
+1      1.230000000     1       1.230000000
+2      2.340000000     2       2.340000000
+3      3.450000000     3       3.450000000
 
 -- !sql2 --
-1      1.230   1       1.230
-2      2.340   2       2.340
-3      3.450   3       3.450
+1      1.230000000     1       1.230000000
+2      2.340000000     2       2.340000000
+3      3.450000000     3       3.450000000
 
 -- !sql2 --
-1      1.230   1       1.230
-2      2.340   2       2.340
-3      3.450   3       3.450
+1      1.230000000     1       1.230000000
+2      2.340000000     2       2.340000000
+3      3.450000000     3       3.450000000
 
 -- !sql2 --
-1      1.230   1       1.230
-2      2.340   2       2.340
-3      3.450   3       3.450
+1      1.230000000     1       1.230000000
+2      2.340000000     2       2.340000000
+3      3.450000000     3       3.450000000
 
 -- !sql2 --
-1      1.230   1       1.230
-2      2.340   2       2.340
-3      3.450   3       3.450
+1      1.230000000     1       1.230000000
+2      2.340000000     2       2.340000000
+3      3.450000000     3       3.450000000
 
 -- !sql2 --
-1      1.230   1       1.230
-2      2.340   2       2.340
-3      3.450   3       3.450
+1      1.230000000     1       1.230000000
+2      2.340000000     2       2.340000000
+3      3.450000000     3       3.450000000
 
 -- !sql2 --
-1      1.230   1       1.230
-2      2.340   2       2.340
-3      3.450   3       3.450
+1      1.230000000     1       1.230000000
+2      2.340000000     2       2.340000000
+3      3.450000000     3       3.450000000
+
+-- !test --
+3
 
diff --git a/regression-test/suites/nereids_p0/datatype/test_decimalv2.groovy 
b/regression-test/suites/nereids_p0/datatype/test_decimalv2.groovy
index 3bdab1ccd51..6b689d7f152 100644
--- a/regression-test/suites/nereids_p0/datatype/test_decimalv2.groovy
+++ b/regression-test/suites/nereids_p0/datatype/test_decimalv2.groovy
@@ -84,5 +84,7 @@ suite("test_decimalv2") {
     sql " set runtime_filter_type = 8; "
     qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c2 = b.c2 ORDER BY 
a.c0"
 
+    qt_test "select ndv(c2) from ${tbName}; "
+
     sql "DROP TABLE ${tbName}"
 }


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

Reply via email to