From 82027176f1215704e9af4f85e29576e4f01ab0e7 Mon Sep 17 00:00:00 2001 From: BoloniniD Date: Sun, 9 Jan 2022 22:52:03 +0300 Subject: [PATCH] Move BLAKE3 tests away from fasttest + add USE_BLAKE3 key to CMakeLists --- contrib/CMakeLists.txt | 6 ++++-- docker/test/fasttest/Dockerfile | 2 -- docker/test/fasttest/run.sh | 1 - docker/test/stateless/Dockerfile | 4 +++- src/Functions/CMakeLists.txt | 5 ++++- src/Functions/FunctionsHashing.cpp | 2 ++ src/Functions/FunctionsHashing.h | 12 ++++++++---- src/Functions/config_functions.h.in | 1 + 8 files changed, 22 insertions(+), 11 deletions(-) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index c1ae4af9566..855ff0960a1 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -21,8 +21,6 @@ endif() set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL 1) -add_subdirectory (BLAKE3) - add_subdirectory (abseil-cpp-cmake) add_subdirectory (magic-enum-cmake) add_subdirectory (boost-cmake) @@ -40,6 +38,10 @@ add_subdirectory (replxx-cmake) add_subdirectory (unixodbc-cmake) add_subdirectory (nanodbc-cmake) +if (USE_BLAKE3) + add_subdirectory(BLAKE3) +endif() + if (USE_INTERNAL_CAPNP_LIBRARY AND NOT MISSING_INTERNAL_CAPNP_LIBRARY) add_subdirectory(capnproto-cmake) endif () diff --git a/docker/test/fasttest/Dockerfile b/docker/test/fasttest/Dockerfile index e97904a15af..6fa5b0aa9db 100644 --- a/docker/test/fasttest/Dockerfile +++ b/docker/test/fasttest/Dockerfile @@ -67,8 +67,6 @@ RUN apt-get update \ software-properties-common \ tzdata \ unixodbc \ - rustc \ - cargo \ --yes --no-install-recommends RUN pip3 install numpy scipy pandas Jinja2 diff --git a/docker/test/fasttest/run.sh b/docker/test/fasttest/run.sh index 2173f3cd77a..24168cea330 100755 --- a/docker/test/fasttest/run.sh +++ b/docker/test/fasttest/run.sh @@ -175,7 +175,6 @@ function clone_submodules contrib/NuRaft contrib/jemalloc contrib/replxx - contrib/BLAKE3 ) git submodule sync diff --git a/docker/test/stateless/Dockerfile b/docker/test/stateless/Dockerfile index 05d26924b15..11968ade40b 100644 --- a/docker/test/stateless/Dockerfile +++ b/docker/test/stateless/Dockerfile @@ -32,7 +32,9 @@ RUN apt-get update -y \ wget \ mysql-client=5.7* \ postgresql-client \ - sqlite3 + sqlite3 \ + rustc \ + cargo RUN pip3 install numpy scipy pandas Jinja2 diff --git a/src/Functions/CMakeLists.txt b/src/Functions/CMakeLists.txt index 8654c0266f7..07793940ced 100644 --- a/src/Functions/CMakeLists.txt +++ b/src/Functions/CMakeLists.txt @@ -23,7 +23,6 @@ target_link_libraries(clickhouse_functions dbms metrohash murmurhash - blake3 PRIVATE ${ZLIB_LIBRARIES} @@ -31,6 +30,10 @@ target_link_libraries(clickhouse_functions divide_impl ) +if (USE_BLAKE3) + target_link_libraries(clickhouse_functions PUBLIC blake3) +endif() + if (OPENSSL_CRYPTO_LIBRARY) target_link_libraries(clickhouse_functions PUBLIC ${OPENSSL_CRYPTO_LIBRARY}) endif() diff --git a/src/Functions/FunctionsHashing.cpp b/src/Functions/FunctionsHashing.cpp index 9e0a8b16580..a95f65b8e35 100644 --- a/src/Functions/FunctionsHashing.cpp +++ b/src/Functions/FunctionsHashing.cpp @@ -42,6 +42,8 @@ void registerFunctionsHashing(FunctionFactory & factory) factory.registerFunction(); #endif +#if USE_BLAKE3 factory.registerFunction(); +#endif } } diff --git a/src/Functions/FunctionsHashing.h b/src/Functions/FunctionsHashing.h index 03874ef79e6..7efdb044367 100644 --- a/src/Functions/FunctionsHashing.h +++ b/src/Functions/FunctionsHashing.h @@ -9,7 +9,9 @@ #include "config_functions.h" #include "config_core.h" -#include +#if USE_BLAKE3 +# include +#endif #include #include @@ -596,7 +598,7 @@ struct ImplXxHash64 #endif - +#if USE_BLAKE3 struct ImplBLAKE3 { static constexpr auto name = "BLAKE3"; @@ -610,6 +612,7 @@ struct ImplBLAKE3 std::memcpy(out_char_data, as_bytes_shim(&res), OUT_LEN); } }; +#endif template @@ -1435,6 +1438,7 @@ using FunctionHiveHash = FunctionAnyHash; using FunctionXxHash64 = FunctionAnyHash; #endif -using FunctionBLAKE3 = FunctionStringHashFixedString; - +#if USE_BLAKE3 + using FunctionBLAKE3 = FunctionStringHashFixedString; +#endif } diff --git a/src/Functions/config_functions.h.in b/src/Functions/config_functions.h.in index 3e1c862300c..1c0d76d3b10 100644 --- a/src/Functions/config_functions.h.in +++ b/src/Functions/config_functions.h.in @@ -8,3 +8,4 @@ #cmakedefine01 USE_H3 #cmakedefine01 USE_S2_GEOMETRY #cmakedefine01 USE_FASTOPS +#cmakedefine01 USE_BLAKE3