github-actions[bot] commented on code in PR #39089:
URL: https://github.com/apache/doris/pull/39089#discussion_r1708786019
##########
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:
##########
@@ -286,14 +287,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:301:
```diff
- else
+ } else
```
##########
be/src/vec/columns/column_string.cpp:
##########
@@ -493,9 +493,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:
##########
@@ -240,7 +240,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:
##########
@@ -286,14 +287,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:303:
```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: [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]