github-actions[bot] commented on code in PR #31067: URL: https://github.com/apache/doris/pull/31067#discussion_r1495420325
########## be/src/exprs/runtime_filter.cpp: ########## @@ -954,47 +954,52 @@ void IRuntimeFilter::insert_batch(const vectorized::ColumnPtr column, size_t sta _wrapper->insert_batch(column, start); } -Status IRuntimeFilter::merge_local_filter(RuntimePredicateWrapper* wrapper, int* merged_num) { - SCOPED_TIMER(_merge_local_rf_timer); - std::unique_lock lock(_local_merge_mutex); - if (_merged_rf_num == 0) { - _wrapper = wrapper; - } else { - RETURN_IF_ERROR(merge_from(wrapper)); - } - *merged_num = ++_merged_rf_num; - return Status::OK(); -} - Status IRuntimeFilter::publish(bool publish_local) { Review Comment: warning: function 'publish' has cognitive complexity of 77 (threshold 50) [readability-function-cognitive-complexity] ```cpp Status IRuntimeFilter::publish(bool publish_local) { ^ ``` <details> <summary>Additional context</summary> **be/src/exprs/runtime_filter.cpp:958:** nesting level increased to 1 ```cpp auto send_to_remote = [&](IRuntimeFilter* filter) { ^ ``` **be/src/exprs/runtime_filter.cpp:961:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp RETURN_IF_ERROR(_state->runtime_filter_mgr->get_merge_addr(&addr)); ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/exprs/runtime_filter.cpp:961:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(_state->runtime_filter_mgr->get_merge_addr(&addr)); ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/exprs/runtime_filter.cpp:964:** nesting level increased to 1 ```cpp auto send_to_local = [&](RuntimePredicateWrapper* wrapper) { ^ ``` **be/src/exprs/runtime_filter.cpp:966:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp RETURN_IF_ERROR(_state->runtime_filter_mgr->get_consume_filters(_filter_id, filters)); ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/exprs/runtime_filter.cpp:966:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(_state->runtime_filter_mgr->get_consume_filters(_filter_id, filters)); ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/exprs/runtime_filter.cpp:975:** nesting level increased to 1 ```cpp auto do_local_merge = [&]() { ^ ``` **be/src/exprs/runtime_filter.cpp:977:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp RETURN_IF_ERROR(_state->runtime_filter_mgr->get_local_merge_producer_filters( ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/exprs/runtime_filter.cpp:977:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(_state->runtime_filter_mgr->get_local_merge_producer_filters( ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/exprs/runtime_filter.cpp:980:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp RETURN_IF_ERROR(local_merge_filters->filters[0]->merge_from(_wrapper)); ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/exprs/runtime_filter.cpp:980:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(local_merge_filters->filters[0]->merge_from(_wrapper)); ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/exprs/runtime_filter.cpp:982:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (local_merge_filters->merge_time == 0) { ^ ``` **be/src/exprs/runtime_filter.cpp:983:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp if (_has_local_target) { ^ ``` **be/src/exprs/runtime_filter.cpp:984:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(send_to_local(local_merge_filters->filters[0]->_wrapper)); ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/exprs/runtime_filter.cpp:984:** +5, including nesting penalty of 4, nesting level increased to 5 ```cpp RETURN_IF_ERROR(send_to_local(local_merge_filters->filters[0]->_wrapper)); ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/exprs/runtime_filter.cpp:985:** +1, nesting level increased to 3 ```cpp } else { ^ ``` **be/src/exprs/runtime_filter.cpp:986:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(send_to_remote(local_merge_filters->filters[0])); ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/exprs/runtime_filter.cpp:986:** +5, including nesting penalty of 4, nesting level increased to 5 ```cpp RETURN_IF_ERROR(send_to_remote(local_merge_filters->filters[0])); ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/exprs/runtime_filter.cpp:992:** +1, including nesting penalty of 0, nesting level increased to 1 ```cpp if (_need_local_merge && _has_local_target) { ^ ``` **be/src/exprs/runtime_filter.cpp:992:** +1 ```cpp if (_need_local_merge && _has_local_target) { ^ ``` **be/src/exprs/runtime_filter.cpp:993:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp RETURN_IF_ERROR(do_local_merge()); ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/exprs/runtime_filter.cpp:993:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(do_local_merge()); ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/exprs/runtime_filter.cpp:994:** +1, nesting level increased to 1 ```cpp } else if (_has_local_target) { ^ ``` **be/src/exprs/runtime_filter.cpp:995:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp RETURN_IF_ERROR(send_to_local(_wrapper)); ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/exprs/runtime_filter.cpp:995:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(send_to_local(_wrapper)); ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/exprs/runtime_filter.cpp:996:** +1, nesting level increased to 1 ```cpp } else if (!publish_local) { ^ ``` **be/src/exprs/runtime_filter.cpp:997:** +2, including nesting penalty of 1, nesting level increased to 2 ```cpp if (_is_broadcast_join || _state->be_exec_version < 3) { ^ ``` **be/src/exprs/runtime_filter.cpp:997:** +1 ```cpp if (_is_broadcast_join || _state->be_exec_version < 3) { ^ ``` **be/src/exprs/runtime_filter.cpp:998:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(send_to_remote(this)); ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/exprs/runtime_filter.cpp:998:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(send_to_remote(this)); ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/exprs/runtime_filter.cpp:999:** +1, nesting level increased to 2 ```cpp } else { ^ ``` **be/src/exprs/runtime_filter.cpp:1000:** +3, including nesting penalty of 2, nesting level increased to 3 ```cpp RETURN_IF_ERROR(do_local_merge()); ^ ``` **be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR' ```cpp do { \ ^ ``` **be/src/exprs/runtime_filter.cpp:1000:** +4, including nesting penalty of 3, nesting level increased to 4 ```cpp RETURN_IF_ERROR(do_local_merge()); ^ ``` **be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR' ```cpp if (UNLIKELY(!_status_.ok())) { \ ^ ``` **be/src/exprs/runtime_filter.cpp:1002:** +1, nesting level increased to 1 ```cpp } else { ^ ``` </details> ########## be/src/exprs/runtime_filter_slots.h: ########## @@ -34,25 +34,24 @@ class VRuntimeFilterSlots { public: VRuntimeFilterSlots( const std::vector<std::shared_ptr<vectorized::VExprContext>>& build_expr_ctxs, - const std::vector<IRuntimeFilter*>& runtime_filters, bool is_global = false) + const std::vector<IRuntimeFilter*>& runtime_filters, bool need_local_merge = false) : _build_expr_context(build_expr_ctxs), _runtime_filters(runtime_filters), - _is_global(is_global) {} + _need_local_merge(need_local_merge) {} Status init(RuntimeState* state, int64_t hash_table_size) { // runtime filter effect strategy // 1. we will ignore IN filter when hash_table_size is too big // 2. we will ignore BLOOM filter and MinMax filter when hash_table_size // is too small and IN filter has effect - std::map<int, bool> has_in_filter; auto ignore_local_filter = [&](int filter_id) { // Now pipeline x have bug in ignore, after fix the problem enable ignore logic in pipeline x - if (_is_global) { + if (_need_local_merge) { return Status::OK(); } - auto runtime_filter_mgr = state->runtime_filter_mgr(); + auto runtime_filter_mgr = state->local_runtime_filter_mgr(); Review Comment: warning: 'auto runtime_filter_mgr' can be declared as 'auto *runtime_filter_mgr' [readability-qualified-auto] ```suggestion auto *runtime_filter_mgr = state->local_runtime_filter_mgr(); ``` -- 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