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

Add gccHash function #4000

Merged
merged 2 commits into from
Jan 9, 2019
Merged

Conversation

sundy-li
Copy link
Contributor

@sundy-li sundy-li commented Jan 8, 2019

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Category (leave one):

  • New Feature

Short description (up to few sentences):

Add gccHash function, use the same hash seed as gcc

@alexey-milovidov
Copy link
Member

I'm interested, what is intended use case for it?

Because the hash function that is used in libstdc++ for std::unordered_map is an implementation specific detail that is not exposed in documentation. It may change in future versions, and in fact, it was already changed at least one time (in earlier versions of gcc, FNV1a is used for strings, now it is MurmurHash64A). Even more, if you replace libstdc++ to libc++ (that is valid option for both gcc and clang) or just compile with clang with default options on different platforms (Linux and FreeBSD), different standatd C++ library implementations will be used, that will lead to different hash functions used inside std::unordered_map.

We can add this hash function, but the name should be more specific (because there is no such thing as "gcc hash function").

@sundy-li
Copy link
Contributor Author

sundy-li commented Jan 8, 2019

The intention is that we used std::hash of libstdc++ to split the users for A/B testing experiment.
Well I agree with what you said, the purpose of this function may be very limited, and I can't come up with a proper name.

Since this hash function use MurmurHash64A , the difference with murmurHash2_64 is just the seed number. So will it be better to specify the seed number for some hash functions?

Eg.

murmurHash2_64('a')  ->  murmurHash2_64(0)('a'),  MurmurHash64A using the seed number 0
murmurHash2_64(0xc70f6907)('a')  ->  MurmurHash64A using the seed number 0xc70f6907

alexey-milovidov added a commit that referenced this pull request Jan 8, 2019
@alexey-milovidov
Copy link
Member

Let's name it gccMurmurHash :)

@alexey-milovidov alexey-milovidov merged commit 0648088 into ClickHouse:master Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants