-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 hashOne functions in HivePartitionFunction #10079
Fix hashOne functions in HivePartitionFunction #10079
Conversation
✅ Deploy Preview for meta-velox canceled.
|
@Yuhta can you please review this? We need this to merge the Centos9 upgrade. Thanks! |
@@ -76,7 +76,9 @@ inline uint32_t hashOne<TypeKind::INTEGER>(const int32_t& value) { | |||
|
|||
template <> | |||
inline uint32_t hashOne<TypeKind::REAL>(const float& value) { | |||
return static_cast<uint32_t>(*reinterpret_cast<const int32_t*>(&value)); | |||
uint32_t ret; | |||
memcpy(&ret, &value, sizeof ret); |
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.
Can you just fix the signature of hashOne
to pass by value?
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.
std::memcpy
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.
I believe just fixing the signature is enough without the std::memcpy
. This should not have any strict aliasing issues.
801933d
to
5f1796f
Compare
@kevinwilfong has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@kevinwilfong merged this pull request in 1c0df40. |
Conbench analyzed the 1 benchmark run on commit There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Summary: Pass by value to avoid strict aliasing issues for REAL and DOUBLE types. We are seeing the HivePartitionFunctionTest failing with GCC12 here facebookincubator#9903 Pull Request resolved: facebookincubator#10079 Reviewed By: Yuhta Differential Revision: D58294082 Pulled By: kevinwilfong fbshipit-source-id: 765af472a35d1f8f2b619d5c58ee4399a8359ee2
Pass by value to avoid strict aliasing issues for REAL and DOUBLE types.
We are seeing the HivePartitionFunctionTest failing with GCC12 here #9903