github-actions[bot] commented on code in PR #32075:
URL: https://github.com/apache/doris/pull/32075#discussion_r1519816042
##########
be/src/vec/runtime/vdatetime_value.cpp:
##########
@@ -1988,13 +1989,13 @@ bool DateV2Value<T>::from_date_str(const char*
date_str, int len,
template <typename T>
bool DateV2Value<T>::from_date_str_base(const char* date_str, int len, int
scale,
Review Comment:
warning: function 'from_date_str_base' has cognitive complexity of 89
(threshold 50) [readability-function-cognitive-complexity]
```cpp
bool DateV2Value<T>::from_date_str_base(const char* date_str, int len, int
scale,
^
```
<details>
<summary>Additional context</summary>
**be/src/vec/runtime/vdatetime_value.cpp:2000:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
while (ptr < end && isspace(*ptr)) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2000:** +1
```cpp
while (ptr < end && isspace(*ptr)) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2003:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
if (ptr == end || !isdigit(*ptr)) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2003:** +1
```cpp
if (ptr == end || !isdigit(*ptr)) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2008:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
while (pos < end && (isdigit(*pos) || *pos == 'T')) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2008:** +1
```cpp
while (pos < end && (isdigit(*pos) || *pos == 'T')) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2008:** +1
```cpp
while (pos < end && (isdigit(*pos) || *pos == 'T')) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2018:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
if (pos == end || *pos == '.' ||
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2018:** +1
```cpp
if (pos == end || *pos == '.' ||
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2020:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
if (digits == 4 || digits == 8 || digits >= 14) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2020:** +1
```cpp
if (digits == 4 || digits == 8 || digits >= 14) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2022:** +1, nesting level increased
to 2
```cpp
} else {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2031:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
while (ptr < end && isdigit(*ptr) && field_idx < MAX_DATE_PARTS) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2031:** +1
```cpp
while (ptr < end && isdigit(*ptr) && field_idx < MAX_DATE_PARTS) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2034:** +1
```cpp
bool scan_to_delim = (!is_interval_format) && (field_idx != 6);
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2035:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
while (ptr < end && isdigit(*ptr) && (scan_to_delim || field_len--))
{ // field_len <= 7
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2035:** +1
```cpp
while (ptr < end && isdigit(*ptr) && (scan_to_delim || field_len--))
{ // field_len <= 7
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2035:** +1
```cpp
while (ptr < end && isdigit(*ptr) && (scan_to_delim || field_len--))
{ // field_len <= 7
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2039:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
if constexpr (is_datetime) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2044:** +3, including nesting
penalty of 2, nesting level increased to 3
```cpp
if (field_idx == 6 && scale >= 0) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2044:** +1
```cpp
if (field_idx == 6 && scale >= 0) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2055:** +4, including nesting
penalty of 3, nesting level increased to 4
```cpp
if (reminder >= 5 * normalizer) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2060:** +4, including nesting
penalty of 3, nesting level increased to 4
```cpp
if (temp_val == int_exp10(7)) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2063:** +1, nesting level increased
to 4
```cpp
} else {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2070:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
if (temp_val > 999999L) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2075:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
if (field_idx == 6) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2079:** +1, nesting level increased
to 2
```cpp
} else {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2085:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
if (ptr == end) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2091:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
if (UNLIKELY((field_idx > 2 ||
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2093:** +1
```cpp
&& time_zone_begins(ptr, end))) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2091:** +1
```cpp
if (UNLIKELY((field_idx > 2 ||
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2094:** +3, including nesting
penalty of 2, nesting level increased to 3
```cpp
if (local_time_zone == nullptr) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2097:** nesting level increased to 3
```cpp
auto get_tz_offset = [&](const std::string& str_tz,
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2100:** +4, including nesting
penalty of 3, nesting level increased to 4
```cpp
if (!TimezoneUtils::find_cctz_time_zone(str_tz, given_tz)) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2111:** +3, including nesting
penalty of 2, nesting level increased to 3
```cpp
} catch ([[maybe_unused]] Exception& e) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2118:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
if (field_idx == 2 && *ptr == 'T') {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2118:** +1
```cpp
if (field_idx == 2 && *ptr == 'T') {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2126:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
if (field_idx == 5) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2127:** +3, including nesting
penalty of 2, nesting level increased to 3
```cpp
if (*ptr == '.') {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2130:** +1, nesting level increased
to 3
```cpp
} else if (isdigit(*ptr)) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2138:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
while (ptr < end && (ispunct(*ptr) || isspace(*ptr))) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2138:** +1
```cpp
while (ptr < end && (ispunct(*ptr) || isspace(*ptr))) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2138:** +1
```cpp
while (ptr < end && (ispunct(*ptr) || isspace(*ptr))) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2139:** +3, including nesting
penalty of 2, nesting level increased to 3
```cpp
if (isspace(*ptr)) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2140:** +4, including nesting
penalty of 3, nesting level increased to 4
```cpp
if (((1 << field_idx) & allow_space_mask) == 0) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2144:** +3, including nesting
penalty of 2, nesting level increased to 3
```cpp
if (*ptr == '-') {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2152:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
if (!is_interval_format) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2155:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
for (; field_idx < MAX_DATE_PARTS; ++field_idx) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2159:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
if (year_len == 2) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2160:** +2, including nesting
penalty of 1, nesting level increased to 2
```cpp
if (date_val[0] < YY_PART_YEAR) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2162:** +1, nesting level increased
to 2
```cpp
} else {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2167:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
if (num_field < 3) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2170:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
if (is_invalid(date_val[0], date_val[1], date_val[2], 0, 0, 0, 0)) {
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2174:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
if (!check_range_and_set_time(date_val[0], date_val[1], date_val[2],
date_val[3], date_val[4],
^
```
**be/src/vec/runtime/vdatetime_value.cpp:2179:** +1, including nesting
penalty of 0, nesting level increased to 1
```cpp
return sec_offset ? date_add_interval<TimeUnit::SECOND>(
^
```
</details>
##########
be/test/vec/data_types/datetime_round_test.cpp:
##########
@@ -0,0 +1,391 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"}}}, you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gen_cpp/Exprs_types.h>
Review Comment:
warning: 'gen_cpp/Exprs_types.h' file not found [clang-diagnostic-error]
```cpp
#include <gen_cpp/Exprs_types.h>
^
```
--
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]