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


##########
be/src/vec/functions/array/function_array_index.h:
##########
@@ -88,13 +88,20 @@ class FunctionArrayIndex : public IFunction {
     bool use_default_implementation_for_nulls() const override { return false; 
}
 
     DataTypePtr get_return_type_impl(const DataTypes& arguments) const 
override {
-        // DCHECK(is_array(arguments[0]));
-        return make_nullable(std::make_shared<DataTypeNumber<ResultType>>());
+        if constexpr (OldVersion) {
+            return 
make_nullable(std::make_shared<DataTypeNumber<ResultType>>());
+        } else {
+            if (arguments[0]->is_nullable()) {
+                return 
make_nullable(std::make_shared<DataTypeNumber<ResultType>>());
+            } else {
+                return std::make_shared<DataTypeNumber<ResultType>>();
+            }

Review Comment:
   warning: do not use 'else' after 'return' [readability-else-after-return]
   
   ```suggestion
               }                 return 
std::make_shared<DataTypeNumber<ResultType>>();
              
   ```
   



##########
be/src/vec/functions/array/function_array_index.h:
##########
@@ -234,8 +255,8 @@ class FunctionArrayIndex : public IFunction {
         return nullptr;
     }
 
-    Status _execute_non_nullable(Block& block, const ColumnNumbers& arguments, 
size_t result,
-                                 size_t input_rows_count) const {
+    Status _execute_dispatch(Block& block, const ColumnNumbers& arguments, 
size_t result,

Review Comment:
   warning: function '_execute_dispatch' has cognitive complexity of 33 
(threshold 25) [readability-function-cognitive-complexity]
   ```cpp
       Status _execute_dispatch(Block& block, const ColumnNumbers& arguments, 
size_t result,
              ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/vec/functions/array/function_array_index.h:262:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           if 
(!is_array(remove_nullable(block.get_by_position(arguments[0]).type))) {
           ^
   ```
   **be/src/vec/functions/array/function_array_index.h:268:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           if (left_column->is_nullable()) {
           ^
   ```
   **be/src/vec/functions/array/function_array_index.h:273:** +1, nesting level 
increased to 1
   ```cpp
           } else {
             ^
   ```
   **be/src/vec/functions/array/function_array_index.h:279:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           if (array_column->get_data().is_nullable()) {
           ^
   ```
   **be/src/vec/functions/array/function_array_index.h:284:** +1, nesting level 
increased to 1
   ```cpp
           } else {
             ^
   ```
   **be/src/vec/functions/array/function_array_index.h:293:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           if (right_column->is_nullable()) {
           ^
   ```
   **be/src/vec/functions/array/function_array_index.h:305:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           if (is_string(right_type) && is_string(left_element_type)) {
           ^
   ```
   **be/src/vec/functions/array/function_array_index.h:305:** +1
   ```cpp
           if (is_string(right_type) && is_string(left_element_type)) {
                                     ^
   ```
   **be/src/vec/functions/array/function_array_index.h:308:** +1, nesting level 
increased to 1
   ```cpp
           } else if (is_number(right_type) && is_number(left_element_type)) {
                  ^
   ```
   **be/src/vec/functions/array/function_array_index.h:308:** +1
   ```cpp
           } else if (is_number(right_type) && is_number(left_element_type)) {
                                            ^
   ```
   **be/src/vec/functions/array/function_array_index.h:309:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if (check_column<ColumnUInt8>(*nested_column)) {
               ^
   ```
   **be/src/vec/functions/array/function_array_index.h:313:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnInt8>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:317:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnInt16>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:321:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnInt32>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:325:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnInt64>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:329:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnInt128>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:333:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnFloat32>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:337:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnFloat64>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:341:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnDecimal32>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:345:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnDecimal64>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:349:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnDecimal128I>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:353:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnDecimal128>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:358:** +1, nesting level 
increased to 1
   ```cpp
           } else if ((is_date_or_datetime(right_type) || 
is_date_v2_or_datetime_v2(right_type)) &&
                  ^
   ```
   **be/src/vec/functions/array/function_array_index.h:358:** +1
   ```cpp
           } else if ((is_date_or_datetime(right_type) || 
is_date_v2_or_datetime_v2(right_type)) &&
                                                                                
                 ^
   ```
   **be/src/vec/functions/array/function_array_index.h:358:** +1
   ```cpp
           } else if ((is_date_or_datetime(right_type) || 
is_date_v2_or_datetime_v2(right_type)) &&
                                                       ^
   ```
   **be/src/vec/functions/array/function_array_index.h:359:** +1
   ```cpp
                      (is_date_or_datetime(left_element_type) ||
                                                              ^
   ```
   **be/src/vec/functions/array/function_array_index.h:361:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if (nested_column->is_date_type()) {
               ^
   ```
   **be/src/vec/functions/array/function_array_index.h:365:** +1, nesting level 
increased to 2
   ```cpp
               } else if (nested_column->is_datetime_type()) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:369:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnDateV2>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:373:** +1, nesting level 
increased to 2
   ```cpp
               } else if (check_column<ColumnDateTimeV2>(*nested_column)) {
                      ^
   ```
   **be/src/vec/functions/array/function_array_index.h:380:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           if (return_column) {
           ^
   ```
   
   </details>
   



##########
be/src/vec/functions/function_map.cpp:
##########
@@ -170,7 +170,16 @@ class FunctionMapContains : public IFunction {
         }
         DCHECK(is_map(datatype)) << "first argument for function: " << name
                                  << " should be DataTypeMap";
-        return make_nullable(std::make_shared<DataTypeNumber<UInt8>>());
+
+        if constexpr (OldVersion) {
+            return make_nullable(std::make_shared<DataTypeNumber<UInt8>>());
+        } else {
+            if (arguments[0]->is_nullable()) {
+                return 
make_nullable(std::make_shared<DataTypeNumber<UInt8>>());
+            } else {
+                return std::make_shared<DataTypeNumber<UInt8>>();
+            }

Review Comment:
   warning: do not use 'else' after 'return' [readability-else-after-return]
   
   ```suggestion
               }                 return 
std::make_shared<DataTypeNumber<UInt8>>();
              
   ```
   



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to