github-actions[bot] commented on code in PR #39023: URL: https://github.com/apache/doris/pull/39023#discussion_r1706459490
########## be/src/vec/columns/column_decimal.h: ########## @@ -21,6 +21,7 @@ #pragma once #include <glog/logging.h> Review Comment: warning: 'glog/logging.h' file not found [clang-diagnostic-error] ```cpp #include <glog/logging.h> ^ ``` ########## be/src/vec/columns/column_decimal.h: ########## @@ -269,14 +270,22 @@ for (U i = 0; i < s; ++i) res[i] = i; auto sort_end = res.end(); - if (limit && limit < s) sort_end = res.begin() + limit; - - if (reverse) - std::partial_sort(res.begin(), sort_end, res.end(), - [this](size_t a, size_t b) { return data[a] > data[b]; }); - else - std::partial_sort(res.begin(), sort_end, res.end(), - [this](size_t a, size_t b) { return data[a] < data[b]; }); + if (limit && limit < s / 8.0) { + sort_end = res.begin() + limit; + if (reverse) + std::partial_sort(res.begin(), sort_end, res.end(), + [this](size_t a, size_t b) { return data[a] > data[b]; }); + else + std::partial_sort(res.begin(), sort_end, res.end(), + [this](size_t a, size_t b) { return data[a] < data[b]; }); + } else { + if (reverse) Review Comment: warning: statement should be inside braces [readability-braces-around-statements] ```suggestion if (reverse) { ``` be/src/vec/columns/column_decimal.h:284: ```diff - else + } else ``` ########## be/src/vec/columns/column_string.cpp: ########## @@ -457,9 +457,8 @@ void ColumnStr<T>::get_permutation(bool reverse, size_t limit, int /*nan_directi res[i] = i; } - if (limit >= s) { - limit = 0; - } + // std::partial_sort need limit << s can get performance benefit + if (limit > (s / 8.0)) limit = 0; Review Comment: warning: statement should be inside braces [readability-braces-around-statements] ```suggestion if (limit > (s / 8.0)) { limit = 0; } ``` ########## be/src/vec/columns/column_vector.cpp: ########## @@ -236,7 +236,8 @@ void ColumnVector<T>::get_permutation(bool reverse, size_t limit, int nan_direct if (s == 0) return; - if (limit >= s) limit = 0; + // std::partial_sort need limit << s can get performance benefit + if (limit > (s / 8.0)) limit = 0; Review Comment: warning: statement should be inside braces [readability-braces-around-statements] ```suggestion if (limit > (s / 8.0)) { limit = 0; } ``` ########## be/src/vec/columns/column_decimal.h: ########## @@ -269,14 +270,22 @@ for (U i = 0; i < s; ++i) res[i] = i; auto sort_end = res.end(); - if (limit && limit < s) sort_end = res.begin() + limit; - - if (reverse) - std::partial_sort(res.begin(), sort_end, res.end(), - [this](size_t a, size_t b) { return data[a] > data[b]; }); - else - std::partial_sort(res.begin(), sort_end, res.end(), - [this](size_t a, size_t b) { return data[a] < data[b]; }); + if (limit && limit < s / 8.0) { + sort_end = res.begin() + limit; + if (reverse) + std::partial_sort(res.begin(), sort_end, res.end(), + [this](size_t a, size_t b) { return data[a] > data[b]; }); + else + std::partial_sort(res.begin(), sort_end, res.end(), + [this](size_t a, size_t b) { return data[a] < data[b]; }); + } else { + if (reverse) + pdqsort(res.begin(), res.end(), + [this](size_t a, size_t b) { return data[a] > data[b]; }); + else Review Comment: warning: statement should be inside braces [readability-braces-around-statements] ```suggestion else { ``` be/src/vec/columns/column_decimal.h:286: ```diff - [this](size_t a, size_t b) { return data[a] < data[b]; }); + [this](size_t a, size_t b) { return data[a] < data[b]; }); + } ``` -- 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