mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
wyhash
This commit is contained in:
parent
2f38e7bc5c
commit
64989afa52
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -262,3 +262,6 @@
|
|||||||
[submodule "contrib/minizip-ng"]
|
[submodule "contrib/minizip-ng"]
|
||||||
path = contrib/minizip-ng
|
path = contrib/minizip-ng
|
||||||
url = https://github.com/zlib-ng/minizip-ng
|
url = https://github.com/zlib-ng/minizip-ng
|
||||||
|
[submodule "contrib/wyhash"]
|
||||||
|
path = contrib/wyhash
|
||||||
|
url = https://github.com/wangyi-fudan/wyhash.git
|
||||||
|
1
contrib/CMakeLists.txt
vendored
1
contrib/CMakeLists.txt
vendored
@ -94,6 +94,7 @@ if (ENABLE_FUZZING)
|
|||||||
add_contrib (libprotobuf-mutator-cmake libprotobuf-mutator)
|
add_contrib (libprotobuf-mutator-cmake libprotobuf-mutator)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_contrib (wyhash-cmake wyhash)
|
||||||
add_contrib (cityhash102)
|
add_contrib (cityhash102)
|
||||||
add_contrib (libfarmhash)
|
add_contrib (libfarmhash)
|
||||||
add_contrib (icu-cmake icu)
|
add_contrib (icu-cmake icu)
|
||||||
|
1
contrib/wyhash
vendored
Submodule
1
contrib/wyhash
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 991aa3dab624e50b066f7a02ccc9f6935cc740ec
|
7
contrib/wyhash-cmake/CMakeLists.txt
Normal file
7
contrib/wyhash-cmake/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
set (LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/wyhash)
|
||||||
|
|
||||||
|
add_library (wyhash "${LIBRARY_DIR}/wyhash.h")
|
||||||
|
|
||||||
|
target_include_directories(wyhash PUBLIC ${LIBRARY_DIR})
|
||||||
|
|
||||||
|
add_library (ch_contrib::wyhash ALIAS wyhash)
|
@ -13,6 +13,7 @@ add_library(clickhouse_functions ${clickhouse_functions_sources})
|
|||||||
|
|
||||||
target_link_libraries(clickhouse_functions
|
target_link_libraries(clickhouse_functions
|
||||||
PUBLIC
|
PUBLIC
|
||||||
|
ch_contrib::wyhash
|
||||||
ch_contrib::cityhash
|
ch_contrib::cityhash
|
||||||
ch_contrib::farmhash
|
ch_contrib::farmhash
|
||||||
clickhouse_dictionaries
|
clickhouse_dictionaries
|
||||||
|
@ -39,5 +39,7 @@ void registerFunctionsHashing(FunctionFactory & factory)
|
|||||||
|
|
||||||
factory.registerFunction<FunctionXxHash32>();
|
factory.registerFunction<FunctionXxHash32>();
|
||||||
factory.registerFunction<FunctionXxHash64>();
|
factory.registerFunction<FunctionXxHash64>();
|
||||||
|
|
||||||
|
factory.registerFunction<FunctionWyHash64>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <metrohash.h>
|
#include <metrohash.h>
|
||||||
#include <MurmurHash2.h>
|
#include <MurmurHash2.h>
|
||||||
#include <MurmurHash3.h>
|
#include <MurmurHash3.h>
|
||||||
|
#include <wyhash.h>
|
||||||
|
|
||||||
#include "config_functions.h"
|
#include "config_functions.h"
|
||||||
#include "config_core.h"
|
#include "config_core.h"
|
||||||
@ -1369,6 +1370,29 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ImplWyHash64
|
||||||
|
{
|
||||||
|
static constexpr auto name = "wyHash64";
|
||||||
|
using ReturnType = UInt64;
|
||||||
|
|
||||||
|
static UInt64 apply(const char * s, const size_t len)
|
||||||
|
{
|
||||||
|
return uint64_t hash=wyhash(s, len, 0, _wyp);
|
||||||
|
}
|
||||||
|
static UInt64 combineHashes(UInt64 h1, UInt64 h2)
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
UInt64 u64[2];
|
||||||
|
char chars[8];
|
||||||
|
};
|
||||||
|
u64[0] = h1;
|
||||||
|
u64[2] = h2;
|
||||||
|
return apply(chars, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr bool use_int_hash_for_pods = false;
|
||||||
|
};
|
||||||
|
|
||||||
struct NameIntHash32 { static constexpr auto name = "intHash32"; };
|
struct NameIntHash32 { static constexpr auto name = "intHash32"; };
|
||||||
struct NameIntHash64 { static constexpr auto name = "intHash64"; };
|
struct NameIntHash64 { static constexpr auto name = "intHash64"; };
|
||||||
@ -1406,4 +1430,6 @@ using FunctionHiveHash = FunctionAnyHash<HiveHashImpl>;
|
|||||||
using FunctionXxHash32 = FunctionAnyHash<ImplXxHash32>;
|
using FunctionXxHash32 = FunctionAnyHash<ImplXxHash32>;
|
||||||
using FunctionXxHash64 = FunctionAnyHash<ImplXxHash64>;
|
using FunctionXxHash64 = FunctionAnyHash<ImplXxHash64>;
|
||||||
|
|
||||||
|
using FunctionWyHash64 = FunctionAnyHash<ImplWyHash64>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user