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

dataroaring 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 ca7eb94f23 [improvement](agg-function) Increase the limit maximum 
number of agg function parameters (#15924)
ca7eb94f23 is described below

commit ca7eb94f23f85b3afa1b2f82cf4f64715b283ab5
Author: abmdocrt <yukang.lian2...@gmail.com>
AuthorDate: Tue Jan 31 21:03:50 2023 +0800

    [improvement](agg-function) Increase the limit maximum number of agg 
function parameters (#15924)
---
 .../aggregate_functions/aggregate_function_null.h  |  4 ++-
 .../test_aggregate_retention.out                   | 26 ++++++++++++++
 .../test_aggregate_retention.sql                   | 42 +++++++++++++++++++++-
 3 files changed, 70 insertions(+), 2 deletions(-)

diff --git a/be/src/vec/aggregate_functions/aggregate_function_null.h 
b/be/src/vec/aggregate_functions/aggregate_function_null.h
index 7fade87c6f..86fe7734e1 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_null.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_null.h
@@ -401,7 +401,9 @@ public:
     }
 
 private:
-    enum { MAX_ARGS = 8 };
+    // The array length is fixed in the implementation of some aggregate 
functions.
+    // Therefore we choose 256 as the appropriate maximum length limit.
+    static const size_t MAX_ARGS = 256;
     size_t number_of_arguments = 0;
     std::array<char, MAX_ARGS>
             is_nullable; /// Plain array is better than std::vector due to one 
indirection less.
diff --git 
a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_retention.out
 
b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_retention.out
index d5d1ef2bc5..a85e7c5e37 100644
--- 
a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_retention.out
+++ 
b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_retention.out
@@ -60,3 +60,29 @@
 -- !test_aggregate_retention_13 --
 3      2       1
 
+-- !test_aggregate_retention_14 --
+0
+
+-- !test_aggregate_retention_15 --
+0
+
+-- !test_aggregate_retention_16 --
+12
+
+-- !test_aggregate_retention_17 --
+0      2022-10-12T00:00
+0      2022-10-13T00:00
+0      2022-10-14T00:00
+0      2022-10-15T00:00
+0      2022-10-16T00:00
+0      2022-10-17T00:00
+0      2022-10-18T00:00
+0      2022-10-19T00:00
+0      2022-10-20T00:00
+0      2022-10-21T00:00
+0      2022-10-22T00:00
+0      2022-10-23T00:00
+
+-- !test_aggregate_retention_18 --
+0      [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
+
diff --git 
a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_retention.sql
 
b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_retention.sql
index bdcfec400b..51fa7c677f 100644
--- 
a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_retention.sql
+++ 
b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_retention.sql
@@ -85,4 +85,44 @@ SELECT
                         AS r 
                             FROM retention_test
                             GROUP BY uid 
-                ) a;
\ No newline at end of file
+                ) a;
+
+
+DROP TABLE IF EXISTS retention_test_many_params;
+
+CREATE TABLE IF NOT EXISTS retention_test_many_params(
+                `uid` int COMMENT 'user id', 
+                `date` datetime COMMENT 'date time' 
+                )
+DUPLICATE KEY(uid) 
+DISTRIBUTED BY HASH(uid) BUCKETS 1 
+PROPERTIES ( 
+    "replication_num" = "1"
+); 
+
+INSERT into retention_test_many_params (uid, date) values (0, '2022-10-12'),
+                                        (0, '2022-10-13'),
+                                        (0, '2022-10-14'),
+                                        (0, '2022-10-15'),
+                                        (0, '2022-10-16'),
+                                        (0, '2022-10-17'),
+                                        (0, '2022-10-18'),
+                                        (0, '2022-10-19'),
+                                        (0, '2022-10-20'),
+                                        (0, '2022-10-21'),
+                                        (0, '2022-10-22'),
+                                        (0, '2022-10-23');
+
+SELECT * from retention_test_many_params ORDER BY date;
+
+SELECT 
+    uid,     
+    retention(date = '2022-10-12', date = '2022-10-13', date = '2022-10-14', 
+            date = '2022-10-15', date = '2022-10-16', date = '2022-10-17',
+            date = '2022-10-18', date = '2022-10-19', date = '2022-10-20',
+            date = '2022-10-21', date = '2022-10-22', date = '2022-10-23'
+            )
+        AS r 
+            FROM retention_test_many_params 
+            GROUP BY uid 
+            ORDER BY uid ASC;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to