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

lihaopeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 4c5d7c2  [Bug] group_concat(value,null) not return null
4c5d7c2 is described below

commit 4c5d7c27dfa97cd945c904786acb63e35dc3b1d0
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

Reply via email to