[improvement](agg-function) Increase the limit maximum number of agg function parameters (#15924)

This commit is contained in:
abmdocrt
2023-01-31 21:03:50 +08:00
committed by GitHub
parent f798f60afd
commit ca7eb94f23
3 changed files with 70 additions and 2 deletions

View File

@ -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.

View File

@ -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]

View File

@ -85,4 +85,44 @@ SELECT
AS r
FROM retention_test
GROUP BY uid
) a;
) 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;