-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Refactor] Refactor build_hash_map and build_set to remove duplicated codes #13968
Conversation
48fb340
to
4df5c13
Compare
clang-tidy review says "All clean, LGTM! 👍" |
compute_not_founds and allocate_and_compute_state && compute_not_founds should be simpty to
|
template <typename Func> | ||
void compute_agg_prefetch(ColumnType* column, Buffer<AggDataPtr>* agg_states, Func&& allocate_func) { | ||
template <typename Func, bool allocate_and_compute_state, bool compute_not_founds> | ||
void compute_agg_prefetch(ColumnType* column, Buffer<AggDataPtr>* agg_states, Func&& allocate_func, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is single-purpose in the past, why now need to be multiple-purpose?
if we add another two single-purpose functions to support 1.allocate_and_compute_state && compute_not_founds and 2. compute_not_founds, is it be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is single-purpose in the past, why now need to be multiple-purpose?
- there are many duplicated codes for computing allocate_and_compute_state and compute_not_founds seperately;
- add this template parameter doesn't add any affects with old implements;
if we add another two single-purpose functions to support 1.allocate_and_compute_state && compute_not_founds and 2. compute_not_founds, is it be better?
- as above, we can use one function to express the purpose. use one function is better?
template <typename Func> | ||
void compute_agg_noprefetch(ColumnType* column, Buffer<AggDataPtr>* agg_states, Func&& allocate_func) { | ||
template <typename Func, bool allocate_and_compute_state, bool compute_not_founds> | ||
void compute_agg_noprefetch(ColumnType* column, Buffer<AggDataPtr>* agg_states, Func&& allocate_func, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above, explicitly, three different purposes split into single function would make the code more clear and succinct.
4df5c13
to
f201f71
Compare
Good~ fixed. |
clang-tidy review says "All clean, LGTM! 👍" |
run starrocks_admit_test |
5e71120
to
485464f
Compare
clang-tidy review says "All clean, LGTM! 👍" |
@@ -91,6 +91,28 @@ static_assert(sizeof(AggDataPtr) == sizeof(size_t)); | |||
this->hash_map.prefetch_hash(hash_values[__prefetch_index++]); \ | |||
} | |||
|
|||
#define AGG_HASH_MAP_COMMON_METHODS() \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unnecessary to add this macros.
we can add this to AggHashMapWithKey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good advise~
run starrocks_be_unittest |
clang-tidy review says "All clean, LGTM! 👍" |
run starrocks_admit_test |
a0f12db
to
c42fcca
Compare
clang-tidy review says "All clean, LGTM! 👍" |
run starrocks_admit_test |
clang-tidy review says "All clean, LGTM! 👍" |
run starrocks_admit_test |
run starrocks_admit_test |
clang-tidy review says "All clean, LGTM! 👍" |
run starrocks_admit_test |
clang-tidy review says "All clean, LGTM! 👍" |
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
What type of PR is this:
Which issues of this PR fixes :
Fixes #13880
build_hash_map_allocate_and_with_selection
method to be used in StreamMV later.Problem Summary(Required) :
Checklist:
Bugfix cherry-pick branch check: