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


##########
be/src/runtime/fragment_mgr.cpp:
##########
@@ -623,8 +623,82 @@ void FragmentMgr::remove_pipeline_context(
 }
 
 template <typename Params>
-Status FragmentMgr::_get_query_ctx(const Params& params, TUniqueId query_id, 
bool pipeline,
+Status FragmentMgr::_get_query_ctx(Params& params, TUniqueId query_id, bool 
pipeline,

Review Comment:
   warning: function '_get_query_ctx' has cognitive complexity of 103 
(threshold 50) [readability-function-cognitive-complexity]
   ```cpp
   Status FragmentMgr::_get_query_ctx(Params& params, TUniqueId query_id, bool 
pipeline,
                       ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/runtime/fragment_mgr.cpp:627:** +1
   ```cpp
       const bool enable_pipeline_x = 
params.query_options.__isset.enable_pipeline_x_engine &&
                                                                                
            ^
   ```
   **be/src/runtime/fragment_mgr.cpp:629:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (enable_pipeline_x && params.__isset.desc_tbl) {
       ^
   ```
   **be/src/runtime/fragment_mgr.cpp:629:** +1
   ```cpp
       if (enable_pipeline_x && params.__isset.desc_tbl) {
                             ^
   ```
   **be/src/runtime/fragment_mgr.cpp:632:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (search == _query_ctx_map.end()) {
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:633:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if constexpr (std::is_same_v<Params, TPipelineFragmentParams>) {
               ^
   ```
   **be/src/runtime/fragment_mgr.cpp:643:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               RETURN_IF_ERROR(DescriptorTbl::create(&(query_ctx->obj_pool), 
params.desc_tbl,
               ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/runtime/fragment_mgr.cpp:643:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
               RETURN_IF_ERROR(DescriptorTbl::create(&(query_ctx->obj_pool), 
params.desc_tbl,
               ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:646:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (params.__isset.file_scan_params) {
               ^
   ```
   **be/src/runtime/fragment_mgr.cpp:657:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (params.__isset.resource_info) {
               ^
   ```
   **be/src/runtime/fragment_mgr.cpp:666:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (params.__isset.workload_groups && 
!params.workload_groups.empty()) {
               ^
   ```
   **be/src/runtime/fragment_mgr.cpp:666:** +1
   ```cpp
               if (params.__isset.workload_groups && 
!params.workload_groups.empty()) {
                                                  ^
   ```
   **be/src/runtime/fragment_mgr.cpp:670:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
                   if (workload_group_ptr != nullptr) {
                   ^
   ```
   **be/src/runtime/fragment_mgr.cpp:671:** +5, including nesting penalty of 4, 
nesting level increased to 5
   ```cpp
                       RETURN_IF_ERROR(workload_group_ptr->add_query(query_id, 
query_ctx));
                       ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/runtime/fragment_mgr.cpp:671:** +6, including nesting penalty of 5, 
nesting level increased to 6
   ```cpp
                       RETURN_IF_ERROR(workload_group_ptr->add_query(query_id, 
query_ctx));
                       ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:672:** +5, including nesting penalty of 4, 
nesting level increased to 5
   ```cpp
                       
RETURN_IF_ERROR(query_ctx->set_workload_group(workload_group_ptr));
                       ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/runtime/fragment_mgr.cpp:672:** +6, including nesting penalty of 5, 
nesting level increased to 6
   ```cpp
                       
RETURN_IF_ERROR(query_ctx->set_workload_group(workload_group_ptr));
                       ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:680:** +1, nesting level increased to 4
   ```cpp
                   } else {
                     ^
   ```
   **be/src/runtime/fragment_mgr.cpp:685:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               RETURN_IF_ERROR(DescriptorTbl::create(&(query_ctx->obj_pool), 
params.desc_tbl,
               ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/runtime/fragment_mgr.cpp:685:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
               RETURN_IF_ERROR(DescriptorTbl::create(&(query_ctx->obj_pool), 
params.desc_tbl,
               ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:693:** +1, nesting level increased to 2
   ```cpp
           } else {
             ^
   ```
   **be/src/runtime/fragment_mgr.cpp:694:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if constexpr (std::is_same_v<Params, TPipelineFragmentParams>) {
               ^
   ```
   **be/src/runtime/fragment_mgr.cpp:701:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (params.is_simplified_param) {
       ^
   ```
   **be/src/runtime/fragment_mgr.cpp:705:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (search == _query_ctx_map.end()) {
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:712:** +1, nesting level increased to 1
   ```cpp
       } else {
         ^
   ```
   **be/src/runtime/fragment_mgr.cpp:717:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (search != _query_ctx_map.end()) {
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:728:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(DescriptorTbl::create(&(query_ctx->obj_pool), 
params.desc_tbl,
           ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/runtime/fragment_mgr.cpp:728:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(DescriptorTbl::create(&(query_ctx->obj_pool), 
params.desc_tbl,
           ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:731:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (params.__isset.file_scan_params) {
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:741:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (params.__isset.resource_info) {
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:751:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (params.__isset.workload_groups && 
!params.workload_groups.empty()) {
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:751:** +1
   ```cpp
           if (params.__isset.workload_groups && 
!params.workload_groups.empty()) {
                                              ^
   ```
   **be/src/runtime/fragment_mgr.cpp:755:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (workload_group_ptr != nullptr) {
               ^
   ```
   **be/src/runtime/fragment_mgr.cpp:756:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
                   RETURN_IF_ERROR(workload_group_ptr->add_query(query_id, 
query_ctx));
                   ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/runtime/fragment_mgr.cpp:756:** +5, including nesting penalty of 4, 
nesting level increased to 5
   ```cpp
                   RETURN_IF_ERROR(workload_group_ptr->add_query(query_id, 
query_ctx));
                   ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:757:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
                   
RETURN_IF_ERROR(query_ctx->set_workload_group(workload_group_ptr));
                   ^
   ```
   **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/runtime/fragment_mgr.cpp:757:** +5, including nesting penalty of 4, 
nesting level increased to 5
   ```cpp
                   
RETURN_IF_ERROR(query_ctx->set_workload_group(workload_group_ptr));
                   ^
   ```
   **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/runtime/fragment_mgr.cpp:766:** +1, nesting level increased to 3
   ```cpp
               } else {
                 ^
   ```
   
   </details>
   



##########
be/src/runtime/fragment_mgr.cpp:
##########
@@ -623,8 +623,82 @@
 }
 
 template <typename Params>
-Status FragmentMgr::_get_query_ctx(const Params& params, TUniqueId query_id, 
bool pipeline,
+Status FragmentMgr::_get_query_ctx(Params& params, TUniqueId query_id, bool 
pipeline,

Review Comment:
   warning: function '_get_query_ctx' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
   Status FragmentMgr::_get_query_ctx(Params& params, TUniqueId query_id, bool 
pipeline,
                       ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/runtime/fragment_mgr.cpp:625:** 153 lines including whitespace and 
comments (threshold 80)
   ```cpp
   Status FragmentMgr::_get_query_ctx(Params& params, TUniqueId query_id, bool 
pipeline,
                       ^
   ```
   
   </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