This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit d9666a694bea53c0dea1c2145fd08f9c0ed59799 Author: abmdocrt <[email protected]> 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 ++- be/test/vec/exprs/vexpr_test.cpp | 15 +++----- .../test_aggregate_retention.out | 26 ++++++++++++++ .../test_aggregate_retention.sql | 42 +++++++++++++++++++++- 4 files changed, 75 insertions(+), 12 deletions(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_null.h b/be/src/vec/aggregate_functions/aggregate_function_null.h index 7b8489c095..fea150348f 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_null.h +++ b/be/src/vec/aggregate_functions/aggregate_function_null.h @@ -315,7 +315,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/be/test/vec/exprs/vexpr_test.cpp b/be/test/vec/exprs/vexpr_test.cpp index ca8f8938a8..9ebf5612a8 100644 --- a/be/test/vec/exprs/vexpr_test.cpp +++ b/be/test/vec/exprs/vexpr_test.cpp @@ -79,7 +79,7 @@ TEST(TEST_VEXPR, ABSTEST) { auto block = row_batch.convert_to_vec_block(); int ts = -1; - context->execute(&block, &ts); + state = context->execute(&block, &ts); context->close(&runtime_stat); } @@ -119,20 +119,15 @@ TEST(TEST_VEXPR, ABSTEST2) { DescriptorTbl desc_tbl; desc_tbl._slot_desc_map[0] = tuple_desc->slots()[0]; runtime_stat.set_desc_tbl(&desc_tbl); -<<<<<<< HEAD - context->prepare(&runtime_stat, row_desc); - context->open(&runtime_stat); - - auto block = row_batch.convert_to_vec_block(); - int ts = -1; - context->execute(&block, &ts); -======= auto state = Status::OK(); state = context->prepare(&runtime_stat, row_desc); ASSERT_TRUE(state.ok()); state = context->open(&runtime_stat); ASSERT_TRUE(state.ok()); ->>>>>>> 46347a51d2... [Bug](exec) enable warning on ignoring function return value for vctx (#16157) + + auto block = row_batch.convert_to_vec_block(); + int ts = -1; + state = context->execute(&block, &ts); context->close(&runtime_stat); } 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: [email protected] For additional commands, e-mail: [email protected]
