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


##########
be/src/vec/functions/function_timestamp.cpp:
##########
@@ -1364,6 +1370,249 @@
     }
 };
 
+struct FromIso8601DateV2 {
+    static constexpr auto name = "from_iso8601_date";
+
+    static size_t get_number_of_arguments() { return 1; }
+
+    static bool is_variadic() { return false; }
+
+    static DataTypes get_variadic_argument_types() { return 
{std::make_shared<DataTypeString>()}; }
+
+    static DataTypePtr get_return_type_impl(const DataTypes& arguments) {
+        return make_nullable(std::make_shared<DataTypeDateV2>());
+    }
+
+    static Status execute(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,

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



##########
be/src/vec/functions/function_timestamp.cpp:
##########
@@ -1364,6 +1370,249 @@ class FunctionOtherTypesToDateType : public IFunction {
     }
 };
 
+struct FromIso8601DateV2 {
+    static constexpr auto name = "from_iso8601_date";
+
+    static size_t get_number_of_arguments() { return 1; }
+
+    static bool is_variadic() { return false; }
+
+    static DataTypes get_variadic_argument_types() { return 
{std::make_shared<DataTypeString>()}; }
+
+    static DataTypePtr get_return_type_impl(const DataTypes& arguments) {
+        return make_nullable(std::make_shared<DataTypeDateV2>());
+    }
+
+    static Status execute(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,

Review Comment:
   warning: function 'execute' has cognitive complexity of 90 (threshold 50) 
[readability-function-cognitive-complexity]
   ```cpp
       static Status execute(FunctionContext* context, Block& block, const 
ColumnNumbers& arguments,
                     ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/vec/functions/function_timestamp.cpp:1443:** +1, including nesting 
penalty of 0, nesting level increased to 1
   ```cpp
           for (size_t i = 0; i < input_rows_count; ++i) {
           ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1454:** +2, including nesting 
penalty of 1, nesting level increased to 2
   ```cpp
               if (src_string.size() <= 10) {
               ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1460:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (int idx = 0; idx < src_string.size();) {
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1462:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       if (current == '-') {
                       ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1466:** +1, nesting level 
increased to 4
   ```cpp
                       } else if (current == 'W') {
                              ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1470:** +1, nesting level 
increased to 4
   ```cpp
                       } else if (!isdigit(current)) {
                              ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1475:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       for (; idx < src_string.size() && 
isdigit(src_string[idx]); ++idx) {
                       ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1475:** +1
   ```cpp
                       for (; idx < src_string.size() && 
isdigit(src_string[idx]); ++idx) {
                                                      ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1480:** +1, nesting level 
increased to 2
   ```cpp
               } else {
                 ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1485:** +2, including nesting 
penalty of 1, nesting level increased to 2
   ```cpp
               if (iso_string_format_value != -1) {
               ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1497:** +2, including nesting 
penalty of 1, nesting level increased to 2
   ```cpp
               if (iso_string_format_value == 1) {
               ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1498:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (sscanf(src_string.data(), iso_format_string.data(), 
&year, &month, &day) != 3)
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1504:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (!(ts_value.template set_time_unit<YEAR>(year) &&
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1505:** +1
   ```cpp
                         ts_value.template set_time_unit<MONTH>(month) &&
                                                                       ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1509:** +1, nesting level 
increased to 2
   ```cpp
               } else if (iso_string_format_value == 2) {
                      ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1510:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (sscanf(src_string.data(), iso_format_string.data(), 
&year, &month) != 2)
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1516:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (!(ts_value.template set_time_unit<YEAR>(year) &&
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1517:** +1
   ```cpp
                         ts_value.template set_time_unit<MONTH>(month) &&
                                                                       ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1522:** +1, nesting level 
increased to 2
   ```cpp
               } else if (iso_string_format_value == 3) {
                      ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1523:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (sscanf(src_string.data(), iso_format_string.data(), 
&year) != 1) [[unlikely]] {
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1528:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (!(ts_value.template set_time_unit<YEAR>(year) &&
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1529:** +1
   ```cpp
                         ts_value.template set_time_unit<MONTH>(1) &&
                                                                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1534:** +1, nesting level 
increased to 2
   ```cpp
               } else if (iso_string_format_value == 5 || 
iso_string_format_value == 6) {
                      ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1534:** +1
   ```cpp
               } else if (iso_string_format_value == 5 || 
iso_string_format_value == 6) {
                                                       ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1535:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (iso_string_format_value == 5) {
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1536:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       if (sscanf(src_string.data(), iso_format_string.data(), 
&year, &week) != 2)
                       ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1541:** +1, nesting level 
increased to 3
   ```cpp
                   } else {
                     ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1542:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       if (sscanf(src_string.data(), iso_format_string.data(), 
&year, &week,
                       ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1549:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (weekday < 1 || weekday > 7 || week < 1 || week > 53) 
[[unlikely]] {
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1549:** +1
   ```cpp
                   if (weekday < 1 || weekday > 7 || week < 1 || week > 53) 
[[unlikely]] {
                                                              ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1555:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (!(ts_value.template set_time_unit<YEAR>(
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1558:** +1
   ```cpp
                                 first_day_of_week.month().operator unsigned 
int()) &&
                                                                                
    ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1569:** +1, nesting level 
increased to 2
   ```cpp
               } else if (iso_string_format_value == 4) {
                      ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1570:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (sscanf(src_string.data(), iso_format_string.data(), 
&year, &day_of_year) != 2)
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1576:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (is_leap(year)) {
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1577:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       if (day_of_year < 0 || day_of_year > 366) [[unlikely]] {
                       ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1577:** +1
   ```cpp
                       if (day_of_year < 0 || day_of_year > 366) [[unlikely]] {
                                           ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1580:** +1, nesting level 
increased to 3
   ```cpp
                   } else {
                     ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1581:** +4, including nesting 
penalty of 3, nesting level increased to 4
   ```cpp
                       if (day_of_year < 0 || day_of_year > 365) [[unlikely]] {
                       ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1581:** +1
   ```cpp
                       if (day_of_year < 0 || day_of_year > 365) [[unlikely]] {
                                           ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1585:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   if (!(ts_value.template set_time_unit<YEAR>(year) &&
                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1586:** +1
   ```cpp
                         ts_value.template set_time_unit<MONTH>(1) &&
                                                                   ^
   ```
   **be/src/vec/functions/function_timestamp.cpp:1594:** +1, nesting level 
increased to 2
   ```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