github-actions[bot] commented on code in PR #41049:
URL: https://github.com/apache/doris/pull/41049#discussion_r1768091780
##########
be/src/vec/functions/function_timestamp.cpp:
##########
@@ -1364,6 +1370,240 @@ 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 81 (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:1516:** +1
```cpp
if (!(ts_value.template set_time_unit<YEAR>(year) &&
^
```
**be/src/vec/functions/function_timestamp.cpp:1521:** +1, nesting level
increased to 2
```cpp
} else if (iso_string_format_value == 3) {
^
```
**be/src/vec/functions/function_timestamp.cpp:1522:** +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:1527:** +3, including nesting
penalty of 2, nesting level increased to 3
```cpp
if (!ts_value.template set_time_unit<YEAR>(year))
[[unlikely]] {
^
```
**be/src/vec/functions/function_timestamp.cpp:1533:** +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:1533:** +1
```cpp
} else if (iso_string_format_value == 5 ||
iso_string_format_value == 6) {
^
```
**be/src/vec/functions/function_timestamp.cpp:1534:** +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:1535:** +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:1540:** +1, nesting level
increased to 3
```cpp
} else {
^
```
**be/src/vec/functions/function_timestamp.cpp:1541:** +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:1548:** +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:1548:** +1
```cpp
if (weekday < 1 || weekday > 7 || week < 1 || week > 53)
[[unlikely]] {
^
```
**be/src/vec/functions/function_timestamp.cpp:1564:** +1, nesting level
increased to 2
```cpp
} else if (iso_string_format_value == 4) {
^
```
**be/src/vec/functions/function_timestamp.cpp:1565:** +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:1571:** +3, including nesting
penalty of 2, nesting level increased to 3
```cpp
if (is_leap(year)) {
^
```
**be/src/vec/functions/function_timestamp.cpp:1572:** +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:1572:** +1
```cpp
if (day_of_year < 0 || day_of_year > 366) [[unlikely]] {
^
```
**be/src/vec/functions/function_timestamp.cpp:1575:** +1, nesting level
increased to 3
```cpp
} else {
^
```
**be/src/vec/functions/function_timestamp.cpp:1576:** +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:1576:** +1
```cpp
if (day_of_year < 0 || day_of_year > 365) [[unlikely]] {
^
```
**be/src/vec/functions/function_timestamp.cpp:1585:** +1, nesting level
increased to 2
```cpp
} else {
^
```
</details>
##########
be/src/vec/functions/function_timestamp.cpp:
##########
@@ -1364,6 +1370,240 @@
}
};
+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:** 206 lines including
whitespace and comments (threshold 80)
```cpp
static Status execute(FunctionContext* context, Block& block, const
ColumnNumbers& arguments,
^
```
</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]