This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch dev-1.0.0 in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
commit 9196fbee6a7ed791215e90149c011c70f9e913b6 Author: Pxl <952130...@qq.com> AuthorDate: Fri Feb 25 11:03:23 2022 +0800 [Bug] group_concat(value,null) not return null --- be/src/exprs/aggregate_functions.cpp | 4 ++-- .../sql-functions/aggregate-functions/group_concat.md | 7 +++++++ .../sql-functions/aggregate-functions/group_concat.md | 7 +++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/be/src/exprs/aggregate_functions.cpp b/be/src/exprs/aggregate_functions.cpp index f8efe67..9f059b7 100644 --- a/be/src/exprs/aggregate_functions.cpp +++ b/be/src/exprs/aggregate_functions.cpp @@ -784,7 +784,7 @@ void AggregateFunctions::max(FunctionContext*, const DateTimeVal& src, DateTimeV void AggregateFunctions::string_concat(FunctionContext* ctx, const StringVal& src, const StringVal& separator, StringVal* result) { - if (src.is_null) { + if (src.is_null || separator.is_null) { return; } @@ -819,7 +819,7 @@ void AggregateFunctions::string_concat_update(FunctionContext* ctx, const String void AggregateFunctions::string_concat_update(FunctionContext* ctx, const StringVal& src, const StringVal& separator, StringVal* result) { - if (src.is_null) { + if (src.is_null || separator.is_null) { return; } const StringVal* sep = separator.is_null ? &DEFAULT_STRING_CONCAT_DELIM : &separator; diff --git a/docs/en/sql-reference/sql-functions/aggregate-functions/group_concat.md b/docs/en/sql-reference/sql-functions/aggregate-functions/group_concat.md index bdff733..b9273a9 100644 --- a/docs/en/sql-reference/sql-functions/aggregate-functions/group_concat.md +++ b/docs/en/sql-reference/sql-functions/aggregate-functions/group_concat.md @@ -58,6 +58,13 @@ mysql> select GROUP_CONCAT(value, " ") from test; +----------------------------+ | a b c | +----------------------------+ + +mysql> select GROUP_CONCAT(value, NULL) from test; ++----------------------------+ +| GROUP_CONCAT(`value`, NULL)| ++----------------------------+ +| NULL | ++----------------------------+ ``` ## keyword GROUP_CONCAT,GROUP,CONCAT diff --git a/docs/zh-CN/sql-reference/sql-functions/aggregate-functions/group_concat.md b/docs/zh-CN/sql-reference/sql-functions/aggregate-functions/group_concat.md index bc43575..8e2a3f4 100644 --- a/docs/zh-CN/sql-reference/sql-functions/aggregate-functions/group_concat.md +++ b/docs/zh-CN/sql-reference/sql-functions/aggregate-functions/group_concat.md @@ -58,6 +58,13 @@ mysql> select GROUP_CONCAT(value, " ") from test; +----------------------------+ | a b c | +----------------------------+ + +mysql> select GROUP_CONCAT(value, NULL) from test; ++----------------------------+ +| GROUP_CONCAT(`value`, NULL)| ++----------------------------+ +| NULL | ++----------------------------+ ``` ## keyword GROUP_CONCAT,GROUP,CONCAT --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org