github-actions[bot] commented on code in PR #30392:
URL: https://github.com/apache/doris/pull/30392#discussion_r1467226512


##########
be/src/vec/functions/function_string.h:
##########
@@ -1866,6 +1866,159 @@ class FunctionSubstringIndex : public IFunction {
     String get_name() const override { return name; }
     size_t get_number_of_arguments() const override { return 3; }
 
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const 
override {

Review Comment:
   warning: method 'get_return_type_impl' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static DataTypePtr get_return_type_impl(const DataTypes& arguments) 
override {
   ```
   



##########
be/src/vec/functions/function_string.h:
##########
@@ -1866,6 +1866,159 @@
     String get_name() const override { return name; }
     size_t get_number_of_arguments() const override { return 3; }
 
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const 
override {
+        return std::make_shared<DataTypeString>();
+    }
+
+    bool use_default_implementation_for_nulls() const override { return true; }
+
+    Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,

Review Comment:
   warning: function 'execute_impl' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
       Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
              ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/vec/functions/function_string.h:1874:** 136 lines including 
whitespace and comments (threshold 80)
   ```cpp
       Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
              ^
   ```
   
   </details>
   



##########
be/src/vec/functions/function_string.h:
##########
@@ -1866,6 +1866,159 @@
     String get_name() const override { return name; }
     size_t get_number_of_arguments() const override { return 3; }
 
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const 
override {
+        return std::make_shared<DataTypeString>();
+    }
+
+    bool use_default_implementation_for_nulls() const override { return true; }
+
+    Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
+                        size_t result, size_t input_rows_count) const override 
{

Review Comment:
   warning: method 'execute_impl' can be made static 
[readability-convert-member-functions-to-static]
   
   ```suggestion
       static Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
                           size_t result, size_t input_rows_count) override {
   ```
   



##########
be/src/vec/functions/function_string.h:
##########
@@ -1866,6 +1866,159 @@
     String get_name() const override { return name; }
     size_t get_number_of_arguments() const override { return 3; }
 
+    DataTypePtr get_return_type_impl(const DataTypes& arguments) const 
override {
+        return std::make_shared<DataTypeString>();
+    }
+
+    bool use_default_implementation_for_nulls() const override { return true; }
+
+    Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,

Review Comment:
   warning: function 'execute_impl' has cognitive complexity of 86 (threshold 
50) [readability-function-cognitive-complexity]
   ```cpp
       Status execute_impl(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
              ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/vec/functions/function_string.h:1900:** +1, including nesting 
penalty of 0, nesting level increased to 1
   ```cpp
           if (part_number == 0 || delimiter_size == 0) {
           ^
   ```
   **be/src/vec/functions/function_string.h:1900:** +1
   ```cpp
           if (part_number == 0 || delimiter_size == 0) {
                                ^
   ```
   **be/src/vec/functions/function_string.h:1901:** +2, including nesting 
penalty of 1, nesting level increased to 2
   ```cpp
               for (size_t i = 0; i < input_rows_count; ++i) {
               ^
   ```
   **be/src/vec/functions/function_string.h:1904:** +1, nesting level increased 
to 1
   ```cpp
           } else if (part_number > 0) {
                  ^
   ```
   **be/src/vec/functions/function_string.h:1905:** +2, including nesting 
penalty of 1, nesting level increased to 2
   ```cpp
               if (delimiter_size == 1) {
               ^
   ```
   **be/src/vec/functions/function_string.h:1907:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < input_rows_count; ++i) {
                   ^
   ```
   **be/src/vec/functions/function_string.h:1911:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       while (num < part_number) {
                       ^
   ```
   **be/src/vec/functions/function_string.h:1915:** +5, including nesting 
penalty of 4, nesting level increased to 5
   ```cpp
                           if (pos != nullptr) {
                           ^
   ```
   **be/src/vec/functions/function_string.h:1918:** +1, nesting level increased 
to 5
   ```cpp
                           } else {
                             ^
   ```
   **be/src/vec/functions/function_string.h:1920:** +6, including nesting 
penalty of 5, nesting level increased to 6
   ```cpp
                               num = (num == 0) ? 0 : num + 1;
                                                ^
   ```
   **be/src/vec/functions/function_string.h:1925:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       if (num == part_number) {
                       ^
   ```
   **be/src/vec/functions/function_string.h:1930:** +1, nesting level increased 
to 4
   ```cpp
                       } else {
                         ^
   ```
   **be/src/vec/functions/function_string.h:1935:** +1, nesting level increased 
to 2
   ```cpp
               } else {
                 ^
   ```
   **be/src/vec/functions/function_string.h:1938:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < input_rows_count; ++i) {
                   ^
   ```
   **be/src/vec/functions/function_string.h:1942:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       while (num < part_number) {
                       ^
   ```
   **be/src/vec/functions/function_string.h:1946:** +5, including nesting 
penalty of 4, nesting level increased to 5
   ```cpp
                           if (pos < str.data + str.size) {
                           ^
   ```
   **be/src/vec/functions/function_string.h:1949:** +1, nesting level increased 
to 5
   ```cpp
                           } else {
                             ^
   ```
   **be/src/vec/functions/function_string.h:1951:** +6, including nesting 
penalty of 5, nesting level increased to 6
   ```cpp
                               num = (num == 0) ? 0 : num + 1;
                                                ^
   ```
   **be/src/vec/functions/function_string.h:1956:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       if (num == part_number) {
                       ^
   ```
   **be/src/vec/functions/function_string.h:1961:** +1, nesting level increased 
to 4
   ```cpp
                       } else {
                         ^
   ```
   **be/src/vec/functions/function_string.h:1967:** +1, nesting level increased 
to 1
   ```cpp
           } else {
             ^
   ```
   **be/src/vec/functions/function_string.h:1970:** +2, including nesting 
penalty of 1, nesting level increased to 2
   ```cpp
               for (size_t i = 0; i < input_rows_count; ++i) {
               ^
   ```
   **be/src/vec/functions/function_string.h:1977:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   while (num <= part_number && offset >= 0) {
                   ^
   ```
   **be/src/vec/functions/function_string.h:1977:** +1
   ```cpp
                   while (num <= part_number && offset >= 0) {
                                             ^
   ```
   **be/src/vec/functions/function_string.h:1979:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       if (offset != -1) {
                       ^
   ```
   **be/src/vec/functions/function_string.h:1980:** +5, including nesting 
penalty of 4, nesting level increased to 5
   ```cpp
                           if (++num == part_number) {
                           ^
   ```
   **be/src/vec/functions/function_string.h:1986:** +1, nesting level increased 
to 4
   ```cpp
                       } else {
                         ^
   ```
   **be/src/vec/functions/function_string.h:1990:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   num = (offset == -1 && num != 0) ? num + 1 : num;
                                                    ^
   ```
   **be/src/vec/functions/function_string.h:1990:** +1
   ```cpp
                   num = (offset == -1 && num != 0) ? num + 1 : num;
                                       ^
   ```
   **be/src/vec/functions/function_string.h:1992:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (num == part_number) {
                   ^
   ```
   **be/src/vec/functions/function_string.h:1993:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       if (offset == -1) {
                       ^
   ```
   **be/src/vec/functions/function_string.h:1996:** +1, nesting level increased 
to 4
   ```cpp
                       } else {
                         ^
   ```
   **be/src/vec/functions/function_string.h:2002:** +1, nesting level increased 
to 3
   ```cpp
                   } else {
                     ^
   ```
   
   </details>
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to