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


##########
be/src/vec/functions/function_datetime_floor_ceil.cpp:
##########
@@ -647,7 +673,7 @@ struct TimeRound {
     static constexpr uint64_t MASK_YEAR_MONTH_DAY_HOUR_MINUTE_FOR_DATETIMEV2 = 
((uint64_t)-1) >> 38;
 
     template <typename DateValueType>
-    static void time_round(const DateValueType& ts2, const Int32 period, 
DateValueType& ts1) {
+    static bool time_round(const DateValueType& ts2, const Int32 period, 
DateValueType& ts1) {

Review Comment:
   warning: function 'time_round' has cognitive complexity of 52 (threshold 50) 
[readability-function-cognitive-complexity]
   ```cpp
       static bool time_round(const DateValueType& ts2, const Int32 period, 
DateValueType& ts1) {
                   ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:679:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           if constexpr (std::is_same_v<DateValueType, VecDateTimeValue>) {
           ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:680:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == YEAR) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:685:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == MONTH) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:690:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == WEEK) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:697:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == DAY) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:702:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == HOUR) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:707:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == MINUTE) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:713:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == SECOND) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:718:** +1, nesting 
level increased to 1
   ```cpp
           } else if constexpr (std::is_same_v<DateValueType, 
DateV2Value<DateV2ValueType>>) {
                  ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:719:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == YEAR) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:724:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == MONTH) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:729:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == WEEK) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:736:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == DAY) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:741:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == HOUR) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:746:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == MINUTE) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:752:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == SECOND) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:757:** +1, nesting 
level increased to 1
   ```cpp
           } else if constexpr (std::is_same_v<DateValueType, 
DateV2Value<DateTimeV2ValueType>>) {
                  ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:758:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == YEAR) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:763:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == MONTH) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:768:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == WEEK) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:775:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == DAY) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:780:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == HOUR) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:785:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == MINUTE) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:793:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
               if constexpr (Impl::Unit == SECOND) {
               ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:801:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           if constexpr (Impl::Type == CEIL) {
           ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:805:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           if constexpr (Impl::Type == FLOOR) {
           ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:812:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           int64_t delta_inside_period = diff >= 0 ? diff % count : (diff % 
count + count) % count;
                                                   ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:814:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
                          (Impl::Type == FLOOR        ? 0
                                                      ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:815:** +2, including 
nesting penalty of 1, nesting level increased to 2
   ```cpp
                           : delta_inside_period == 0 ? 0
                                                      ^
   ```
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:818:** +1, including 
nesting penalty of 0, nesting level increased to 1
   ```cpp
           TimeInterval interval(Impl::Unit, is_neg ? -step : step, is_neg);
                                                    ^
   ```
   
   </details>
   



##########
be/src/vec/functions/function_datetime_floor_ceil.cpp:
##########
@@ -647,7 +673,7 @@
     static constexpr uint64_t MASK_YEAR_MONTH_DAY_HOUR_MINUTE_FOR_DATETIMEV2 = 
((uint64_t)-1) >> 38;
 
     template <typename DateValueType>
-    static void time_round(const DateValueType& ts2, const Int32 period, 
DateValueType& ts1) {
+    static bool time_round(const DateValueType& ts2, const Int32 period, 
DateValueType& ts1) {

Review Comment:
   warning: function 'time_round' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
       static bool time_round(const DateValueType& ts2, const Int32 period, 
DateValueType& ts1) {
                   ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/vec/functions/function_datetime_floor_ceil.cpp:675:** 145 lines 
including whitespace and comments (threshold 80)
   ```cpp
       static bool time_round(const DateValueType& ts2, const Int32 period, 
DateValueType& ts1) {
                   ^
   ```
   
   </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: 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