Skip to content
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

Conversation

majetideepak
Copy link
Collaborator

@majetideepak majetideepak commented Jun 6, 2024

Pass by value to avoid strict aliasing issues for REAL and DOUBLE types.
We are seeing the HivePartitionFunctionTest failing with GCC12 here #9903

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 6, 2024
Copy link

netlify bot commented Jun 6, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 5f1796f
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/6661d8eb80d08a00088e3360

@majetideepak
Copy link
Collaborator Author

@Yuhta can you please review this? We need this to merge the Centos9 upgrade. Thanks!

@majetideepak majetideepak requested a review from mbasmanova June 6, 2024 04:36
@@ -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);
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::memcpy

Copy link
Collaborator Author

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.

@majetideepak majetideepak force-pushed the fix-hash-partition-functions branch from 801933d to 5f1796f Compare June 6, 2024 15:42
@majetideepak majetideepak changed the title Fix REAL and DOUBLE hash functions in HivePartitionFunction Fix hashOne functions in HivePartitionFunction Jun 6, 2024
@majetideepak majetideepak requested a review from Yuhta June 6, 2024 16:59
@Yuhta Yuhta added the ready-to-merge PR that have been reviewed and are ready for merging. PRs with this tag notify the Velox Meta oncall label Jun 6, 2024
@facebook-github-bot
Copy link
Contributor

@kevinwilfong has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@kevinwilfong merged this pull request in 1c0df40.

Copy link

Conbench analyzed the 1 benchmark run on commit 1c0df40f.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

deepashreeraghu pushed a commit to deepashreeraghu/velox that referenced this pull request Jun 13, 2024
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
@majetideepak majetideepak deleted the fix-hash-partition-functions branch October 5, 2024 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged ready-to-merge PR that have been reviewed and are ready for merging. PRs with this tag notify the Velox Meta oncall
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants