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 #34457

Closed
wants to merge 4 commits into from

Conversation

TomaYoko
Copy link
Contributor

@TomaYoko TomaYoko commented May 7, 2024

Proposed changes

Issue Number: close #34333

Further comments

If this is a relatively large or complex change, kick off the discussion at [email protected] 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:115: +1, including nesting penalty of 0, nesting level increased to 1

    if (_pending_cursor != nullptr) {
    ^

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

        if (has_next_block(cursor)) {
        ^

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

    if (_priority_queue.empty()) {
    ^

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

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

be/src/vec/runtime/vsorted_run_merger.cpp:128: +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:128: +1

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

be/src/vec/runtime/vsorted_run_merger.cpp:129: +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:131: +4, including nesting penalty of 3, nesting level increased to 4

                if (_pipeline_engine_enabled) {
                ^

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

            } else {
              ^

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

        if (current->isFirst()) {
        ^

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

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

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

                if (_pipeline_engine_enabled) {
                ^

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

            } else {
              ^

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

        } else {
          ^

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

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

be/src/vec/runtime/vsorted_run_merger.cpp:157: +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:163: +4, including nesting penalty of 3, nesting level increased to 4

                if (_pipeline_engine_enabled) {
                ^

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

            } else {
              ^

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

    } else {
      ^

be/src/vec/runtime/vsorted_run_merger.cpp:179: +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:188: +2, including nesting penalty of 1, nesting level increased to 2

        while (!_priority_queue.empty()) {
        ^

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

            if (_offset > 0) {
            ^

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

            } else {
              ^

be/src/vec/runtime/vsorted_run_merger.cpp:195: +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:202: +3, including nesting penalty of 2, nesting level increased to 3

            if (!next_heap(current)) {
            ^

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

            if (merged_rows == _batch_size) {
            ^

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

        if (merged_rows == 0) {
        ^

be/src/vec/runtime/vsorted_run_merger.cpp:219: +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:219: +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:109: 115 lines including whitespace and comments (threshold 80)

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

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 58 (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:115: +1, including nesting penalty of 0, nesting level increased to 1

    if (_pending_cursor != nullptr) {
    ^

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

        if (has_next_block(cursor)) {
        ^

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

    if (_priority_queue.empty()) {
    ^

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

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

be/src/vec/runtime/vsorted_run_merger.cpp:128: +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:128: +1

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

be/src/vec/runtime/vsorted_run_merger.cpp:129: +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:131: +4, including nesting penalty of 3, nesting level increased to 4

                if (_pipeline_engine_enabled) {
                ^

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

            } else {
              ^

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

        if (current->is_first()) {
        ^

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

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

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

                if (_pipeline_engine_enabled) {
                ^

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

            } else {
              ^

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

        } else {
          ^

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

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

be/src/vec/runtime/vsorted_run_merger.cpp:157: +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:163: +4, including nesting penalty of 3, nesting level increased to 4

                if (_pipeline_engine_enabled) {
                ^

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

            } else {
              ^

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

    } else {
      ^

be/src/vec/runtime/vsorted_run_merger.cpp:179: +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:189: nesting level increased to 2

        auto do_insert = [&]() {
                         ^

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

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

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

        while (merged_rows != _batch_size && !_priority_queue.empty()) {
        ^

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

            if (_offset > 0) {
            ^

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

            } else {
              ^

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

            if (!next_heap(current)) {
            ^

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

        if (merged_rows == 0) {
        ^

be/src/vec/runtime/vsorted_run_merger.cpp:231: +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:231: +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:109: 127 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 8, 2024

run buildall

@TomaYoko TomaYoko closed this May 8, 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