github-actions[bot] commented on code in PR #33550:
URL: https://github.com/apache/doris/pull/33550#discussion_r1562129361
##########
be/src/pipeline/exec/exchange_sink_operator.cpp:
##########
@@ -150,9 +151,24 @@ Status ExchangeSinkLocalState::init(RuntimeState* state,
LocalSinkStateInfo& inf
}
SCOPED_CONSUME_MEM_TRACKER(_mem_tracker.get());
+ // Make sure brpc stub is ready before execution.
+ for (int i = 0; i < channels.size(); ++i) {
+ RETURN_IF_ERROR(channels[i]->init_stub(state));
+ }
+ return Status::OK();
+}
+
+Status ExchangeSinkLocalState::open(RuntimeState* state) {
Review Comment:
warning: function 'open' has cognitive complexity of 64 (threshold 50)
[readability-function-cognitive-complexity]
```cpp
Status ExchangeSinkLocalState::open(RuntimeState* state) {
^
```
<details>
<summary>Additional context</summary>
**be/src/pipeline/exec/exchange_sink_operator.cpp:162:** nesting level
increased to 1
```cpp
SCOPED_TIMER(_open_timer);
^
```
**be/src/util/runtime_profile.h:67:** expanded from macro 'SCOPED_TIMER'
```cpp
#define SCOPED_TIMER(c) ScopedTimer<MonotonicStopWatch>
MACRO_CONCAT(SCOPED_TIMER, __COUNTER__)(c)
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:163:** +1, including
nesting penalty of 0, nesting level increased to 1
```cpp
RETURN_IF_ERROR(Base::open(state));
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:163:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(Base::open(state));
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:175:** +1, including
nesting penalty of 0, nesting level increased to 1
```cpp
if (_part_type == TPartitionType::UNPARTITIONED || _part_type ==
TPartitionType::RANDOM ||
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:194:** +1, including
nesting penalty of 0, nesting level increased to 1
```cpp
if ((_part_type == TPartitionType::UNPARTITIONED || channels.size() ==
1) &&
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:201:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
for (int i = 0; i < config::num_broadcast_buffer; ++i) {
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:207:** +1, nesting level
increased to 1
```cpp
} else if (local_size > 0) {
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:220:** +1, including
nesting penalty of 0, nesting level increased to 1
```cpp
if (_part_type == TPartitionType::HASH_PARTITIONED) {
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:224:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_partitioner->init(p._texprs));
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:224:** +3, including
nesting penalty of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_partitioner->init(p._texprs));
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:225:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:225:** +3, including
nesting penalty of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:228:** +1, nesting level
increased to 1
```cpp
} else if (_part_type ==
TPartitionType::BUCKET_SHFFULE_HASH_PARTITIONED) {
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:232:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_partitioner->init(p._texprs));
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:232:** +3, including
nesting penalty of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_partitioner->init(p._texprs));
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:233:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:233:** +3, including
nesting penalty of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:236:** +1, nesting level
increased to 1
```cpp
} else if (_part_type ==
TPartitionType::TABLET_SINK_SHUFFLE_PARTITIONED) {
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:242:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_schema->init(p._tablet_sink_schema));
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:242:** +3, including
nesting penalty of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_schema->init(p._tablet_sink_schema));
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:244:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_vpartition->init());
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:244:** +3, including
nesting penalty of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_vpartition->init());
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:267:** +1, nesting level
increased to 1
```cpp
} else if (_part_type == TPartitionType::TABLE_SINK_HASH_PARTITIONED) {
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:290:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_partitioner->init(p._texprs));
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:290:** +3, including
nesting penalty of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_partitioner->init(p._texprs));
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:291:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:291:** +3, including
nesting penalty of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_partitioner->prepare(state, p._row_desc));
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:297:** +1, including
nesting penalty of 0, nesting level increased to 1
```cpp
if (_part_type == TPartitionType::HASH_PARTITIONED ||
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:300:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_partitioner->open(state));
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:300:** +3, including
nesting penalty of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_partitioner->open(state));
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:301:** +1, nesting level
increased to 1
```cpp
} else if (_part_type ==
TPartitionType::TABLET_SINK_SHUFFLE_PARTITIONED) {
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:302:** +2, including
nesting penalty of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_row_distribution.open(_tablet_sink_row_desc));
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/pipeline/exec/exchange_sink_operator.cpp:302:** +3, including
nesting penalty of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_row_distribution.open(_tablet_sink_row_desc));
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
</details>
##########
be/src/pipeline/exec/exchange_sink_operator.cpp:
##########
@@ -150,9 +151,24 @@
}
SCOPED_CONSUME_MEM_TRACKER(_mem_tracker.get());
+ // Make sure brpc stub is ready before execution.
+ for (int i = 0; i < channels.size(); ++i) {
+ RETURN_IF_ERROR(channels[i]->init_stub(state));
+ }
+ return Status::OK();
+}
+
+Status ExchangeSinkLocalState::open(RuntimeState* state) {
Review Comment:
warning: function 'open' exceeds recommended size/complexity thresholds
[readability-function-size]
```cpp
Status ExchangeSinkLocalState::open(RuntimeState* state) {
^
```
<details>
<summary>Additional context</summary>
**be/src/pipeline/exec/exchange_sink_operator.cpp:160:** 145 lines including
whitespace and comments (threshold 80)
```cpp
Status ExchangeSinkLocalState::open(RuntimeState* state) {
^
```
</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]