-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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] Add default hash func template for phmap #49736
Conversation
static_assert(lt_is_largeint<LT> || lt_is_fixedlength<LT> || lt_is_string<LT>); | ||
|
||
return _array_intersect<phmap::flat_hash_set<CppTypeWithOverlapTimes, CppTypeWithOverlapTimesHash<LT>, | ||
CppTypeWithOverlapTimesEqual>>(columns); | ||
} | ||
|
||
private: |
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.
The most risky bug in this code is:
Missing condition for lt_is_decimal128
in the static assertion check within the process function of the _array_intersect
implementation.
You can modify the code like this:
static_assert(lt_is_largeint<LT> || lt_is_fixedlength<LT> || lt_is_string<LT> || lt_is_decimal128<LT>);
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.
lt_is_decimal128 is not supported here
|| lt_is_string<LT> || lt_is_binary<LT>; | ||
} | ||
}; | ||
|
||
} // namespace starrocks |
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.
The most risky bug in this code is:
The function is_supported()
has an incorrect static assertion condition inside the operator()
. This could cause runtime errors for unsupported types.
You can modify the code like this:
template <LogicalType LT, PhmapSeed seed>
struct PhmapDefaultHashFunc {
std::size_t operator()(const RunTimeCppType<LT>& value) const {
static_assert(is_supported(), "Unsupported LogicalType");
if constexpr (lt_is_largeint<LT> || lt_is_decimal128<LT>) {
return Hash128WithSeed<seed>()(value);
} else if constexpr (lt_is_fixedlength<LT>) {
return StdHashWithSeed<RunTimeCppType<LT>, seed>()(value);
} else if constexpr (lt_is_string<LT> || lt_is_binary<LT>) {
return SliceHashWithSeed<seed>()(value);
} else {
assert(false);
return 0; // Add a return statement to handle the false case
}
}
constexpr static bool is_supported() {
return lt_is_largeint<LT> || lt_is_decimal128<LT> || lt_is_fixedlength<LT>
|| lt_is_string<LT> || lt_is_binary<LT>;
}
};
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 suggestion, fixed.
https://github.com/Mergifyio rebase main |
✅ Branch has been successfully rebased |
https://github.com/Mergifyio rebase main |
Signed-off-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]>
✅ Branch has been successfully rebased |
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]❌ fail : 0 / 9 (00.00%) file detail
|
https://github.com/Mergifyio backport branch-3.3 |
✅ Backports have been created
|
Signed-off-by: trueeyu <[email protected]> (cherry picked from commit 809192e)
…#51523) Co-authored-by: trueeyu <[email protected]>
https://github.com/Mergifyio backport branch-3.2 |
✅ Backports have been created
|
Signed-off-by: trueeyu <[email protected]> (cherry picked from commit 809192e) # Conflicts: # test/sql/test_array_fn/R/test_array_fn
…#51526) Signed-off-by: trueeyu <[email protected]> Co-authored-by: trueeyu <[email protected]>
https://github.com/Mergifyio backport branch-3.1 |
✅ Backports have been created
|
Signed-off-by: trueeyu <[email protected]> (cherry picked from commit 809192e) # Conflicts: # be/src/exec/schema_scanner/schema_views_scanner.h # test/sql/test_array_fn/R/test_array_fn
…#51529) Signed-off-by: trueeyu <[email protected]> Co-authored-by: trueeyu <[email protected]>
Signed-off-by: trueeyu <[email protected]> Signed-off-by: zhiminr.ren <[email protected]>
Why I'm doing:
What I'm doing:
if
else
.Decimal128
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check:
Documentation PRs only:
If you are submitting a PR that adds or changes English documentation and have not
included Chinese documentation, then you can check the box to request GPT to translate the
English doc to Chinese. Please ensure to uncheck the Do not translate box if translation is needed.
The workflow will generate a new PR with the Chinese translation after this PR is merged.