CLICKHOUSE-3762 Build fixes (#2488)

CONTRIB-254
This commit is contained in:
proller 2018-06-19 21:09:09 +03:00 committed by GitHub
parent 16565bf111
commit fbe7df73a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 181 additions and 163 deletions

View File

@ -1,10 +1,10 @@
function(generate_function_register FUNCTION_AREA)
foreach(FUNCTION IN LISTS ARGN)
configure_file (registerFunction.h.in register${FUNCTION}.h)
configure_file (registerFunction.cpp.in register${FUNCTION}.cpp)
configure_file (registerFunction.h.in ${FUNCTIONS_GENERATED_DIR}register${FUNCTION}.h)
configure_file (registerFunction.cpp.in ${FUNCTIONS_GENERATED_DIR}register${FUNCTION}.cpp)
set(REGISTER_HEADERS "${REGISTER_HEADERS}#include \"register${FUNCTION}.h\"\n")
set(REGISTER_FUNCTIONS "${REGISTER_FUNCTIONS} register${FUNCTION}(factory);\n")
endforeach()
configure_file (registerFunctions_area.cpp.in registerFunctions${FUNCTION_AREA}.cpp)
configure_file (registerFunctions_area.cpp.in ${FUNCTIONS_GENERATED_DIR}registerFunctions${FUNCTION_AREA}.cpp)
endfunction()

View File

@ -9,20 +9,12 @@ if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/googletest/googletest/CMakeList
endif ()
if (NOT USE_INTERNAL_GTEST_LIBRARY)
find_path (GTEST_INCLUDE_DIR NAMES /gtest/gtest.h PATHS ${GTEST_INCLUDE_PATHS})
find_path (GTEST_ROOT NAMES src/gtest-all.cc PATHS /usr/src/googletest/googletest /usr/src/gtest)
find_package (GTest)
endif ()
if (GTEST_INCLUDE_DIR AND GTEST_ROOT)
# googletest package have no lib
add_library(gtest ${GTEST_ROOT}/src/gtest-all.cc)
add_library(gtest_main ${GTEST_ROOT}/src/gtest_main.cc)
target_include_directories(gtest PRIVATE ${GTEST_ROOT})
target_link_libraries(gtest_main gtest)
set (GTEST_LIBRARY gtest_main)
elseif (NOT MISSING_INTERNAL_GTEST_LIBRARY)
if (NOT GTEST_INCLUDE_DIRS AND NOT MISSING_INTERNAL_GTEST_LIBRARY)
set (USE_INTERNAL_GTEST_LIBRARY 1)
set (GTEST_LIBRARY gtest_main)
set (GTEST_MAIN_LIBRARIES gtest_main)
endif ()
message (STATUS "Using gtest: ${GTEST_INCLUDE_DIR} : ${GTEST_LIBRARY}")
message (STATUS "Using gtest: ${GTEST_INCLUDE_DIRS} : ${GTEST_MAIN_LIBRARIES}")

View File

@ -1,6 +1,9 @@
include (CMakePushCheckState)
cmake_push_check_state ()
option (ENABLE_READLINE "Enable readline" 1)
if (ENABLE_READLINE)
set (READLINE_PATHS "/usr/local/opt/readline/lib")
# First try find custom lib for macos users (default lib without history support)
find_library (READLINE_LIB NAMES readline PATHS ${READLINE_PATHS} NO_DEFAULT_PATH)
@ -10,30 +13,31 @@ endif ()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.2)
find_library (TERMCAP_LIB NAMES termcap tinfo)
find_library (EDIT_LIB NAMES edit)
set(READLINE_INCLUDE_PATHS "/usr/local/opt/readline/include")
if (READLINE_LIB AND TERMCAP_LIB)
if (READLINE_LIB AND TERMCAP_LIBRARY)
find_path (READLINE_INCLUDE_DIR NAMES readline/readline.h PATHS ${READLINE_INCLUDE_PATHS} NO_DEFAULT_PATH)
if (NOT READLINE_INCLUDE_DIR)
find_path (READLINE_INCLUDE_DIR NAMES readline/readline.h PATHS ${READLINE_INCLUDE_PATHS})
endif ()
if (READLINE_INCLUDE_DIR AND READLINE_LIB)
set (USE_READLINE 1)
set (LINE_EDITING_LIBS ${READLINE_LIB} ${TERMCAP_LIB})
set (LINE_EDITING_LIBS ${READLINE_LIB} ${TERMCAP_LIBRARY})
message (STATUS "Using line editing libraries (readline): ${READLINE_INCLUDE_DIR} : ${LINE_EDITING_LIBS}")
endif ()
elseif (EDIT_LIB AND TERMCAP_LIB)
elseif (EDIT_LIB AND TERMCAP_LIBRARY)
find_library (CURSES_LIB NAMES curses)
find_path (READLINE_INCLUDE_DIR NAMES editline/readline.h PATHS ${READLINE_INCLUDE_PATHS})
if (CURSES_LIB AND READLINE_INCLUDE_DIR)
set (USE_LIBEDIT 1)
set (LINE_EDITING_LIBS ${EDIT_LIB} ${CURSES_LIB} ${TERMCAP_LIB})
set (LINE_EDITING_LIBS ${EDIT_LIB} ${CURSES_LIB} ${TERMCAP_LIBRARY})
message (STATUS "Using line editing libraries (edit): ${READLINE_INCLUDE_DIR} : ${LINE_EDITING_LIBS}")
endif ()
endif ()
endif ()
if (LINE_EDITING_LIBS AND READLINE_INCLUDE_DIR)
include (CheckCXXSourceRuns)

View File

@ -1,5 +1,5 @@
set(DIVIDE_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libdivide)
set(CITYHASH_CONTRIB_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/libcityhash/include)
set(CITYHASH_CONTRIB_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/cityhash102/include)
set(COMMON_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/libs/libcommon/include ${ClickHouse_BINARY_DIR}/libs/libcommon/include)
set(DBMS_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/dbms/src ${ClickHouse_BINARY_DIR}/dbms/src)
set(DOUBLE_CONVERSION_CONTRIB_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/double-conversion)

View File

@ -26,7 +26,7 @@ if (USE_INTERNAL_DOUBLE_CONVERSION_LIBRARY)
endif ()
if (USE_INTERNAL_CITYHASH_LIBRARY)
add_subdirectory (libcityhash)
add_subdirectory (cityhash102)
endif ()
if (USE_INTERNAL_FARMHASH_LIBRARY)

View File

@ -6,4 +6,4 @@ if (MSVC)
target_compile_definitions (farmhash PRIVATE FARMHASH_NO_BUILTIN_EXPECT=1)
endif ()
target_include_directories (farmhash PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories (farmhash PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -10,4 +10,4 @@ add_library(metrohash
src/metrohash128.cpp
${SOURCES_SSE42_ONLY})
target_include_directories(metrohash PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(metrohash PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)

View File

@ -101,7 +101,6 @@ endif ()
if (USE_EMBEDDED_COMPILER)
llvm_libs_all(REQUIRED_LLVM_LIBRARIES)
target_link_libraries (dbms ${REQUIRED_LLVM_LIBRARIES})
target_include_directories (dbms SYSTEM BEFORE PUBLIC ${LLVM_INCLUDE_DIRS})
endif ()
@ -242,7 +241,6 @@ target_include_directories (clickhouse_common_io SYSTEM BEFORE PUBLIC ${DOUBLE_C
target_include_directories (clickhouse_common_io BEFORE PRIVATE ${COMMON_INCLUDE_DIR})
add_subdirectory (programs)
add_subdirectory (tests)
if (ENABLE_TESTS)

View File

@ -36,6 +36,8 @@ if (CLICKHOUSE_SPLIT_BINARY)
list (APPEND CLICKHOUSE_ALL_TARGETS clickhouse-clang clickhouse-lld)
endif ()
set_target_properties(${CLICKHOUSE_ALL_TARGETS} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
add_custom_target (clickhouse-bundle ALL DEPENDS ${CLICKHOUSE_ALL_TARGETS})
add_custom_target (clickhouse ALL DEPENDS clickhouse-bundle)
else ()

View File

@ -10,7 +10,6 @@ if (CLICKHOUSE_SPLIT_BINARY)
add_executable (clickhouse-lld clickhouse-lld.cpp)
target_link_libraries (clickhouse-lld clickhouse-compiler-lib)
install (TARGETS clickhouse-clang clickhouse-lld RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
set_target_properties(clickhouse-clang clickhouse-lld PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
endif ()
endif ()

View File

@ -4,7 +4,6 @@ target_include_directories (clickhouse-client-lib SYSTEM PRIVATE ${READLINE_INCL
if (CLICKHOUSE_SPLIT_BINARY)
add_executable (clickhouse-client clickhouse-client.cpp)
set_target_properties(clickhouse-client PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
target_link_libraries (clickhouse-client clickhouse-client-lib)
endif ()

View File

@ -4,6 +4,5 @@ target_link_libraries (clickhouse-compressor-lib clickhouse_common_io ${Boost_PR
if (CLICKHOUSE_SPLIT_BINARY)
# Also in utils
add_executable (clickhouse-compressor clickhouse-compressor.cpp)
set_target_properties(clickhouse-compressor PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
target_link_libraries (clickhouse-compressor clickhouse-compressor-lib)
endif ()

View File

@ -3,6 +3,5 @@ target_link_libraries (clickhouse-local-lib clickhouse-server-lib clickhouse_fun
if (CLICKHOUSE_SPLIT_BINARY)
add_executable (clickhouse-local clickhouse-local.cpp)
set_target_properties(clickhouse-local PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
target_link_libraries (clickhouse-local clickhouse-local-lib)
endif ()

View File

@ -1,11 +1,18 @@
#include <common/config_common.h>
#include <Common/config.h>
#include <config_tools.h>
#include <iostream>
#include <vector>
#include <string>
#include <utility> /// pair
#if __has_include("config_tools.h")
#include "config_tools.h"
#endif
#if __has_include(<common/config_common.h>) /// "Arcadia" build system lacks configure files.
#include <common/config_common.h>
#endif
#if __has_include(<Common/config.h>)
#include <Common/config.h>
#endif
#if USE_TCMALLOC
#include <gperftools/malloc_extension.h>
#endif
@ -19,31 +26,31 @@
#include <Common/StringUtils/StringUtils.h>
/// Universal executable for various clickhouse applications
#if ENABLE_CLICKHOUSE_SERVER
#if ENABLE_CLICKHOUSE_SERVER || !defined(ENABLE_CLICKHOUSE_SERVER)
int mainEntryClickHouseServer(int argc, char ** argv);
#endif
#if ENABLE_CLICKHOUSE_CLIENT
#if ENABLE_CLICKHOUSE_CLIENT || !defined(ENABLE_CLICKHOUSE_CLIENT)
int mainEntryClickHouseClient(int argc, char ** argv);
#endif
#if ENABLE_CLICKHOUSE_LOCAL
#if ENABLE_CLICKHOUSE_LOCAL || !defined(ENABLE_CLICKHOUSE_LOCAL)
int mainEntryClickHouseLocal(int argc, char ** argv);
#endif
#if ENABLE_CLICKHOUSE_BENCHMARK
#if ENABLE_CLICKHOUSE_BENCHMARK || !defined(ENABLE_CLICKHOUSE_BENCHMARK)
int mainEntryClickHouseBenchmark(int argc, char ** argv);
#endif
#if ENABLE_CLICKHOUSE_PERFORMANCE
#if ENABLE_CLICKHOUSE_PERFORMANCE || !defined(ENABLE_CLICKHOUSE_PERFORMANCE)
int mainEntryClickHousePerformanceTest(int argc, char ** argv);
#endif
#if ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG
#if ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG || !defined(ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG)
int mainEntryClickHouseExtractFromConfig(int argc, char ** argv);
#endif
#if ENABLE_CLICKHOUSE_COMPRESSOR
#if ENABLE_CLICKHOUSE_COMPRESSOR || !defined(ENABLE_CLICKHOUSE_COMPRESSOR)
int mainEntryClickHouseCompressor(int argc, char ** argv);
#endif
#if ENABLE_CLICKHOUSE_FORMAT
#if ENABLE_CLICKHOUSE_FORMAT || !defined(ENABLE_CLICKHOUSE_FORMAT)
int mainEntryClickHouseFormat(int argc, char ** argv);
#endif
#if ENABLE_CLICKHOUSE_COPIER
#if ENABLE_CLICKHOUSE_COPIER || !defined(ENABLE_CLICKHOUSE_COPIER)
int mainEntryClickHouseClusterCopier(int argc, char ** argv);
#endif
#if ENABLE_CLICKHOUSE_OBFUSCATOR
@ -64,31 +71,31 @@ using MainFunc = int (*)(int, char**);
/// Add an item here to register new application
std::pair<const char *, MainFunc> clickhouse_applications[] =
{
#if ENABLE_CLICKHOUSE_LOCAL
#if ENABLE_CLICKHOUSE_LOCAL || !defined(ENABLE_CLICKHOUSE_LOCAL)
{"local", mainEntryClickHouseLocal},
#endif
#if ENABLE_CLICKHOUSE_CLIENT
#if ENABLE_CLICKHOUSE_CLIENT || !defined(ENABLE_CLICKHOUSE_CLIENT)
{"client", mainEntryClickHouseClient},
#endif
#if ENABLE_CLICKHOUSE_BENCHMARK
#if ENABLE_CLICKHOUSE_BENCHMARK || !defined(ENABLE_CLICKHOUSE_BENCHMARK)
{"benchmark", mainEntryClickHouseBenchmark},
#endif
#if ENABLE_CLICKHOUSE_SERVER
#if ENABLE_CLICKHOUSE_SERVER || !defined(ENABLE_CLICKHOUSE_SERVER)
{"server", mainEntryClickHouseServer},
#endif
#if ENABLE_CLICKHOUSE_PERFORMANCE
#if ENABLE_CLICKHOUSE_PERFORMANCE || !defined(ENABLE_CLICKHOUSE_PERFORMANCE)
{"performance-test", mainEntryClickHousePerformanceTest},
#endif
#if ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG
#if ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG || !defined(ENABLE_CLICKHOUSE_EXTRACT_FROM_CONFIG)
{"extract-from-config", mainEntryClickHouseExtractFromConfig},
#endif
#if ENABLE_CLICKHOUSE_COMPRESSOR
#if ENABLE_CLICKHOUSE_COMPRESSOR || !defined(ENABLE_CLICKHOUSE_COMPRESSOR)
{"compressor", mainEntryClickHouseCompressor},
#endif
#if ENABLE_CLICKHOUSE_FORMAT
#if ENABLE_CLICKHOUSE_FORMAT || !defined(ENABLE_CLICKHOUSE_FORMAT)
{"format", mainEntryClickHouseFormat},
#endif
#if ENABLE_CLICKHOUSE_COPIER
#if ENABLE_CLICKHOUSE_COPIER || !defined(ENABLE_CLICKHOUSE_COPIER)
{"copier", mainEntryClickHouseClusterCopier},
#endif
#if ENABLE_CLICKHOUSE_OBFUSCATOR

View File

@ -30,6 +30,7 @@
#include <ext/bit_cast.h>
#include <memory>
#include <cmath>
#include <optional>
#include <unistd.h>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options.hpp>

View File

@ -15,7 +15,6 @@ target_include_directories (clickhouse-server-lib PUBLIC ${ClickHouse_SOURCE_DIR
if (CLICKHOUSE_SPLIT_BINARY)
add_executable (clickhouse-server clickhouse-server.cpp)
set_target_properties(clickhouse-server PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..)
target_link_libraries (clickhouse-server clickhouse-server-lib)
install (TARGETS clickhouse-server ${CLICKHOUSE_ALL_TARGETS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
endif ()

View File

@ -45,17 +45,24 @@ public:
using Base = PoolBase<Connection>;
ConnectionPool(unsigned max_connections_,
const String & host_, UInt16 port_,
const String & host_,
UInt16 port_,
const String & default_database_,
const String & user_, const String & password_,
const String & user_,
const String & password_,
const ConnectionTimeouts & timeouts,
const String & client_name_ = "client",
Protocol::Compression compression_ = Protocol::Compression::Enable,
Protocol::Secure secure_ = Protocol::Secure::Disable)
: Base(max_connections_, &Logger::get("ConnectionPool (" + host_ + ":" + toString(port_) + ")")),
host(host_), port(port_), default_database(default_database_),
user(user_), password(password_),
client_name(client_name_), compression(compression_),
: Base(max_connections_,
&Logger::get("ConnectionPool (" + host_ + ":" + toString(port_) + ")")),
host(host_),
port(port_),
default_database(default_database_),
user(user_),
password(password_),
client_name(client_name_),
compression(compression_),
secure{secure_},
timeouts(timeouts)
{

View File

@ -147,8 +147,11 @@ public:
reinterpret_cast<UInt64 *>(out)[1] = v2 ^ v3;
}
void get128(UInt64 & lo, UInt64 & hi)
/// template for avoiding 'unsigned long long' vs 'unsigned long' problem on old poco in macos
template <typename T>
void get128(T & lo, T & hi)
{
static_assert(sizeof(T) == 8);
finalize();
lo = v0 ^ v1;
hi = v2 ^ v3;

View File

@ -9,10 +9,17 @@
#include <Common/StackTrace.h>
#include <common/demangle.h>
/// Arcadia compatibility DEVTOOLS-3976
#if defined(BACKTRACE_INCLUDE)
#include BACKTRACE_INCLUDE
#endif
#if !defined(BACKTRACE_FUNC)
#define BACKTRACE_FUNC backtrace
#endif
StackTrace::StackTrace()
{
frames_size = backtrace(frames, STACK_TRACE_MAX_DEPTH);
frames_size = BACKTRACE_FUNC(frames, STACK_TRACE_MAX_DEPTH);
}
std::string StackTrace::toString() const

View File

@ -3,10 +3,7 @@
#include <time.h>
#include <atomic>
#include <common/Types.h>
#ifdef __APPLE__
#include <common/apple_rt.h>
#endif
#include <port/clock.h>
namespace StopWatchDetail

View File

@ -6,6 +6,7 @@
#include <Common/Stopwatch.h>
#include <Common/Exception.h>
#include <IO/WriteHelpers.h>
#include <port/clock.h>
namespace DB

View File

@ -5,9 +5,7 @@
#include <Common/randomSeed.h>
#include <Common/SipHash.h>
#include <Core/Types.h>
#ifdef __APPLE__
#include <common/apple_rt.h>
#endif
#include <port/clock.h>
namespace DB

View File

@ -1,8 +1,6 @@
/// Taken from SMHasher.
#ifdef __APPLE__
#include <common/apple_rt.h>
#endif
#include "Random.h"
#include <port/clock.h>
Rand g_rand1(1);
Rand g_rand2(2);

View File

@ -4,19 +4,14 @@
#include <iostream>
#include <iomanip>
#include <Poco/Exception.h>
#include <Common/HashTable/Hash.h>
#include <Common/Stopwatch.h>
#include <Core/Defines.h>
#include "AvalancheTest.h" /// Taken from SMHasher.
#include <port/clock.h>
#ifdef __APPLE__
#include <common/apple_rt.h>
#endif
void setAffinity()
{
#if !defined(__APPLE__) && !defined(__FreeBSD__)

View File

@ -331,8 +331,8 @@ void NO_INLINE testForEachMapAndHash(const Key * data, size_t size)
testForEachHash<HashMap>(data, size, nothing);
testForEachHash<std::unordered_map>(data, size, nothing);
testForEachHash<google::dense_hash_map>(data, size, [](auto & map){ map.set_empty_key(-1); });
testForEachHash<google::sparse_hash_map>(data, size, nothing);
testForEachHash<GOOGLE_NAMESPACE::dense_hash_map>(data, size, [](auto & map){ map.set_empty_key(-1); });
testForEachHash<GOOGLE_NAMESPACE::sparse_hash_map>(data, size, nothing);
}

View File

@ -121,7 +121,7 @@ NamesAndTypesList NamesAndTypesList::filter(const Names & names) const
NamesAndTypesList NamesAndTypesList::addTypes(const Names & names) const
{
/// NOTE It's better to make a map in `IStorage` than to create it here every time again.
google::dense_hash_map<StringRef, const DataTypePtr *, StringRefHash> types;
GOOGLE_NAMESPACE::dense_hash_map<StringRef, const DataTypePtr *, StringRefHash> types;
types.set_empty_key(StringRef());
for (const NameAndTypePair & column : *this)

View File

@ -33,8 +33,8 @@ int main(int argc, char ** argv)
using Vec = std::vector<std::string>;
using Set = std::unordered_map<std::string, int>;
using RefsSet = std::unordered_map<StringRef, int, StringRefHash>;
using DenseSet = google::dense_hash_map<std::string, int>;
using RefsDenseSet = google::dense_hash_map<StringRef, int, StringRefHash>;
using DenseSet = GOOGLE_NAMESPACE::dense_hash_map<std::string, int>;
using RefsDenseSet = GOOGLE_NAMESPACE::dense_hash_map<StringRef, int, StringRefHash>;
using RefsHashMap = HashMap<StringRef, int, StringRefHash>;
Vec vec;

View File

@ -2,13 +2,8 @@
#include <vector>
#include <Common/Stopwatch.h>
#include <Core/Types.h>
#if __APPLE__
#include <common/apple_rt.h>
#endif
namespace DB
{

View File

@ -1,6 +1,8 @@
include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
include(${ClickHouse_SOURCE_DIR}/cmake/dbms_generate_function.cmake)
set (FUNCTIONS_GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated/)
generate_function_register(Arithmetic
FunctionPlus
FunctionMinus
@ -79,7 +81,9 @@ generate_function_register(Projection
add_headers_and_sources(clickhouse_functions .)
add_headers_and_sources(clickhouse_functions ./GatherUtils)
add_headers_and_sources(clickhouse_functions ./Conditional)
add_headers_and_sources(clickhouse_functions ${ClickHouse_BINARY_DIR}/dbms/src/Functions)
#add_headers_and_sources(clickhouse_functions ${ClickHouse_BINARY_DIR}/dbms/src/Functions)
add_headers_and_sources(clickhouse_functions ${FUNCTIONS_GENERATED_DIR})
list(REMOVE_ITEM clickhouse_functions_sources IFunction.cpp FunctionFactory.cpp FunctionHelpers.cpp)
list(REMOVE_ITEM clickhouse_functions_headers IFunction.h FunctionFactory.h FunctionHelpers.h)
@ -88,8 +92,6 @@ add_library(clickhouse_functions ${clickhouse_functions_sources})
target_link_libraries(clickhouse_functions PUBLIC dbms PRIVATE libconsistent-hashing ${FARMHASH_LIBRARIES} ${METROHASH_LIBRARIES})
target_include_directories (clickhouse_functions SYSTEM BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/libfarmhash)
target_include_directories (clickhouse_functions SYSTEM BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/libmetrohash/src)
target_include_directories (clickhouse_functions SYSTEM BEFORE PUBLIC ${DIVIDE_INCLUDE_DIR})
if (CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE" OR CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO" OR CMAKE_BUILD_TYPE_UC STREQUAL "MINSIZEREL")

View File

@ -806,13 +806,14 @@ struct ImplCityHash64
static auto Hash64(const char * s, const size_t len) { return CityHash_v1_0_2::CityHash64(s, len); }
};
// see farmhash.h for definition of NAMESPACE_FOR_HASH_FUNCTIONS
struct ImplFarmHash64
{
static constexpr auto name = "farmHash64";
using uint128_t = farmhash::uint128_t;
using uint128_t = NAMESPACE_FOR_HASH_FUNCTIONS::uint128_t;
static auto Hash128to64(const uint128_t & x) { return farmhash::Hash128to64(x); }
static auto Hash64(const char * s, const size_t len) { return farmhash::Hash64(s, len); }
static auto Hash128to64(const uint128_t & x) { return NAMESPACE_FOR_HASH_FUNCTIONS::Hash128to64(x); }
static auto Hash64(const char * s, const size_t len) { return NAMESPACE_FOR_HASH_FUNCTIONS::Hash64(s, len); }
};
struct ImplMetroHash64

View File

@ -8,10 +8,7 @@
#include <Functions/FunctionHelpers.h>
#include <Functions/FunctionsString.h>
#include <Functions/FunctionsStringArray.h>
#ifdef __APPLE__
#include <common/apple_memrchr.h>
#endif
#include <port/memrchr.h>
namespace DB

View File

@ -1,4 +1,4 @@
#include <Functions/register@FUNCTION@.h>
#include "register@FUNCTION@.h"
#include <Functions/FunctionFactory.h>
#include <Functions/Functions@FUNCTION_AREA@.h>

View File

@ -2,10 +2,10 @@
#include <memory>
#include <time.h>
#include <IO/createReadBufferFromFileBase.h>
#include <IO/CompressedReadBufferBase.h>
#include <IO/UncompressedCache.h>
#include <port/clock.h>
namespace DB

View File

@ -2,9 +2,9 @@
#include <IO/CompressedReadBufferBase.h>
#include <IO/ReadBufferFromFileBase.h>
#include <time.h>
#include <memory>
#include <port/clock.h>
namespace DB

View File

@ -6,10 +6,7 @@
#include <fcntl.h>
#include <IO/ReadBuffer.h>
#include <IO/BufferWithOwnMemory.h>
#ifdef __APPLE__
#include <common/apple_rt.h>
#endif
#include <port/clock.h>
namespace DB
{

View File

@ -23,7 +23,9 @@
#include <Common/MemoryTracker.h>
#include <Common/typeid_cast.h>
#include <common/demangle.h>
#if __has_include(<Interpreters/config_compile.h>)
#include <Interpreters/config_compile.h>
#endif
namespace ProfileEvents
@ -173,6 +175,9 @@ void Aggregator::compileIfPossible(AggregatedDataVariants::Type type)
compiled_if_possible = true;
#if !defined(INTERNAL_COMPILER_HEADERS)
throw Exception("Cannot compile code: Compiler disabled", ErrorCodes::CANNOT_COMPILE_CODE);
#else
std::string method_typename;
std::string method_typename_two_level;
@ -351,6 +356,7 @@ void Aggregator::compileIfPossible(AggregatedDataVariants::Type type)
/// If the result is already ready.
if (lib)
on_ready(lib);
#endif
}

View File

@ -10,7 +10,9 @@
#include <Databases/IDatabase.h>
#include <chrono>
#if __has_include(<common/config_common.h>)
#include <common/config_common.h>
#endif
#if USE_TCMALLOC
#include <gperftools/malloc_extension.h>

View File

@ -10,8 +10,10 @@
#include <IO/ReadBufferFromFileDescriptor.h>
#include <IO/WriteBufferFromFile.h>
#include <Interpreters/Compiler.h>
#include <Interpreters/config_compile.h>
#if __has_include(<Interpreters/config_compile.h>)
#include <Interpreters/config_compile.h>
#endif
namespace ProfileEvents
{
@ -25,6 +27,7 @@ namespace DB
namespace ErrorCodes
{
extern const int CANNOT_DLOPEN;
extern const int CANNOT_COMPILE_CODE;
}
Compiler::Compiler(const std::string & path_, size_t threads)
@ -202,6 +205,9 @@ void Compiler::compile(
{
ProfileEvents::increment(ProfileEvents::CompileAttempt);
#if !defined(INTERNAL_COMPILER_EXECUTABLE)
throw Exception("Cannot compile code: Compiler disabled", ErrorCodes::CANNOT_COMPILE_CODE);
#else
std::string prefix = path + "/" + file_name;
std::string cpp_file_path = prefix + ".cpp";
std::string so_file_path = prefix + ".so";
@ -250,7 +256,7 @@ void Compiler::compile(
" -isystem " << compiler_headers_root << "/usr/include"
#endif
" -I " << compiler_headers << "/dbms/src/"
" -I " << compiler_headers << "/contrib/libcityhash/include/"
" -I " << compiler_headers << "/contrib/cityhash102/include/"
" -I " << compiler_headers << "/contrib/libpcg-random/include/"
" -I " << compiler_headers << INTERNAL_DOUBLE_CONVERSION_INCLUDE_DIR
" -I " << compiler_headers << INTERNAL_Poco_Foundation_INCLUDE_DIR
@ -291,6 +297,8 @@ void Compiler::compile(
ProfileEvents::increment(ProfileEvents::CompileSuccess);
on_ready(lib);
#endif
}

View File

@ -1,42 +1,34 @@
#include <Interpreters/DDLWorker.h>
#include <Parsers/ASTAlterQuery.h>
#include <Parsers/ASTQueryWithOnCluster.h>
#include <Parsers/ParserQuery.h>
#include <Parsers/parseQuery.h>
#include <Parsers/queryToString.h>
#include <IO/WriteHelpers.h>
#include <IO/ReadHelpers.h>
#include <IO/Operators.h>
#include <IO/ReadBufferFromString.h>
#include <Storages/IStorage.h>
#include <DataStreams/IProfilingBlockInputStream.h>
#include <Interpreters/executeQuery.h>
#include <Interpreters/Cluster.h>
#include <Common/DNSResolver.h>
#include <Common/Macros.h>
#include <Common/getFQDNOrHostName.h>
#include <Common/setThreadName.h>
#include <Common/Stopwatch.h>
#include <Common/randomSeed.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypeArray.h>
#include <Columns/ColumnsNumber.h>
#include <Columns/ColumnString.h>
#include <Columns/ColumnArray.h>
#include <Common/ZooKeeper/ZooKeeper.h>
#include <Common/ZooKeeper/KeeperException.h>
#include <Common/ZooKeeper/Lock.h>
#include <Common/isLocalAddress.h>
#include <Poco/Timestamp.h>
#include <random>
#include <pcg_random.hpp>
#include <Poco/Net/NetException.h>

View File

@ -26,8 +26,6 @@ target_link_libraries (hash_map_string_2 dbms)
add_executable (hash_map_string_3 hash_map_string_3.cpp)
target_link_libraries (hash_map_string_3 dbms ${FARMHASH_LIBRARIES} ${METROHASH_LIBRARIES})
target_include_directories (hash_map_string_3 SYSTEM BEFORE PRIVATE ${ClickHouse_SOURCE_DIR}/contrib/libfarmhash)
target_include_directories (hash_map_string_3 SYSTEM BEFORE PRIVATE ${ClickHouse_SOURCE_DIR}/contrib/libmetrohash/src)
add_executable (hash_map_string_small hash_map_string_small.cpp)
target_include_directories (hash_map_string_small SYSTEM BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR})

View File

@ -264,8 +264,8 @@ int main(int argc, char ** argv)
{
Stopwatch watch;
google::dense_hash_map<Key, Value, DefaultHash<Key>> map;
google::dense_hash_map<Key, Value, DefaultHash<Key>>::iterator it;
GOOGLE_NAMESPACE::dense_hash_map<Key, Value, DefaultHash<Key>> map;
GOOGLE_NAMESPACE::dense_hash_map<Key, Value, DefaultHash<Key>>::iterator it;
map.set_empty_key(-1ULL);
for (size_t i = 0; i < n; ++i)
{
@ -285,8 +285,8 @@ int main(int argc, char ** argv)
{
Stopwatch watch;
google::sparse_hash_map<Key, Value, DefaultHash<Key>> map;
google::sparse_hash_map<Key, Value, DefaultHash<Key>>::iterator it;
GOOGLE_NAMESPACE::sparse_hash_map<Key, Value, DefaultHash<Key>> map;
GOOGLE_NAMESPACE::sparse_hash_map<Key, Value, DefaultHash<Key>>::iterator it;
for (size_t i = 0; i < n; ++i)
{
map.insert(std::make_pair(data[i], std::move(value)));

View File

@ -319,7 +319,7 @@ struct FarmHash64
{
size_t operator() (StringRef x) const
{
return farmhash::Hash64(x.data, x.size);
return NAMESPACE_FOR_HASH_FUNCTIONS::Hash64(x.data, x.size);
}
};

View File

@ -92,7 +92,7 @@ static std::string listOfColumns(const NamesAndTypesList & available_columns)
}
using NamesAndTypesMap = google::dense_hash_map<StringRef, const IDataType *, StringRefHash>;
using NamesAndTypesMap = GOOGLE_NAMESPACE::dense_hash_map<StringRef, const IDataType *, StringRefHash>;
static NamesAndTypesMap & getColumnsMapImpl(NamesAndTypesMap & res) { return res; }
@ -127,7 +127,7 @@ void ITableDeclaration::check(const Names & column_names) const
const auto columns_map = getColumnsMap(available_columns);
using UniqueStrings = google::dense_hash_set<StringRef, StringRefHash>;
using UniqueStrings = GOOGLE_NAMESPACE::dense_hash_set<StringRef, StringRefHash>;
UniqueStrings unique_names;
unique_names.set_empty_key(StringRef());
@ -150,7 +150,7 @@ void ITableDeclaration::check(const NamesAndTypesList & provided_columns) const
const NamesAndTypesList & available_columns = getColumns().getAllPhysical();
const auto columns_map = getColumnsMap(available_columns);
using UniqueStrings = google::dense_hash_set<StringRef, StringRefHash>;
using UniqueStrings = GOOGLE_NAMESPACE::dense_hash_set<StringRef, StringRefHash>;
UniqueStrings unique_names;
unique_names.set_empty_key(StringRef());
@ -183,7 +183,7 @@ void ITableDeclaration::check(const NamesAndTypesList & provided_columns, const
throw Exception("Empty list of columns queried. There are columns: " + listOfColumns(available_columns),
ErrorCodes::EMPTY_LIST_OF_COLUMNS_QUERIED);
using UniqueStrings = google::dense_hash_set<StringRef, StringRefHash>;
using UniqueStrings = GOOGLE_NAMESPACE::dense_hash_set<StringRef, StringRefHash>;
UniqueStrings unique_names;
unique_names.set_empty_key(StringRef());

View File

@ -5,6 +5,7 @@
#include <Storages/MergeTree/MergeTreeData.h>
#include <Storages/MergeTree/MergeTreeRangeReader.h>
#include <Core/NamesAndTypes.h>
#include <port/clock.h>
namespace DB

5
debian/rules vendored
View File

@ -69,8 +69,9 @@ override_dh_auto_configure:
dh_auto_configure -- $(CMAKE_FLAGS)
override_dh_auto_build:
# Fix fir ninja. Do not add -O.
cd $(BUILDDIR) && $(MAKE) -j$(THREADS_COUNT)
# Fix for ninja. Do not add -O.
#cd $(BUILDDIR) && $(MAKE) -j$(THREADS_COUNT)
cd $(BUILDDIR) && cmake --build . -- -j$(THREADS_COUNT)
override_dh_auto_test:
#TODO, use ENABLE_TESTS=1

View File

@ -1,21 +1,11 @@
if (APPLE)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND NOT "${CMAKE_SYSTEM_VERSION}" VERSION_LESS "16.0.0")
set (APPLE_SIERRA_OR_NEWER 1)
else ()
set (APPLE_SIERRA_OR_NEWER 0)
endif ()
endif ()
set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/include/common/config_common.h)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/include/common/config_common.h.in ${CONFIG_COMMON})
if (APPLE)
add_library (apple_rt
src/apple_rt.cpp
include/common/apple_rt.h
)
target_include_directories (apple_rt PUBLIC ${COMMON_INCLUDE_DIR})
endif ()
add_library (apple_rt
src/apple_rt.cpp
include/port/clock.h
)
target_include_directories (apple_rt PUBLIC ${COMMON_INCLUDE_DIR})
add_library (common ${SPLIT_SHARED}
src/DateLUT.cpp

View File

@ -2,7 +2,6 @@
// .h autogenerated by cmake !
#cmakedefine01 APPLE_SIERRA_OR_NEWER
#cmakedefine01 USE_TCMALLOC
#cmakedefine01 USE_JEMALLOC
#cmakedefine01 USE_READLINE

View File

@ -1,6 +1,8 @@
#pragma once
#if __has_include(<common/config_common.h>)
#include <common/config_common.h>
#endif
/// Different line editing libraries can be used depending on the environment.
#if USE_READLINE

View File

@ -6,11 +6,17 @@
* To use, include this file with -include compiler parameter.
*/
#include <time.h>
#ifdef __APPLE__
#include <common/config_common.h>
#include <AvailabilityMacros.h>
#ifndef MAC_OS_X_VERSION_10_12
#define MAC_OS_X_VERSION_10_12 101200
#endif
#define APPLE_HAVE_CLOCK_GETTIME MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
#if APPLE_SIERRA_OR_NEWER == 0
#if !APPLE_HAVE_CLOCK_GETTIME || !defined(CLOCK_MONOTONIC)
/**
* MacOS X doesn't support different clock sources
*
@ -18,14 +24,23 @@
* CLOCK_THREAD_CPUTIME_ID, because there is a way
* to implement it using in-kernel stats about threads
*/
#define CLOCK_MONOTONIC_COARSE 0
#define CLOCK_REALTIME 0
#if !defined(CLOCK_MONOTONIC)
#define CLOCK_MONOTONIC 0
#endif
#if !defined(CLOCK_REALTIME)
#define CLOCK_REALTIME CLOCK_MONOTONIC
#endif
#if !defined(CLOCK_THREAD_CPUTIME_ID)
#define CLOCK_THREAD_CPUTIME_ID 3
#endif
typedef int clockid_t;
int clock_gettime(int clk_id, struct timespec* t);
#else
#endif
#if !defined(CLOCK_MONOTONIC_COARSE)
#define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC
#endif

View File

@ -1,3 +1,10 @@
#pragma once
/// Arcadia compatibility DEVTOOLS-3976
#if defined(MEMRCHR_INCLUDE)
#include MEMRCHR_INCLUDE
#else
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
@ -25,7 +32,6 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#pragma once
#ifdef __APPLE__
#include <stddef.h>
@ -51,5 +57,5 @@ inline void *memrchr(const void *s, int c, size_t n) {
#if defined (__cplusplus)
}
#endif
#endif
#endif

View File

@ -5,9 +5,10 @@
* To use, include this file with -include compiler parameter.
*/
#include <common/apple_rt.h>
#include <port/clock.h>
#if APPLE_SIERRA_OR_NEWER == 0
#ifdef __APPLE__
#if !APPLE_HAVE_CLOCK_GETTIME
#include <time.h>
#include <stdlib.h>
@ -48,3 +49,4 @@ int clock_gettime(int clk_id, struct timespec* t) {
}
#endif
#endif

View File

@ -28,8 +28,8 @@ if (NOT USE_INTERNAL_UNWIND_LIBRARY)
unw_init_local2(&cursor, &context, UNW_INIT_SIGNAL_FRAME);
return 0;
}
" HAVE_UNWIND_INIT_LOCAL_SIGNAL)
if (NOT HAVE_UNWIND_INIT_LOCAL_SIGNAL)
" HAVE_UNW_INIT_LOCAL2)
if (NOT HAVE_UNW_INIT_LOCAL2)
set(UNWIND_LIBRARY "")
set(UNWIND_INCLUDE_DIR "")
endif ()

View File

@ -13,7 +13,7 @@ inc="-I. \
-I./contrib/libfarmhash \
-I./contrib/libmetrohash/src \
-I./contrib/double-conversion \
-I./contrib/libcityhash/include \
-I./contrib/cityhash102/include \
-I./contrib/zookeeper/src/c/include \
-I./contrib/zookeeper/src/c/generated \
-I./contrib/libtcmalloc/include \

View File

@ -5,7 +5,5 @@ target_link_libraries (iotest clickhouse_common_io)
add_executable (iotest_nonblock iotest_nonblock.cpp ${SRCS})
target_link_libraries (iotest_nonblock clickhouse_common_io)
if (NOT APPLE AND NOT ARCH_FREEBSD)
add_executable (iotest_aio iotest_aio.cpp ${SRCS})
target_link_libraries (iotest_aio clickhouse_common_io)
endif()
add_executable (iotest_aio iotest_aio.cpp ${SRCS})
target_link_libraries (iotest_aio clickhouse_common_io)

View File

@ -16,9 +16,7 @@
#include <Common/Stopwatch.h>
#include <IO/BufferWithOwnMemory.h>
#include <cstdlib>
#ifdef __APPLE__
#include <common/apple_rt.h>
#endif
#include <port/clock.h>
using DB::throwFromErrno;

View File

@ -1,3 +1,7 @@
#if __APPLE__ || __FreeBSD__
int main(int argc, char ** argv) { return 0; }
#else
#include <fcntl.h>
#include <port/unistd.h>
#include <stdlib.h>
@ -193,3 +197,4 @@ int main(int argc, char ** argv)
return 1;
}
}
#endif

View File

@ -19,9 +19,7 @@
#include <Common/randomSeed.h>
#include <common/ThreadPool.h>
#include <Common/Stopwatch.h>
#ifdef __APPLE__
#include <common/apple_rt.h>
#endif
#include <port/clock.h>
using DB::throwFromErrno;