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](window_func) fix bug of agg function used in window function and add many test cases (#40678) #41328

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

jacktengg
Copy link
Contributor

Proposed changes

Issue Number: close #xxx

BP #40678

@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.

@jacktengg
Copy link
Contributor Author

run buildall

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

}

template <WindowFunnelMode WINDOW_FUNNEL_MODE>
int _match_event_list(size_t& start_row, size_t row_count,
const NativeType* timestamp_data) const {
int _match_event_list(size_t& start_row, size_t row_count) const {
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 '_match_event_list' has cognitive complexity of 64 (threshold 50) [readability-function-cognitive-complexity]

    int _match_event_list(size_t& start_row, size_t row_count) const {
        ^
Additional context

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:167: +1, including nesting penalty of 0, nesting level increased to 1

        if (match_row < row_count) {
        ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:177: +2, including nesting penalty of 1, nesting level increased to 2

            for (; column_idx < event_count + 1 && match_row < row_count;
            ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:177: +1

            for (; column_idx < event_count + 1 && match_row < row_count;
                                                ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:182: +3, including nesting penalty of 2, nesting level increased to 3

                if constexpr (WINDOW_FUNNEL_MODE == WindowFunnelMode::FIXED) {
                ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:183: +4, including nesting penalty of 3, nesting level increased to 4

                    if (event_data[match_row] == 1) {
                    ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:186: +5, including nesting penalty of 4, nesting level increased to 5

                        if (current_timestamp <= end_timestamp) {
                        ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:194: +3, including nesting penalty of 2, nesting level increased to 3

                if (match_row < row_count) {
                ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:198: +4, including nesting penalty of 3, nesting level increased to 4

                    if (is_matched) {
                    ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:199: +5, including nesting penalty of 4, nesting level increased to 5

                        if constexpr (WINDOW_FUNNEL_MODE == WindowFunnelMode::INCREASE) {
                        ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:203: +4, including nesting penalty of 3, nesting level increased to 4

                    if (!is_matched) {
                    ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:206: +4, including nesting penalty of 3, nesting level increased to 4

                    if constexpr (WINDOW_FUNNEL_MODE == WindowFunnelMode::INCREASE) {
                    ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:210: +4, including nesting penalty of 3, nesting level increased to 4

                    if constexpr (WINDOW_FUNNEL_MODE == WindowFunnelMode::DEDUPLICATION) {
                    ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:212: +5, including nesting penalty of 4, nesting level increased to 5

                        if (match_row != last_match_row + 1) {
                        ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:213: +6, including nesting penalty of 5, nesting level increased to 6

                            for (int tmp_column_idx = 1; tmp_column_idx < column_idx;
                            ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:222: +7, including nesting penalty of 6, nesting level increased to 7

                                if (dup_match_row < match_row) {
                                ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:228: +5, including nesting penalty of 4, nesting level increased to 5

                        if (is_dup) {
                        ^

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:234: +1, nesting level increased to 3

                } else {
                  ^

}

template <WindowFunnelMode WINDOW_FUNNEL_MODE>
int _match_event_list(size_t& start_row, size_t row_count,
const NativeType* timestamp_data) const {
int _match_event_list(size_t& start_row, size_t row_count) const {
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 '_match_event_list' exceeds recommended size/complexity thresholds [readability-function-size]

    int _match_event_list(size_t& start_row, size_t row_count) const {
        ^
Additional context

be/src/vec/aggregate_functions/aggregate_function_window_funnel.h:153: 87 lines including whitespace and comments (threshold 80)

    int _match_event_list(size_t& start_row, size_t row_count) const {
        ^

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.14% (9347/25863)
Line Coverage: 27.66% (76757/277468)
Region Coverage: 26.44% (39412/149063)
Branch Coverage: 23.22% (20057/86368)
Coverage Report: http://coverage.selectdb-in.cc/coverage/c2b3cb7903c7dfc29f670944dbd0ff04861bc1bd_c2b3cb7903c7dfc29f670944dbd0ff04861bc1bd/report/index.html

@jacktengg
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.14% (9347/25863)
Line Coverage: 27.67% (76769/277469)
Region Coverage: 26.44% (39407/149063)
Branch Coverage: 23.23% (20062/86368)
Coverage Report: http://coverage.selectdb-in.cc/coverage/c22e17e5765a7792bc3adc5d7afda69d0893c0e0_c22e17e5765a7792bc3adc5d7afda69d0893c0e0/report/index.html

@yiguolei yiguolei merged commit bf3d424 into apache:branch-2.1 Sep 26, 2024
19 of 21 checks passed
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.

3 participants