You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/11 03:02:47 UTC

[GitHub] [doris] zxealous opened a new pull request, #10749: [feature-wip] (array-type) function concat_ws support array

zxealous opened a new pull request, #10749:
URL: https://github.com/apache/doris/pull/10749

   # Proposed changes
   
   function concat_ws support array
   
   ## Problem Summary:
   
   Describe the overview of changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (No)
   2. Has unit tests been added: (Yes)
   3. Has document been added or modified: (Yes)
   4. Does it need to update dependencies: (No)
   5. Are there any changes that cannot be rolled back: (No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] github-actions[bot] commented on pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10749:
URL: https://github.com/apache/doris/pull/10749#issuecomment-1185136655

   PR approved by at least one committer and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r918466163


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,20 +563,123 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        if (check_column<ColumnArray>(argument_columns[1].get())) {
+            // Determine if the nested type of the array is String
+            const ColumnArray& array_column =
+                    reinterpret_cast<const ColumnArray&>(*argument_columns[1]);
+            if (!array_column.get_data().is_column_string()) {
+                return Status::NotSupported(
+                        fmt::format("unsupported nested array of type {} for function {}",
+                                    array_column.get_data().get_family_name(), get_name()));
+            }
+            // Concat string in array
+            _execute_array(input_rows_count, array_column, buffer, views, offsets_list, chars_list,
+                           null_list, res_data, res_offset);
+
+        } else {
+            // Concat string
+            _execute_string(input_rows_count, argument_size, buffer, views, offsets_list,
+                            chars_list, null_list, res_data, res_offset);
+        }
+        if (is_null_type) {
+            block.get_by_position(result).column =
+                    ColumnNullable::create(std::move(res), std::move(null_map));
+        } else {
+            block.get_by_position(result).column = std::move(res);
+        }
+        return Status::OK();
+    }
+
+private:
+    void _execute_array(const size_t& input_rows_count, const ColumnArray& array_column,
+                        fmt::memory_buffer& buffer, std::vector<std::string_view>& views,
+                        const std::vector<const ColumnString::Offsets*>& offsets_list,
+                        const std::vector<const ColumnString::Chars*>& chars_list,
+                        const std::vector<const ColumnUInt8::Container*>& null_list,
+                        Chars& res_data, Offsets& res_offset) {
+        // Get array nested column
+        const UInt8* array_nested_null_map = nullptr;
+        ColumnPtr array_nested_column = nullptr;
+
+        if (is_column_nullable(array_column.get_data())) {
+            const auto& array_nested_null_column =
+                    reinterpret_cast<const ColumnNullable&>(array_column.get_data());
+            // String's null map in array
+            array_nested_null_map =
+                    array_nested_null_column.get_null_map_column().get_data().data();
+            array_nested_column = array_nested_null_column.get_nested_column_ptr();
+        } else {
+            array_nested_column = array_column.get_data_ptr();
+        }
+
+        const auto& string_column = reinterpret_cast<const ColumnString&>(*array_nested_column);
+        const ColumnString::Chars& string_src_chars = string_column.get_chars();

Review Comment:
   ```suggestion
           const Chars& src_string_chars = string_column.get_chars();
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] carlvinhust2012 commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
carlvinhust2012 commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917518635


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,36 +560,125 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
-        for (size_t i = 0; i < input_rows_count; ++i) {
-            auto& seq_offsets = *offsets_list[0];
-            auto& seq_chars = *chars_list[0];
-            auto& seq_nullmap = *null_list[0];
-            if (seq_nullmap[i]) {
-                res_data.push_back('\0');
-                res_offset[i] = res_data.size();
-                continue;
+        DataTypePtr array_column_type =
+                is_array(remove_nullable(block.get_by_position(arguments[1]).type))
+                        ? remove_nullable(block.get_by_position(arguments[1]).type)
+                        : nullptr;
+        if (array_column_type) {

Review Comment:
   since this 'execute_impl' function is too long, it is recommended to split sub-functions.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] zxealous commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
zxealous commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r918913889


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,20 +563,126 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        if (check_column<ColumnArray>(argument_columns[1].get())) {
+            // Determine if the nested type of the array is String
+            const ColumnArray& array_column =
+                    reinterpret_cast<const ColumnArray&>(*argument_columns[1]);
+            if (!array_column.get_data().is_column_string()) {
+                return Status::NotSupported(
+                        fmt::format("unsupported nested array of type {} for function {}",
+                                    is_column_nullable(array_column.get_data())
+                                            ? array_column.get_data().get_name()
+                                            : array_column.get_data().get_family_name(),

Review Comment:
   now, after modification, it can return the correct information
   ```
   mysql> select *, concat_ws(str, c_array) from int_test;
   ERROR 1105 (HY000): errCode = 2, detailMessage = unsupported nested array of type Nullable(Int32) for function concat_ws
   ```



##########
be/src/vec/functions/function_string.h:
##########
@@ -553,20 +563,126 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        if (check_column<ColumnArray>(argument_columns[1].get())) {
+            // Determine if the nested type of the array is String
+            const ColumnArray& array_column =
+                    reinterpret_cast<const ColumnArray&>(*argument_columns[1]);
+            if (!array_column.get_data().is_column_string()) {
+                return Status::NotSupported(
+                        fmt::format("unsupported nested array of type {} for function {}",
+                                    is_column_nullable(array_column.get_data())
+                                            ? array_column.get_data().get_name()
+                                            : array_column.get_data().get_family_name(),

Review Comment:
   if we dont consider nullable, and array's nested type is nullable, here will return like this:
   ```
   mysql> select * from int_test;
   +------+------+-----------+
   | id   | str  | c_array   |
   +------+------+-----------+
   |    1 | -    | [1, 2, 3] |
   |    1 | -    | [1, 2, 3] |
   +------+------+-----------+
   2 rows in set (0.02 sec)
   
   mysql> select *, concat_ws(str, c_array) from int_test;
   ERROR 1105 (HY000): errCode = 2, detailMessage = unsupported nested array of type Nullable for function concat_ws
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917514217


##########
docs/en/docs/sql-manual/sql-functions/string-functions/concat_ws.md:
##########
@@ -28,10 +28,10 @@ under the License.
 ### Description
 #### Syntax
 
-`VARCHAR concat ws (VARCHAR sep, VARCHAR str,...)`
+`VARCHAR concat ws (VARCHAR sep, VARCHAR str,...) or VARCHAR concat_ws(VARCHAR sep, ARRAY array)`

Review Comment:
   1. concat ws ===> concat_ws;
   2. can split into two lines;



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] zxealous commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
zxealous commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917690603


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,6 +563,122 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        DataTypePtr array_column_type =
+                check_column<ColumnArray>(*argument_columns[1].get())
+                        ? remove_nullable(block.get_by_position(arguments[1]).type)
+                        : nullptr;
+        if (array_column_type) {
+            // Determine if the nested type of the array is String
+            auto array_nested_type = remove_nullable(
+                    assert_cast<const DataTypeArray&>(*array_column_type).get_nested_type());
+            if (!is_string(array_nested_type)) {
+                return Status::NotSupported(
+                        fmt::format("unsupported nested array of type {} for function {}",
+                                    array_nested_type->get_name(), get_name()));
+            }
+            // Concat string in array
+            _execute_array(input_rows_count, argument_columns, buffer, views, offsets_list,
+                           chars_list, null_list, res_data, res_offset);
+
+        } else {
+            // Concat string
+            _execute_string(input_rows_count, argument_size, buffer, views, offsets_list,
+                            chars_list, null_list, res_data, res_offset);
+        }
+        if (is_null_type) {
+            block.get_by_position(result).column =
+                    ColumnNullable::create(std::move(res), std::move(null_map));
+        } else {
+            block.get_by_position(result).column = std::move(res);
+        }
+        return Status::OK();
+    }
+
+private:
+    void _execute_array(const size_t& input_rows_count, const ColumnPtr* argument_columns,
+                        fmt::memory_buffer& buffer, std::vector<std::string_view>& views,
+                        const std::vector<const ColumnString::Offsets*>& offsets_list,
+                        const std::vector<const ColumnString::Chars*>& chars_list,
+                        const std::vector<const ColumnUInt8::Container*>& null_list,
+                        Chars& res_data, Offsets& res_offset) {
+        // Get array nested column
+        bool array_nested_type_is_nullable = false;
+        const UInt8* array_nested_null_map = nullptr;
+        ColumnPtr array_nested_column = nullptr;
+        const auto& array_column = reinterpret_cast<const ColumnArray&>(*argument_columns[1]);
+
+        if (is_column_nullable(array_column.get_data())) {
+            const auto& array_nested_null_column =
+                    reinterpret_cast<const ColumnNullable&>(array_column.get_data());
+            // String's null map in array
+            array_nested_null_map =
+                    array_nested_null_column.get_null_map_column().get_data().data();
+            array_nested_column = array_nested_null_column.get_nested_column_ptr();
+        } else {
+            array_nested_type_is_nullable = true;
+            array_nested_column = array_column.get_data_ptr();
+        }
+
+        auto const_array_nested_null_map = ColumnUInt8::create(array_nested_column->size(), 0);
+        if (array_nested_type_is_nullable) {
+            array_nested_null_map = const_array_nested_null_map->get_data().data();
+        }
+
+        const auto& string_column = reinterpret_cast<const ColumnString&>(*array_nested_column);
+        const ColumnString::Chars& string_src_chars = string_column.get_chars();
+        const ColumnString::Offsets& src_string_offsets = string_column.get_offsets();
+        const ColumnArray::Offsets& src_array_offsets = array_column.get_offsets();
+        ColumnArray::Offset current_src_array_offset = 0;
+
+        // Concat string in array
+        for (size_t i = 0; i < input_rows_count; ++i) {
+            auto& seq_offsets = *offsets_list[0];
+            auto& seq_chars = *chars_list[0];
+            auto& seq_nullmap = *null_list[0];
+
+            if (seq_nullmap[i]) {
+                res_data.push_back('\0');

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r918470367


##########
regression-test/suites/query/sql_functions/string_functions/test_string_function.groovy:
##########
@@ -38,6 +38,9 @@ suite("test_string_function", "query") {
     qt_sql "select concat_ws(\"or\", \"d\", \"is\");"
     qt_sql "select concat_ws(NULL, \"d\", \"is\");"
     qt_sql "select concat_ws(\"or\", \"d\", NULL,\"is\");"
+    qt_sql "select concat_ws(\"or\", [\"d\", \"is\"]);"
+    qt_sql "select concat_ws(NULL, [\"d\", \"is\"]);"
+    qt_sql "select concat_ws(\"or\", [\"d\", NULL,\"is\"]);"

Review Comment:
   add case with empty string inside array.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] zxealous commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
zxealous commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r918507313


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,20 +563,123 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        if (check_column<ColumnArray>(argument_columns[1].get())) {
+            // Determine if the nested type of the array is String
+            const ColumnArray& array_column =
+                    reinterpret_cast<const ColumnArray&>(*argument_columns[1]);
+            if (!array_column.get_data().is_column_string()) {
+                return Status::NotSupported(
+                        fmt::format("unsupported nested array of type {} for function {}",
+                                    array_column.get_data().get_family_name(), get_name()));
+            }
+            // Concat string in array
+            _execute_array(input_rows_count, array_column, buffer, views, offsets_list, chars_list,
+                           null_list, res_data, res_offset);
+
+        } else {
+            // Concat string
+            _execute_string(input_rows_count, argument_size, buffer, views, offsets_list,
+                            chars_list, null_list, res_data, res_offset);
+        }
+        if (is_null_type) {
+            block.get_by_position(result).column =
+                    ColumnNullable::create(std::move(res), std::move(null_map));
+        } else {
+            block.get_by_position(result).column = std::move(res);
+        }
+        return Status::OK();
+    }
+
+private:
+    void _execute_array(const size_t& input_rows_count, const ColumnArray& array_column,
+                        fmt::memory_buffer& buffer, std::vector<std::string_view>& views,
+                        const std::vector<const ColumnString::Offsets*>& offsets_list,

Review Comment:
   done



##########
be/src/vec/functions/function_string.h:
##########
@@ -553,20 +563,123 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        if (check_column<ColumnArray>(argument_columns[1].get())) {
+            // Determine if the nested type of the array is String
+            const ColumnArray& array_column =
+                    reinterpret_cast<const ColumnArray&>(*argument_columns[1]);
+            if (!array_column.get_data().is_column_string()) {
+                return Status::NotSupported(
+                        fmt::format("unsupported nested array of type {} for function {}",
+                                    array_column.get_data().get_family_name(), get_name()));
+            }
+            // Concat string in array
+            _execute_array(input_rows_count, array_column, buffer, views, offsets_list, chars_list,
+                           null_list, res_data, res_offset);
+
+        } else {
+            // Concat string
+            _execute_string(input_rows_count, argument_size, buffer, views, offsets_list,
+                            chars_list, null_list, res_data, res_offset);
+        }
+        if (is_null_type) {
+            block.get_by_position(result).column =
+                    ColumnNullable::create(std::move(res), std::move(null_map));
+        } else {
+            block.get_by_position(result).column = std::move(res);
+        }
+        return Status::OK();
+    }
+
+private:
+    void _execute_array(const size_t& input_rows_count, const ColumnArray& array_column,
+                        fmt::memory_buffer& buffer, std::vector<std::string_view>& views,
+                        const std::vector<const ColumnString::Offsets*>& offsets_list,
+                        const std::vector<const ColumnString::Chars*>& chars_list,

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917512744


##########
be/src/vec/functions/function_string.h:
##########
@@ -540,6 +542,11 @@ class FunctionStringConcatWs : public IFunction {
             } else {
                 null_list[i] = &const_null_map->get_data();
             }
+
+            if (is_array(remove_nullable(block.get_by_position(arguments[i]).type))) {

Review Comment:
   also can use `check_column<ColumnArray>`, then we do not need to consider nullable again.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] github-actions[bot] commented on pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10749:
URL: https://github.com/apache/doris/pull/10749#issuecomment-1182928368

   PR approved by anyone and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917582969


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,6 +563,122 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        DataTypePtr array_column_type =
+                check_column<ColumnArray>(*argument_columns[1].get())
+                        ? remove_nullable(block.get_by_position(arguments[1]).type)
+                        : nullptr;
+        if (array_column_type) {

Review Comment:
   use check_column?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917581725


##########
be/src/vec/functions/function_string.h:
##########
@@ -540,6 +545,11 @@ class FunctionStringConcatWs : public IFunction {
             } else {
                 null_list[i] = &const_null_map->get_data();
             }
+
+            if (check_column<ColumnArray>(*argument_columns[i].get())) {

Review Comment:
   ```suggestion
               if (check_column<ColumnArray>(argument_columns[i].get())) {
   ```
   
   check_column support `const IColumn* column` as input argument.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r918467991


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,20 +563,123 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        if (check_column<ColumnArray>(argument_columns[1].get())) {
+            // Determine if the nested type of the array is String
+            const ColumnArray& array_column =
+                    reinterpret_cast<const ColumnArray&>(*argument_columns[1]);
+            if (!array_column.get_data().is_column_string()) {
+                return Status::NotSupported(
+                        fmt::format("unsupported nested array of type {} for function {}",
+                                    array_column.get_data().get_family_name(), get_name()));
+            }
+            // Concat string in array
+            _execute_array(input_rows_count, array_column, buffer, views, offsets_list, chars_list,
+                           null_list, res_data, res_offset);
+
+        } else {
+            // Concat string
+            _execute_string(input_rows_count, argument_size, buffer, views, offsets_list,
+                            chars_list, null_list, res_data, res_offset);
+        }
+        if (is_null_type) {
+            block.get_by_position(result).column =
+                    ColumnNullable::create(std::move(res), std::move(null_map));
+        } else {
+            block.get_by_position(result).column = std::move(res);
+        }
+        return Status::OK();
+    }
+
+private:
+    void _execute_array(const size_t& input_rows_count, const ColumnArray& array_column,
+                        fmt::memory_buffer& buffer, std::vector<std::string_view>& views,
+                        const std::vector<const ColumnString::Offsets*>& offsets_list,
+                        const std::vector<const ColumnString::Chars*>& chars_list,
+                        const std::vector<const ColumnUInt8::Container*>& null_list,
+                        Chars& res_data, Offsets& res_offset) {
+        // Get array nested column
+        const UInt8* array_nested_null_map = nullptr;
+        ColumnPtr array_nested_column = nullptr;
+
+        if (is_column_nullable(array_column.get_data())) {
+            const auto& array_nested_null_column =
+                    reinterpret_cast<const ColumnNullable&>(array_column.get_data());
+            // String's null map in array
+            array_nested_null_map =
+                    array_nested_null_column.get_null_map_column().get_data().data();
+            array_nested_column = array_nested_null_column.get_nested_column_ptr();
+        } else {
+            array_nested_column = array_column.get_data_ptr();
+        }
+
+        const auto& string_column = reinterpret_cast<const ColumnString&>(*array_nested_column);
+        const ColumnString::Chars& string_src_chars = string_column.get_chars();
+        const ColumnString::Offsets& src_string_offsets = string_column.get_offsets();
+        const ColumnArray::Offsets& src_array_offsets = array_column.get_offsets();
+        ColumnArray::Offset current_src_array_offset = 0;
+
+        // Concat string in array
         for (size_t i = 0; i < input_rows_count; ++i) {
-            auto& seq_offsets = *offsets_list[0];
-            auto& seq_chars = *chars_list[0];
-            auto& seq_nullmap = *null_list[0];
-            if (seq_nullmap[i]) {
-                res_data.push_back('\0');
+            auto& sep_offsets = *offsets_list[0];
+            auto& sep_chars = *chars_list[0];
+            auto& sep_nullmap = *null_list[0];
+
+            if (sep_nullmap[i]) {
                 res_offset[i] = res_data.size();

Review Comment:
   concat_ws(NULL, [1,2,3]) return NULL?
   
   But the impl here returns an empty string.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] carlvinhust2012 commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
carlvinhust2012 commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917516156


##########
docs/en/docs/sql-manual/sql-functions/string-functions/concat_ws.md:
##########
@@ -28,10 +28,10 @@ under the License.
 ### Description
 #### Syntax
 
-`VARCHAR concat ws (VARCHAR sep, VARCHAR str,...)`
+`VARCHAR concat ws (VARCHAR sep, VARCHAR str,...) or VARCHAR concat_ws(VARCHAR sep, ARRAY array)`
 
 
-Using the first parameter SEP as a connector, the second parameter and all subsequent parameters are spliced into a string.
+Using the first parameter SEP as a connector, the second parameter and all subsequent parameters(or all string in an ARRAY) are spliced into a string.
 If the separator is NULL, return NULL.
 ` The concat_ws` function does not skip empty strings, but NULL values.

Review Comment:
   I think this line change to "The `concat_ws` function does not skip empty strings, it skips NULL values" is more more acurrate.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] zxealous commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
zxealous commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917575244


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,36 +560,125 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
-        for (size_t i = 0; i < input_rows_count; ++i) {
-            auto& seq_offsets = *offsets_list[0];
-            auto& seq_chars = *chars_list[0];
-            auto& seq_nullmap = *null_list[0];
-            if (seq_nullmap[i]) {
-                res_data.push_back('\0');
-                res_offset[i] = res_data.size();
-                continue;
+        DataTypePtr array_column_type =
+                is_array(remove_nullable(block.get_by_position(arguments[1]).type))
+                        ? remove_nullable(block.get_by_position(arguments[1]).type)
+                        : nullptr;
+        if (array_column_type) {

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] xy720 merged pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
xy720 merged PR #10749:
URL: https://github.com/apache/doris/pull/10749


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] zxealous commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
zxealous commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917576053


##########
be/src/vec/functions/function_string.h:
##########
@@ -540,6 +542,11 @@ class FunctionStringConcatWs : public IFunction {
             } else {
                 null_list[i] = &const_null_map->get_data();
             }
+
+            if (is_array(remove_nullable(block.get_by_position(arguments[i]).type))) {

Review Comment:
   done



##########
docs/en/docs/sql-manual/sql-functions/string-functions/concat_ws.md:
##########
@@ -28,10 +28,10 @@ under the License.
 ### Description
 #### Syntax
 
-`VARCHAR concat ws (VARCHAR sep, VARCHAR str,...)`
+`VARCHAR concat ws (VARCHAR sep, VARCHAR str,...) or VARCHAR concat_ws(VARCHAR sep, ARRAY array)`

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r918463119


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,20 +563,123 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        if (check_column<ColumnArray>(argument_columns[1].get())) {
+            // Determine if the nested type of the array is String
+            const ColumnArray& array_column =
+                    reinterpret_cast<const ColumnArray&>(*argument_columns[1]);
+            if (!array_column.get_data().is_column_string()) {
+                return Status::NotSupported(
+                        fmt::format("unsupported nested array of type {} for function {}",
+                                    array_column.get_data().get_family_name(), get_name()));
+            }
+            // Concat string in array
+            _execute_array(input_rows_count, array_column, buffer, views, offsets_list, chars_list,
+                           null_list, res_data, res_offset);
+
+        } else {
+            // Concat string
+            _execute_string(input_rows_count, argument_size, buffer, views, offsets_list,
+                            chars_list, null_list, res_data, res_offset);
+        }
+        if (is_null_type) {
+            block.get_by_position(result).column =
+                    ColumnNullable::create(std::move(res), std::move(null_map));
+        } else {
+            block.get_by_position(result).column = std::move(res);
+        }
+        return Status::OK();
+    }
+
+private:
+    void _execute_array(const size_t& input_rows_count, const ColumnArray& array_column,
+                        fmt::memory_buffer& buffer, std::vector<std::string_view>& views,
+                        const std::vector<const ColumnString::Offsets*>& offsets_list,

Review Comment:
   ```suggestion
                           const std::vector<const Offsets*>& offsets_list,
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917586621


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,6 +563,122 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        DataTypePtr array_column_type =
+                check_column<ColumnArray>(*argument_columns[1].get())
+                        ? remove_nullable(block.get_by_position(arguments[1]).type)
+                        : nullptr;
+        if (array_column_type) {
+            // Determine if the nested type of the array is String
+            auto array_nested_type = remove_nullable(
+                    assert_cast<const DataTypeArray&>(*array_column_type).get_nested_type());
+            if (!is_string(array_nested_type)) {
+                return Status::NotSupported(
+                        fmt::format("unsupported nested array of type {} for function {}",
+                                    array_nested_type->get_name(), get_name()));
+            }
+            // Concat string in array
+            _execute_array(input_rows_count, argument_columns, buffer, views, offsets_list,
+                           chars_list, null_list, res_data, res_offset);
+
+        } else {
+            // Concat string
+            _execute_string(input_rows_count, argument_size, buffer, views, offsets_list,
+                            chars_list, null_list, res_data, res_offset);
+        }
+        if (is_null_type) {
+            block.get_by_position(result).column =
+                    ColumnNullable::create(std::move(res), std::move(null_map));
+        } else {
+            block.get_by_position(result).column = std::move(res);
+        }
+        return Status::OK();
+    }
+
+private:
+    void _execute_array(const size_t& input_rows_count, const ColumnPtr* argument_columns,
+                        fmt::memory_buffer& buffer, std::vector<std::string_view>& views,
+                        const std::vector<const ColumnString::Offsets*>& offsets_list,
+                        const std::vector<const ColumnString::Chars*>& chars_list,
+                        const std::vector<const ColumnUInt8::Container*>& null_list,
+                        Chars& res_data, Offsets& res_offset) {
+        // Get array nested column
+        bool array_nested_type_is_nullable = false;
+        const UInt8* array_nested_null_map = nullptr;
+        ColumnPtr array_nested_column = nullptr;
+        const auto& array_column = reinterpret_cast<const ColumnArray&>(*argument_columns[1]);
+
+        if (is_column_nullable(array_column.get_data())) {
+            const auto& array_nested_null_column =
+                    reinterpret_cast<const ColumnNullable&>(array_column.get_data());
+            // String's null map in array
+            array_nested_null_map =
+                    array_nested_null_column.get_null_map_column().get_data().data();
+            array_nested_column = array_nested_null_column.get_nested_column_ptr();
+        } else {
+            array_nested_type_is_nullable = true;
+            array_nested_column = array_column.get_data_ptr();
+        }
+
+        auto const_array_nested_null_map = ColumnUInt8::create(array_nested_column->size(), 0);
+        if (array_nested_type_is_nullable) {
+            array_nested_null_map = const_array_nested_null_map->get_data().data();
+        }
+
+        const auto& string_column = reinterpret_cast<const ColumnString&>(*array_nested_column);
+        const ColumnString::Chars& string_src_chars = string_column.get_chars();
+        const ColumnString::Offsets& src_string_offsets = string_column.get_offsets();
+        const ColumnArray::Offsets& src_array_offsets = array_column.get_offsets();
+        ColumnArray::Offset current_src_array_offset = 0;
+
+        // Concat string in array
+        for (size_t i = 0; i < input_rows_count; ++i) {
+            auto& seq_offsets = *offsets_list[0];
+            auto& seq_chars = *chars_list[0];
+            auto& seq_nullmap = *null_list[0];
+
+            if (seq_nullmap[i]) {
+                res_data.push_back('\0');

Review Comment:
   no need to append zero



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] zxealous commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
zxealous commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r918507521


##########
regression-test/suites/query/sql_functions/string_functions/test_string_function.groovy:
##########
@@ -38,6 +38,9 @@ suite("test_string_function", "query") {
     qt_sql "select concat_ws(\"or\", \"d\", \"is\");"
     qt_sql "select concat_ws(NULL, \"d\", \"is\");"
     qt_sql "select concat_ws(\"or\", \"d\", NULL,\"is\");"
+    qt_sql "select concat_ws(\"or\", [\"d\", \"is\"]);"
+    qt_sql "select concat_ws(NULL, [\"d\", \"is\"]);"
+    qt_sql "select concat_ws(\"or\", [\"d\", NULL,\"is\"]);"

Review Comment:
   done



##########
docs/zh-CN/docs/sql-manual/sql-functions/string-functions/concat_ws.md:
##########
@@ -58,6 +59,27 @@ mysql> select concat_ws("or", "d", NULL,"is");
 +---------------------------------+
 | doris                           |
 +---------------------------------+
+
+mysql> select concat_ws("or", ["d", "is"]);
++-----------------------------------+
+| concat_ws('or', ARRAY('d', 'is')) |
++-----------------------------------+
+| doris                             |
++-----------------------------------+
+
+mysql> select concat_ws(NULL, ["d", "is"]);
++-----------------------------------+
+| concat_ws(NULL, ARRAY('d', 'is')) |
++-----------------------------------+
+| NULL                              |
++-----------------------------------+
+
+mysql> select concat_ws("or", ["d", NULL,"is"]);
++-----------------------------------------+
+| concat_ws('or', ARRAY('d', NULL, 'is')) |
++-----------------------------------------+
+| doris                                   |
++-----------------------------------------+
 ```
 ### keywords
 CONCAT_WS,CONCAT,WS

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r918470842


##########
docs/zh-CN/docs/sql-manual/sql-functions/string-functions/concat_ws.md:
##########
@@ -58,6 +59,27 @@ mysql> select concat_ws("or", "d", NULL,"is");
 +---------------------------------+
 | doris                           |
 +---------------------------------+
+
+mysql> select concat_ws("or", ["d", "is"]);
++-----------------------------------+
+| concat_ws('or', ARRAY('d', 'is')) |
++-----------------------------------+
+| doris                             |
++-----------------------------------+
+
+mysql> select concat_ws(NULL, ["d", "is"]);
++-----------------------------------+
+| concat_ws(NULL, ARRAY('d', 'is')) |
++-----------------------------------+
+| NULL                              |
++-----------------------------------+
+
+mysql> select concat_ws("or", ["d", NULL,"is"]);
++-----------------------------------------+
+| concat_ws('or', ARRAY('d', NULL, 'is')) |
++-----------------------------------------+
+| doris                                   |
++-----------------------------------------+
 ```
 ### keywords
 CONCAT_WS,CONCAT,WS

Review Comment:
   keywords add ARRAY



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on PR #10749:
URL: https://github.com/apache/doris/pull/10749#issuecomment-1181799885

   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917512744


##########
be/src/vec/functions/function_string.h:
##########
@@ -540,6 +542,11 @@ class FunctionStringConcatWs : public IFunction {
             } else {
                 null_list[i] = &const_null_map->get_data();
             }
+
+            if (is_array(remove_nullable(block.get_by_position(arguments[i]).type))) {

Review Comment:
   also can use check_column<ColumnArray>, then we do not need to consider nullable again.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] cambyzju commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
cambyzju commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r918463373


##########
be/src/vec/functions/function_string.h:
##########
@@ -553,20 +563,123 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        if (check_column<ColumnArray>(argument_columns[1].get())) {
+            // Determine if the nested type of the array is String
+            const ColumnArray& array_column =
+                    reinterpret_cast<const ColumnArray&>(*argument_columns[1]);
+            if (!array_column.get_data().is_column_string()) {
+                return Status::NotSupported(
+                        fmt::format("unsupported nested array of type {} for function {}",
+                                    array_column.get_data().get_family_name(), get_name()));
+            }
+            // Concat string in array
+            _execute_array(input_rows_count, array_column, buffer, views, offsets_list, chars_list,
+                           null_list, res_data, res_offset);
+
+        } else {
+            // Concat string
+            _execute_string(input_rows_count, argument_size, buffer, views, offsets_list,
+                            chars_list, null_list, res_data, res_offset);
+        }
+        if (is_null_type) {
+            block.get_by_position(result).column =
+                    ColumnNullable::create(std::move(res), std::move(null_map));
+        } else {
+            block.get_by_position(result).column = std::move(res);
+        }
+        return Status::OK();
+    }
+
+private:
+    void _execute_array(const size_t& input_rows_count, const ColumnArray& array_column,
+                        fmt::memory_buffer& buffer, std::vector<std::string_view>& views,
+                        const std::vector<const ColumnString::Offsets*>& offsets_list,
+                        const std::vector<const ColumnString::Chars*>& chars_list,

Review Comment:
   ```suggestion
                           const std::vector<const Chars*>& chars_list,
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] zxealous commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
zxealous commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917519174


##########
docs/en/docs/sql-manual/sql-functions/string-functions/concat_ws.md:
##########
@@ -28,10 +28,10 @@ under the License.
 ### Description
 #### Syntax
 
-`VARCHAR concat ws (VARCHAR sep, VARCHAR str,...)`
+`VARCHAR concat ws (VARCHAR sep, VARCHAR str,...) or VARCHAR concat_ws(VARCHAR sep, ARRAY array)`
 
 
-Using the first parameter SEP as a connector, the second parameter and all subsequent parameters are spliced into a string.
+Using the first parameter SEP as a connector, the second parameter and all subsequent parameters(or all string in an ARRAY) are spliced into a string.
 If the separator is NULL, return NULL.
 ` The concat_ws` function does not skip empty strings, but NULL values.

Review Comment:
   OK



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] github-actions[bot] commented on pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10749:
URL: https://github.com/apache/doris/pull/10749#issuecomment-1182928323

   PR approved by at least one committer and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] zxealous commented on a diff in pull request #10749: [feature-wip] (array-type) function concat_ws support array

Posted by GitBox <gi...@apache.org>.
zxealous commented on code in PR #10749:
URL: https://github.com/apache/doris/pull/10749#discussion_r917690374


##########
be/src/vec/functions/function_string.h:
##########
@@ -540,6 +545,11 @@ class FunctionStringConcatWs : public IFunction {
             } else {
                 null_list[i] = &const_null_map->get_data();
             }
+
+            if (check_column<ColumnArray>(*argument_columns[i].get())) {

Review Comment:
   done



##########
be/src/vec/functions/function_string.h:
##########
@@ -553,6 +563,122 @@ class FunctionStringConcatWs : public IFunction {
         fmt::memory_buffer buffer;
         std::vector<std::string_view> views;
 
+        DataTypePtr array_column_type =
+                check_column<ColumnArray>(*argument_columns[1].get())
+                        ? remove_nullable(block.get_by_position(arguments[1]).type)
+                        : nullptr;
+        if (array_column_type) {

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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