Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](SortMerger)add error throwing mechanism #34533

Closed
wants to merge 3 commits into from

Conversation

TomaYoko
Copy link
Contributor

@TomaYoko TomaYoko commented May 8, 2024

Proposed changes

Issue Number: close #34333

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

}
}

Status VSortedRunMerger::get_next_data(Block* output_block, bool* eos) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'get_next_data' has cognitive complexity of 62 (threshold 50) [readability-function-cognitive-complexity]

Status VSortedRunMerger::get_next_data(Block* output_block, bool* eos) {
                         ^
Additional context

be/src/vec/runtime/vsorted_run_merger.cpp:114: +1, including nesting penalty of 0, nesting level increased to 1

    if (_pending_cursor != nullptr) {
    ^

be/src/vec/runtime/vsorted_run_merger.cpp:116: +2, including nesting penalty of 1, nesting level increased to 2

        if (has_next_block(cursor)) {
        ^

be/src/vec/runtime/vsorted_run_merger.cpp:122: +1, including nesting penalty of 0, nesting level increased to 1

    if (_priority_queue.empty()) {
    ^

be/src/vec/runtime/vsorted_run_merger.cpp:125: +1, nesting level increased to 1

    } else if (_priority_queue.size() == 1) {
           ^

be/src/vec/runtime/vsorted_run_merger.cpp:127: +2, including nesting penalty of 1, nesting level increased to 2

        while (_offset != 0 && current->block_ptr() != nullptr) {
        ^

be/src/vec/runtime/vsorted_run_merger.cpp:127: +1

        while (_offset != 0 && current->block_ptr() != nullptr) {
                            ^

be/src/vec/runtime/vsorted_run_merger.cpp:128: +3, including nesting penalty of 2, nesting level increased to 3

            if (_offset >= current->rows - current->pos) {
            ^

be/src/vec/runtime/vsorted_run_merger.cpp:130: +4, including nesting penalty of 3, nesting level increased to 4

                if (_pipeline_engine_enabled) {
                ^

be/src/vec/runtime/vsorted_run_merger.cpp:136: +1, nesting level increased to 3

            } else {
              ^

be/src/vec/runtime/vsorted_run_merger.cpp:142: +2, including nesting penalty of 1, nesting level increased to 2

        if (current->isFirst()) {
        ^

be/src/vec/runtime/vsorted_run_merger.cpp:143: +3, including nesting penalty of 2, nesting level increased to 3

            if (current->block_ptr() != nullptr) {
            ^

be/src/vec/runtime/vsorted_run_merger.cpp:145: +4, including nesting penalty of 3, nesting level increased to 4

                if (_pipeline_engine_enabled) {
                ^

be/src/vec/runtime/vsorted_run_merger.cpp:151: +1, nesting level increased to 3

            } else {
              ^

be/src/vec/runtime/vsorted_run_merger.cpp:154: +1, nesting level increased to 2

        } else {
          ^

be/src/vec/runtime/vsorted_run_merger.cpp:155: +3, including nesting penalty of 2, nesting level increased to 3

            if (current->block_ptr() != nullptr) {
            ^

be/src/vec/runtime/vsorted_run_merger.cpp:156: +4, including nesting penalty of 3, nesting level increased to 4

                for (int i = 0; i < current->all_columns.size(); i++) {
                ^

be/src/vec/runtime/vsorted_run_merger.cpp:162: +4, including nesting penalty of 3, nesting level increased to 4

                if (_pipeline_engine_enabled) {
                ^

be/src/vec/runtime/vsorted_run_merger.cpp:168: +1, nesting level increased to 3

            } else {
              ^

be/src/vec/runtime/vsorted_run_merger.cpp:172: +1, nesting level increased to 1

    } else {
      ^

be/src/vec/runtime/vsorted_run_merger.cpp:178: +2, including nesting penalty of 1, nesting level increased to 2

        if (num_columns != merged_columns.size()) {
        ^

be/src/vec/runtime/vsorted_run_merger.cpp:187: +2, including nesting penalty of 1, nesting level increased to 2

        while (!_priority_queue.empty()) {
        ^

be/src/vec/runtime/vsorted_run_merger.cpp:191: +3, including nesting penalty of 2, nesting level increased to 3

            if (_offset > 0) {
            ^

be/src/vec/runtime/vsorted_run_merger.cpp:193: +1, nesting level increased to 3

            } else {
              ^

be/src/vec/runtime/vsorted_run_merger.cpp:194: +4, including nesting penalty of 3, nesting level increased to 4

                for (size_t i = 0; i < num_columns; ++i) {
                ^

be/src/vec/runtime/vsorted_run_merger.cpp:201: +3, including nesting penalty of 2, nesting level increased to 3

            if (!next_heap(current)) {
            ^

be/src/vec/runtime/vsorted_run_merger.cpp:205: +3, including nesting penalty of 2, nesting level increased to 3

            if (merged_rows == _batch_size) {
            ^

be/src/vec/runtime/vsorted_run_merger.cpp:211: +2, including nesting penalty of 1, nesting level increased to 2

        if (merged_rows == 0) {
        ^

be/src/vec/runtime/vsorted_run_merger.cpp:218: +1, including nesting penalty of 0, nesting level increased to 1

    if (_limit != -1 && _num_rows_returned >= _limit) {
    ^

be/src/vec/runtime/vsorted_run_merger.cpp:218: +1

    if (_limit != -1 && _num_rows_returned >= _limit) {
                     ^

}
}

Status VSortedRunMerger::get_next_data(Block* output_block, bool* eos) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'get_next_data' exceeds recommended size/complexity thresholds [readability-function-size]

Status VSortedRunMerger::get_next_data(Block* output_block, bool* eos) {
                         ^
Additional context

be/src/vec/runtime/vsorted_run_merger.cpp:108: 115 lines including whitespace and comments (threshold 80)

Status VSortedRunMerger::get_next_data(Block* output_block, bool* eos) {
                         ^

@TomaYoko
Copy link
Contributor Author

TomaYoko commented May 9, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.69% (8983/25172)
Line Coverage: 27.34% (74218/271426)
Region Coverage: 26.59% (38377/144342)
Branch Coverage: 23.41% (19573/83624)
Coverage Report: http://coverage.selectdb-in.cc/coverage/dfc5240bb6dfd931bd6e9216572282818a55a6b1_dfc5240bb6dfd931bd6e9216572282818a55a6b1/report/index.html

@TomaYoko TomaYoko closed this May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] BE Crash while sql executing and is non-reproducible
3 participants