diff --git a/contrib/capnproto-cmake/CMakeLists.txt b/contrib/capnproto-cmake/CMakeLists.txt index 9248573231b..b1387278c71 100644 --- a/contrib/capnproto-cmake/CMakeLists.txt +++ b/contrib/capnproto-cmake/CMakeLists.txt @@ -49,6 +49,9 @@ set (CAPNP_SRCS ) add_library(capnp ${CAPNP_SRCS}) +set_target_properties(capnp + PROPERTIES LINKER_LANGUAGE CXX + ) target_link_libraries(capnp PUBLIC kj) # The library has substandard code diff --git a/dbms/CMakeLists.txt b/dbms/CMakeLists.txt index 7d54e4a9873..995d9298252 100644 --- a/dbms/CMakeLists.txt +++ b/dbms/CMakeLists.txt @@ -1,3 +1,6 @@ +set(ConfigIncludePath ${CMAKE_CURRENT_BINARY_DIR}/includes/configs CACHE INTERNAL "Path to generated configuration files.") +include_directories(${ConfigIncludePath}) + if (USE_INCLUDE_WHAT_YOU_USE) set (CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_PATH}) endif () @@ -72,8 +75,83 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") endif () endif () elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") -endif() + # Add compiler options only to c++ compiler + function(add_cxx_compile_options option) + add_compile_options( + "$<$,CXX>:${option}>" + ) + endfunction() + # Warn about boolean expression compared with an integer value different from true/false + add_cxx_compile_options(-Wbool-compare) + # Warn whenever a pointer is cast such that the required alignment of the target is increased. + add_cxx_compile_options(-Wcast-align) + # Warn whenever a pointer is cast so as to remove a type qualifier from the target type. + add_cxx_compile_options(-Wcast-qual) + # Warn when deleting a pointer to incomplete type, which may cause undefined behavior at runtime + add_cxx_compile_options(-Wdelete-incomplete) + # Warn if a requested optimization pass is disabled. Code is too big or too complex + add_cxx_compile_options(-Wdisabled-optimization) + # Warn about duplicated conditions in an if-else-if chain + add_cxx_compile_options(-Wduplicated-cond) + # Warn about a comparison between values of different enumerated types + add_cxx_compile_options(-Wenum-compare) + # Warn about uninitialized variables that are initialized with themselves + add_cxx_compile_options(-Winit-self) + # Warn about logical not used on the left hand side operand of a comparison + add_cxx_compile_options(-Wlogical-not-parentheses) + # Warn about suspicious uses of logical operators in expressions + add_cxx_compile_options(-Wlogical-op) + # Warn if there exists a path from the function entry to a use of the variable that is uninitialized. + add_cxx_compile_options(-Wmaybe-uninitialized) + # Warn when the indentation of the code does not reflect the block structure + add_cxx_compile_options(-Wmisleading-indentation) + # Warn if a global function is defined without a previous declaration + add_cxx_compile_options(-Wmissing-declarations) + # Warn if a user-supplied include directory does not exist + # add_cxx_compile_options(-Wmissing-include-dirs) + # Obvious + add_cxx_compile_options(-Wnon-virtual-dtor) + # Obvious + add_cxx_compile_options(-Wno-return-local-addr) + # Obvious + add_cxx_compile_options(-Wnull-dereference) + # Obvious + add_cxx_compile_options(-Wodr) + # Obvious + add_cxx_compile_options(-Wold-style-cast) + # Warn when a function declaration hides virtual functions from a base class + # add_cxx_compile_options(-Woverloaded-virtual) + # Warn about placement new expressions with undefined behavior + add_cxx_compile_options(-Wplacement-new=2) + # Warn about anything that depends on the “size of” a function type or of void + add_cxx_compile_options(-Wpointer-arith) + # Warn if anything is declared more than once in the same scope + add_cxx_compile_options(-Wredundant-decls) + # Member initialization reordering + add_cxx_compile_options(-Wreorder) + # Obvious + add_cxx_compile_options(-Wshadow) + # Warn if left shifting a negative value + add_cxx_compile_options(-Wshift-negative-value) + # Warn about a definition of an unsized deallocation function + add_cxx_compile_options(-Wsized-deallocation) + # Warn when the sizeof operator is applied to a parameter that is declared as an array in a function definition + add_cxx_compile_options(-Wsizeof-array-argument) + # Warn for suspicious length parameters to certain string and memory built-in functions if the argument uses sizeof + add_cxx_compile_options(-Wsizeof-pointer-memaccess) + # Warn about overriding virtual functions that are not marked with the override keyword + # add_cxx_compile_options(-Wsuggest-override) + # Warn whenever a switch statement has an index of boolean type and the case values are outside the range of a boolean type + add_cxx_compile_options(-Wswitch-bool) + # Warn if a self-comparison always evaluates to true or false + add_cxx_compile_options(-Wtautological-compare) + # Warn about trampolines generated for pointers to nested functions + add_cxx_compile_options(-Wtrampolines) + # Obvious + add_cxx_compile_options(-Wunused) + # Warn if vector operation is not implemented via SIMD capabilities of the architecture + add_cxx_compile_options(-Wvector-operation-performance) +endif () if (USE_DEBUG_HELPERS) set (INCLUDE_DEBUG_HELPERS "-I${ClickHouse_SOURCE_DIR}/libs/libcommon/include -include ${ClickHouse_SOURCE_DIR}/dbms/src/Core/iostream_debug_helpers.h") diff --git a/dbms/programs/CMakeLists.txt b/dbms/programs/CMakeLists.txt index 138321360f3..48fb30a8058 100644 --- a/dbms/programs/CMakeLists.txt +++ b/dbms/programs/CMakeLists.txt @@ -19,7 +19,7 @@ if(NOT (MAKE_STATIC_LIBRARIES OR SPLIT_SHARED_LIBRARIES)) set(CLICKHOUSE_ONE_SHARED 1) endif() -configure_file (config_tools.h.in ${CMAKE_CURRENT_BINARY_DIR}/config_tools.h) +configure_file (config_tools.h.in ${ConfigIncludePath}/config_tools.h) macro(clickhouse_target_link_split_lib target name) diff --git a/dbms/programs/benchmark/Benchmark.cpp b/dbms/programs/benchmark/Benchmark.cpp index c0b2eccfd29..6f08475f934 100644 --- a/dbms/programs/benchmark/Benchmark.cpp +++ b/dbms/programs/benchmark/Benchmark.cpp @@ -504,6 +504,7 @@ public: #ifndef __clang__ #pragma GCC optimize("-fno-var-tracking-assignments") #endif +#pragma GCC diagnostic ignored "-Wmissing-declarations" int mainEntryClickHouseBenchmark(int argc, char ** argv) { diff --git a/dbms/programs/benchmark/clickhouse-benchmark.cpp b/dbms/programs/benchmark/clickhouse-benchmark.cpp index 96715419b1b..6bcb6e19b88 100644 --- a/dbms/programs/benchmark/clickhouse-benchmark.cpp +++ b/dbms/programs/benchmark/clickhouse-benchmark.cpp @@ -1,2 +1,2 @@ -int mainEntryClickHouseBenchmark(int argc, char ** argv); +extern int mainEntryClickHouseBenchmark(int argc, char ** argv); int main(int argc_, char ** argv_) { return mainEntryClickHouseBenchmark(argc_, argv_); } diff --git a/dbms/programs/client/CMakeLists.txt b/dbms/programs/client/CMakeLists.txt index c9996de1e9b..dc5cf787adf 100644 --- a/dbms/programs/client/CMakeLists.txt +++ b/dbms/programs/client/CMakeLists.txt @@ -12,7 +12,7 @@ endif () include(CheckSymbolExists) check_symbol_exists(readpassphrase readpassphrase.h HAVE_READPASSPHRASE) -configure_file(config_client.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/config_client.h) +configure_file(config_client.h.in ${ConfigIncludePath}/config_client.h) if(NOT HAVE_READPASSPHRASE) add_subdirectory(readpassphrase) diff --git a/dbms/programs/client/Client.cpp b/dbms/programs/client/Client.cpp index f6d50b22db8..4b9cee29ff6 100644 --- a/dbms/programs/client/Client.cpp +++ b/dbms/programs/client/Client.cpp @@ -1942,6 +1942,9 @@ public: } +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wmissing-declarations" + int mainEntryClickHouseClient(int argc, char ** argv) { try diff --git a/dbms/programs/client/readpassphrase/CMakeLists.txt b/dbms/programs/client/readpassphrase/CMakeLists.txt index b7ff6db31ee..94ed9f54bdb 100644 --- a/dbms/programs/client/readpassphrase/CMakeLists.txt +++ b/dbms/programs/client/readpassphrase/CMakeLists.txt @@ -6,5 +6,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result -Wno-reserved-id-macro") configure_file(includes.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/includes.h) add_library(readpassphrase ${CMAKE_CURRENT_SOURCE_DIR}/readpassphrase.c) +set_target_properties(readpassphrase + PROPERTIES LINKER_LANGUAGE C + ) # . to allow #include target_include_directories(readpassphrase PUBLIC . ${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/../include) diff --git a/dbms/programs/compressor/Compressor.cpp b/dbms/programs/compressor/Compressor.cpp index a073a79b416..9c4699b610a 100644 --- a/dbms/programs/compressor/Compressor.cpp +++ b/dbms/programs/compressor/Compressor.cpp @@ -57,6 +57,8 @@ void checkAndWriteHeader(DB::ReadBuffer & in, DB::WriteBuffer & out) } +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wmissing-declarations" int mainEntryClickHouseCompressor(int argc, char ** argv) { diff --git a/dbms/programs/copier/ClusterCopier.cpp b/dbms/programs/copier/ClusterCopier.cpp index 59c4466e60e..a095e99fe22 100644 --- a/dbms/programs/copier/ClusterCopier.cpp +++ b/dbms/programs/copier/ClusterCopier.cpp @@ -2513,6 +2513,8 @@ int ClusterCopierApp::main(const std::vector &) } +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wmissing-declarations" int mainEntryClickHouseClusterCopier(int argc, char ** argv) { diff --git a/dbms/programs/extract-from-config/ExtractFromConfig.cpp b/dbms/programs/extract-from-config/ExtractFromConfig.cpp index af9550e4547..dff7e81c430 100644 --- a/dbms/programs/extract-from-config/ExtractFromConfig.cpp +++ b/dbms/programs/extract-from-config/ExtractFromConfig.cpp @@ -44,6 +44,9 @@ static std::string extractFromConfig( return configuration->getString(key); } +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wmissing-declarations" + int mainEntryClickHouseExtractFromConfig(int argc, char ** argv) { bool print_stacktrace = false; diff --git a/dbms/programs/format/Format.cpp b/dbms/programs/format/Format.cpp index ff415d88e1b..f826d6394bc 100644 --- a/dbms/programs/format/Format.cpp +++ b/dbms/programs/format/Format.cpp @@ -8,6 +8,9 @@ #include #include +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wmissing-declarations" + int mainEntryClickHouseFormat(int argc, char ** argv) { using namespace DB; diff --git a/dbms/programs/local/LocalServer.cpp b/dbms/programs/local/LocalServer.cpp index 90bf1f5a90a..f84d9d4b6ac 100644 --- a/dbms/programs/local/LocalServer.cpp +++ b/dbms/programs/local/LocalServer.cpp @@ -499,6 +499,9 @@ void LocalServer::applyCmdOptions() } +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wmissing-declarations" + int mainEntryClickHouseLocal(int argc, char ** argv) { DB::LocalServer app; diff --git a/dbms/programs/obfuscator/Obfuscator.cpp b/dbms/programs/obfuscator/Obfuscator.cpp index 2fde579f3c2..f267acc1f01 100644 --- a/dbms/programs/obfuscator/Obfuscator.cpp +++ b/dbms/programs/obfuscator/Obfuscator.cpp @@ -123,14 +123,14 @@ UInt64 hash(Ts... xs) } -UInt64 maskBits(UInt64 x, size_t num_bits) +static UInt64 maskBits(UInt64 x, size_t num_bits) { return x & ((1ULL << num_bits) - 1); } /// Apply Feistel network round to least significant num_bits part of x. -UInt64 feistelRound(UInt64 x, size_t num_bits, UInt64 seed, size_t round) +static UInt64 feistelRound(UInt64 x, size_t num_bits, UInt64 seed, size_t round) { size_t num_bits_left_half = num_bits / 2; size_t num_bits_right_half = num_bits - num_bits_left_half; @@ -146,7 +146,7 @@ UInt64 feistelRound(UInt64 x, size_t num_bits, UInt64 seed, size_t round) /// Apply Feistel network with num_rounds to least significant num_bits part of x. -UInt64 feistelNetwork(UInt64 x, size_t num_bits, UInt64 seed, size_t num_rounds = 4) +static UInt64 feistelNetwork(UInt64 x, size_t num_bits, UInt64 seed, size_t num_rounds = 4) { UInt64 bits = maskBits(x, num_bits); for (size_t i = 0; i < num_rounds; ++i) @@ -156,7 +156,7 @@ UInt64 feistelNetwork(UInt64 x, size_t num_bits, UInt64 seed, size_t num_rounds /// Pseudorandom permutation within set of numbers with the same log2(x). -UInt64 transform(UInt64 x, UInt64 seed) +static UInt64 transform(UInt64 x, UInt64 seed) { /// Keep 0 and 1 as is. if (x == 0 || x == 1) @@ -199,7 +199,7 @@ public: /// Keep sign and apply pseudorandom permutation after converting to unsigned as above. -Int64 transformSigned(Int64 x, UInt64 seed) +static Int64 transformSigned(Int64 x, UInt64 seed) { if (x >= 0) return transform(x, seed); @@ -298,7 +298,7 @@ public: /// Pseudorandom function, but keep word characters as word characters. -void transformFixedString(const UInt8 * src, UInt8 * dst, size_t size, UInt64 seed) +static void transformFixedString(const UInt8 * src, UInt8 * dst, size_t size, UInt64 seed) { { SipHash hash; @@ -943,6 +943,8 @@ public: } +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wmissing-declarations" int mainEntryClickHouseObfuscator(int argc, char ** argv) try diff --git a/dbms/programs/odbc-bridge/MainHandler.cpp b/dbms/programs/odbc-bridge/MainHandler.cpp index 162e93dc3db..73480bf884f 100644 --- a/dbms/programs/odbc-bridge/MainHandler.cpp +++ b/dbms/programs/odbc-bridge/MainHandler.cpp @@ -35,7 +35,7 @@ using PocoSessionPoolConstructor = std::function createAndCheckResizePocoSessionPool(PocoSessionPoolConstructor pool_constr) +static std::shared_ptr createAndCheckResizePocoSessionPool(PocoSessionPoolConstructor pool_constr) { static std::mutex mutex; diff --git a/dbms/programs/odbc-bridge/ODBCBridge.cpp b/dbms/programs/odbc-bridge/ODBCBridge.cpp index c84452b691e..453ee499784 100644 --- a/dbms/programs/odbc-bridge/ODBCBridge.cpp +++ b/dbms/programs/odbc-bridge/ODBCBridge.cpp @@ -193,6 +193,7 @@ int ODBCBridge::main(const std::vector & /*args*/) } } +#pragma GCC diagnostic ignored "-Wmissing-declarations" int mainEntryClickHouseODBCBridge(int argc, char ** argv) { DB::ODBCBridge app; diff --git a/dbms/programs/performance-test/PerformanceTestSuite.cpp b/dbms/programs/performance-test/PerformanceTestSuite.cpp index eaa4e24cde9..594f04a3906 100644 --- a/dbms/programs/performance-test/PerformanceTestSuite.cpp +++ b/dbms/programs/performance-test/PerformanceTestSuite.cpp @@ -294,7 +294,7 @@ static std::vector getInputFiles(const po::variables_map & options, return input_files; } -std::unordered_map> getTestQueryIndexes(const po::basic_parsed_options & parsed_opts) +static std::unordered_map> getTestQueryIndexes(const po::basic_parsed_options & parsed_opts) { std::unordered_map> result; const auto & options = parsed_opts.options; @@ -319,6 +319,9 @@ std::unordered_map> getTestQueryIndexes(co return result; } +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wmissing-declarations" + int mainEntryClickHousePerformanceTest(int argc, char ** argv) try { diff --git a/dbms/programs/performance-test/applySubstitutions.cpp b/dbms/programs/performance-test/applySubstitutions.cpp index b8c1d4b6059..a18e066fb01 100644 --- a/dbms/programs/performance-test/applySubstitutions.cpp +++ b/dbms/programs/performance-test/applySubstitutions.cpp @@ -30,7 +30,7 @@ void constructSubstitutions(ConfigurationPtr & substitutions_view, StringToVecto /// Recursive method which goes through all substitution blocks in xml /// and replaces property {names} by their values -void runThroughAllOptionsAndPush(StringToVector::iterator substitutions_left, +static void runThroughAllOptionsAndPush(StringToVector::iterator substitutions_left, StringToVector::iterator substitutions_right, const std::string & template_query, Strings & out_queries) diff --git a/dbms/programs/server/Server.cpp b/dbms/programs/server/Server.cpp index 84312fb211a..dcca3735255 100644 --- a/dbms/programs/server/Server.cpp +++ b/dbms/programs/server/Server.cpp @@ -974,6 +974,9 @@ int Server::main(const std::vector & /*args*/) } } +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wmissing-declarations" + int mainEntryClickHouseServer(int argc, char ** argv) { DB::Server app; diff --git a/dbms/src/AggregateFunctions/AggregateFunctionArray.cpp b/dbms/src/AggregateFunctions/AggregateFunctionArray.cpp index 995759d0082..5d8c164c6e6 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionArray.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionArray.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB { diff --git a/dbms/src/AggregateFunctions/AggregateFunctionAvg.cpp b/dbms/src/AggregateFunctions/AggregateFunctionAvg.cpp index 1886637629f..a4c09b1e2c6 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionAvg.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionAvg.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB { diff --git a/dbms/src/AggregateFunctions/AggregateFunctionBitwise.cpp b/dbms/src/AggregateFunctions/AggregateFunctionBitwise.cpp index e92e1917bd5..618233011b7 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionBitwise.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionBitwise.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionBoundingRatio.cpp b/dbms/src/AggregateFunctions/AggregateFunctionBoundingRatio.cpp index 88dc5bda29d..e338b060b12 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionBoundingRatio.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionBoundingRatio.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionCategoricalInformationValue.cpp b/dbms/src/AggregateFunctions/AggregateFunctionCategoricalInformationValue.cpp index bd8d90c7d72..d1022fd859f 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionCategoricalInformationValue.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionCategoricalInformationValue.cpp @@ -3,6 +3,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionCombinatorFactory.cpp b/dbms/src/AggregateFunctions/AggregateFunctionCombinatorFactory.cpp index 02874927061..a20d355bb2f 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionCombinatorFactory.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionCombinatorFactory.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionCount.cpp b/dbms/src/AggregateFunctions/AggregateFunctionCount.cpp index f650a178808..6c22fec87a2 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionCount.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionCount.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionEntropy.cpp b/dbms/src/AggregateFunctions/AggregateFunctionEntropy.cpp index 7ea15e11b72..e9db84949f7 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionEntropy.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionEntropy.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp b/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp index 0c9a3b1ad63..aeb4fb6db96 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionFactory.cpp @@ -16,6 +16,7 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionForEach.cpp b/dbms/src/AggregateFunctions/AggregateFunctionForEach.cpp index aa5d78b0a95..e8f4c7ec357 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionForEach.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionForEach.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionGroupArray.cpp b/dbms/src/AggregateFunctions/AggregateFunctionGroupArray.cpp index 1efb1a82475..d11be31a4da 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionGroupArray.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionGroupArray.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionGroupArrayInsertAt.cpp b/dbms/src/AggregateFunctions/AggregateFunctionGroupArrayInsertAt.cpp index ea42c129dea..3bd0b80128a 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionGroupArrayInsertAt.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionGroupArrayInsertAt.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionGroupArrayMoving.cpp b/dbms/src/AggregateFunctions/AggregateFunctionGroupArrayMoving.cpp index 700ffa299cf..1564e28667f 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionGroupArrayMoving.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionGroupArrayMoving.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionGroupBitmap.cpp b/dbms/src/AggregateFunctions/AggregateFunctionGroupBitmap.cpp index a420ff92f16..9ea81c6aeb4 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionGroupBitmap.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionGroupBitmap.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" // TODO include this last because of a broken roaring header. See the comment // inside. diff --git a/dbms/src/AggregateFunctions/AggregateFunctionGroupBitmapData.h b/dbms/src/AggregateFunctions/AggregateFunctionGroupBitmapData.h index 6d4cc8a3af5..1a8b79f203f 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionGroupBitmapData.h +++ b/dbms/src/AggregateFunctions/AggregateFunctionGroupBitmapData.h @@ -11,7 +11,10 @@ // garbage that breaks the build (e.g. it changes _POSIX_C_SOURCE). // TODO: find out what it is. On github, they have proper inteface headers like // this one: https://github.com/RoaringBitmap/CRoaring/blob/master/include/roaring/roaring.h +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wold-style-cast" #include +#pragma GCC diagnostic pop namespace DB { @@ -602,7 +605,7 @@ private: /// To read and write the DB Buffer directly, migrate code from CRoaring void db_roaring_bitmap_add_many(DB::ReadBuffer & dbBuf, roaring_bitmap_t * r, size_t n_args) { - void * container = NULL; // hold value of last container touched + void * container = nullptr; // hold value of last container touched uint8_t typecode = 0; // typecode of last container touched uint32_t prev = 0; // previous valued inserted size_t i = 0; // index of value @@ -647,7 +650,7 @@ private: size_t ctr = 0; for (Int32 i = 0; i < ra->size; ++i) { - Int32 num_added = db_container_to_uint32_array(dbBuf, ra->containers[i], ra->typecodes[i], ((UInt32)ra->keys[i]) << 16); + Int32 num_added = db_container_to_uint32_array(dbBuf, ra->containers[i], ra->typecodes[i], (static_cast(ra->keys[i])) << 16); ctr += num_added; } } @@ -658,18 +661,18 @@ private: switch (typecode) { case BITSET_CONTAINER_TYPE_CODE: - return db_bitset_container_to_uint32_array(dbBuf, (const bitset_container_t *)container, base); + return db_bitset_container_to_uint32_array(dbBuf, static_cast(container), base); case ARRAY_CONTAINER_TYPE_CODE: - return db_array_container_to_uint32_array(dbBuf, (const array_container_t *)container, base); + return db_array_container_to_uint32_array(dbBuf, static_cast(container), base); case RUN_CONTAINER_TYPE_CODE: - return db_run_container_to_uint32_array(dbBuf, (const run_container_t *)container, base); + return db_run_container_to_uint32_array(dbBuf, static_cast(container), base); } return 0; } UInt32 db_bitset_container_to_uint32_array(DB::WriteBuffer & dbBuf, const bitset_container_t * cont, UInt32 base) const { - return (UInt32)db_bitset_extract_setbits(dbBuf, cont->array, BITSET_CONTAINER_SIZE_IN_WORDS, base); + return static_cast(db_bitset_extract_setbits(dbBuf, cont->array, BITSET_CONTAINER_SIZE_IN_WORDS, base)); } size_t db_bitset_extract_setbits(DB::WriteBuffer & dbBuf, UInt64 * bitset, size_t length, UInt32 base) const diff --git a/dbms/src/AggregateFunctions/AggregateFunctionGroupUniqArray.cpp b/dbms/src/AggregateFunctions/AggregateFunctionGroupUniqArray.cpp index a08a485ea1c..210ddee3393 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionGroupUniqArray.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionGroupUniqArray.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionHistogram.cpp b/dbms/src/AggregateFunctions/AggregateFunctionHistogram.cpp index 384298b16a8..1b96cc43d8a 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionHistogram.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionHistogram.cpp @@ -4,6 +4,7 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB { diff --git a/dbms/src/AggregateFunctions/AggregateFunctionIf.cpp b/dbms/src/AggregateFunctions/AggregateFunctionIf.cpp index 6f871afedf7..84341955d84 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionIf.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionIf.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionMLMethod.cpp b/dbms/src/AggregateFunctions/AggregateFunctionMLMethod.cpp index da282cb8e10..effff5eeb55 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionMLMethod.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionMLMethod.cpp @@ -11,6 +11,7 @@ #include "AggregateFunctionFactory.h" #include "FactoryHelpers.h" #include "Helpers.h" +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionMaxIntersections.cpp b/dbms/src/AggregateFunctions/AggregateFunctionMaxIntersections.cpp index 9f63d399fe7..3316152cbfb 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionMaxIntersections.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionMaxIntersections.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionMerge.cpp b/dbms/src/AggregateFunctions/AggregateFunctionMerge.cpp index f9c2eb8c9dd..d54ff99f25b 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionMerge.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionMerge.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionMinMaxAny.cpp b/dbms/src/AggregateFunctions/AggregateFunctionMinMaxAny.cpp index 852b738fe31..9358d361616 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionMinMaxAny.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionMinMaxAny.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionNull.cpp b/dbms/src/AggregateFunctions/AggregateFunctionNull.cpp index a1cba5519e7..e577df472c8 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionNull.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionNull.cpp @@ -3,6 +3,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionOrFill.cpp b/dbms/src/AggregateFunctions/AggregateFunctionOrFill.cpp index 24624415080..b9cc2f9b8b7 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionOrFill.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionOrFill.cpp @@ -1,6 +1,7 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionQuantile.cpp b/dbms/src/AggregateFunctions/AggregateFunctionQuantile.cpp index d96bb82d6f5..43cc7acf5cb 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionQuantile.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionQuantile.cpp @@ -4,6 +4,7 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB { diff --git a/dbms/src/AggregateFunctions/AggregateFunctionResample.cpp b/dbms/src/AggregateFunctions/AggregateFunctionResample.cpp index 3ff2d2ef193..d8d13e22120 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionResample.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionResample.cpp @@ -1,6 +1,7 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionRetention.cpp b/dbms/src/AggregateFunctions/AggregateFunctionRetention.cpp index ebdffd493df..f17d9b40c8b 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionRetention.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionRetention.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.cpp b/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.cpp index f1a561d6f6e..d9a4cbdc533 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionSequenceMatch.cpp @@ -6,6 +6,7 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB { diff --git a/dbms/src/AggregateFunctions/AggregateFunctionSimpleLinearRegression.cpp b/dbms/src/AggregateFunctions/AggregateFunctionSimpleLinearRegression.cpp index 18a68868637..9ae7922ba6c 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionSimpleLinearRegression.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionSimpleLinearRegression.cpp @@ -4,6 +4,7 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB { diff --git a/dbms/src/AggregateFunctions/AggregateFunctionState.cpp b/dbms/src/AggregateFunctions/AggregateFunctionState.cpp index 39ba17c6abc..ee312cba9ac 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionState.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionState.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionStatistics.cpp b/dbms/src/AggregateFunctions/AggregateFunctionStatistics.cpp index 1530ad25cf3..9e3aa0962db 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionStatistics.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionStatistics.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionStatisticsSimple.cpp b/dbms/src/AggregateFunctions/AggregateFunctionStatisticsSimple.cpp index 62a02ed6234..c7c2f9025ed 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionStatisticsSimple.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionStatisticsSimple.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionSum.cpp b/dbms/src/AggregateFunctions/AggregateFunctionSum.cpp index 5e060d7b7df..9d1a59536f2 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionSum.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionSum.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionSumMap.cpp b/dbms/src/AggregateFunctions/AggregateFunctionSumMap.cpp index c8227d60948..cf5c8254887 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionSumMap.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionSumMap.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionTimeSeriesGroupSum.cpp b/dbms/src/AggregateFunctions/AggregateFunctionTimeSeriesGroupSum.cpp index 8f3f64d9e93..aa467a33a32 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionTimeSeriesGroupSum.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionTimeSeriesGroupSum.cpp @@ -2,6 +2,7 @@ #include "AggregateFunctionFactory.h" #include "FactoryHelpers.h" #include "Helpers.h" +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionTopK.cpp b/dbms/src/AggregateFunctions/AggregateFunctionTopK.cpp index 242c1e4e4c0..7f2da260c2d 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionTopK.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionTopK.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "registerAggregateFunctions.h" #define TOP_K_MAX_SIZE 0xFFFFFF diff --git a/dbms/src/AggregateFunctions/AggregateFunctionUniq.cpp b/dbms/src/AggregateFunctions/AggregateFunctionUniq.cpp index 86456af0f9e..dc2c5d21541 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionUniq.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionUniq.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionUniqCombined.cpp b/dbms/src/AggregateFunctions/AggregateFunctionUniqCombined.cpp index 3be6822ecf4..9c547048b1e 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionUniqCombined.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionUniqCombined.cpp @@ -7,6 +7,7 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB { diff --git a/dbms/src/AggregateFunctions/AggregateFunctionUniqUpTo.cpp b/dbms/src/AggregateFunctions/AggregateFunctionUniqUpTo.cpp index ba4f337839e..3d05c77c61c 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionUniqUpTo.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionUniqUpTo.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/AggregateFunctionWindowFunnel.cpp b/dbms/src/AggregateFunctions/AggregateFunctionWindowFunnel.cpp index 56ee5dcb012..ce177562fc2 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionWindowFunnel.cpp +++ b/dbms/src/AggregateFunctions/AggregateFunctionWindowFunnel.cpp @@ -6,6 +6,7 @@ #include #include +#include "registerAggregateFunctions.h" namespace DB diff --git a/dbms/src/AggregateFunctions/registerAggregateFunctions.cpp b/dbms/src/AggregateFunctions/registerAggregateFunctions.cpp index d77d70f9371..9a6201be846 100644 --- a/dbms/src/AggregateFunctions/registerAggregateFunctions.cpp +++ b/dbms/src/AggregateFunctions/registerAggregateFunctions.cpp @@ -7,45 +7,6 @@ namespace DB { -void registerAggregateFunctionAvg(AggregateFunctionFactory &); -void registerAggregateFunctionCount(AggregateFunctionFactory &); -void registerAggregateFunctionGroupArray(AggregateFunctionFactory &); -void registerAggregateFunctionGroupUniqArray(AggregateFunctionFactory &); -void registerAggregateFunctionGroupArrayInsertAt(AggregateFunctionFactory &); -void registerAggregateFunctionsQuantile(AggregateFunctionFactory &); -void registerAggregateFunctionsSequenceMatch(AggregateFunctionFactory &); -void registerAggregateFunctionWindowFunnel(AggregateFunctionFactory &); -void registerAggregateFunctionRate(AggregateFunctionFactory &); -void registerAggregateFunctionsMinMaxAny(AggregateFunctionFactory &); -void registerAggregateFunctionsStatisticsStable(AggregateFunctionFactory &); -void registerAggregateFunctionsStatisticsSimple(AggregateFunctionFactory &); -void registerAggregateFunctionSum(AggregateFunctionFactory &); -void registerAggregateFunctionSumMap(AggregateFunctionFactory &); -void registerAggregateFunctionsUniq(AggregateFunctionFactory &); -void registerAggregateFunctionUniqCombined(AggregateFunctionFactory &); -void registerAggregateFunctionUniqUpTo(AggregateFunctionFactory &); -void registerAggregateFunctionTopK(AggregateFunctionFactory &); -void registerAggregateFunctionsBitwise(AggregateFunctionFactory &); -void registerAggregateFunctionsBitmap(AggregateFunctionFactory &); -void registerAggregateFunctionsMaxIntersections(AggregateFunctionFactory &); -void registerAggregateFunctionHistogram(AggregateFunctionFactory &); -void registerAggregateFunctionRetention(AggregateFunctionFactory &); -void registerAggregateFunctionTimeSeriesGroupSum(AggregateFunctionFactory &); -void registerAggregateFunctionMLMethod(AggregateFunctionFactory &); -void registerAggregateFunctionEntropy(AggregateFunctionFactory &); -void registerAggregateFunctionSimpleLinearRegression(AggregateFunctionFactory &); -void registerAggregateFunctionMoving(AggregateFunctionFactory &); -void registerAggregateFunctionCategoricalIV(AggregateFunctionFactory &); - -void registerAggregateFunctionCombinatorIf(AggregateFunctionCombinatorFactory &); -void registerAggregateFunctionCombinatorArray(AggregateFunctionCombinatorFactory &); -void registerAggregateFunctionCombinatorForEach(AggregateFunctionCombinatorFactory &); -void registerAggregateFunctionCombinatorState(AggregateFunctionCombinatorFactory &); -void registerAggregateFunctionCombinatorMerge(AggregateFunctionCombinatorFactory &); -void registerAggregateFunctionCombinatorNull(AggregateFunctionCombinatorFactory &); -void registerAggregateFunctionCombinatorOrFill(AggregateFunctionCombinatorFactory &); -void registerAggregateFunctionCombinatorResample(AggregateFunctionCombinatorFactory &); - void registerAggregateFunctions() { { diff --git a/dbms/src/AggregateFunctions/registerAggregateFunctions.h b/dbms/src/AggregateFunctions/registerAggregateFunctions.h index 2a2e0bb7d3f..487617ce921 100644 --- a/dbms/src/AggregateFunctions/registerAggregateFunctions.h +++ b/dbms/src/AggregateFunctions/registerAggregateFunctions.h @@ -3,6 +3,47 @@ namespace DB { +class AggregateFunctionFactory; +void registerAggregateFunctionAvg(AggregateFunctionFactory &); +void registerAggregateFunctionCount(AggregateFunctionFactory &); +void registerAggregateFunctionGroupArray(AggregateFunctionFactory &); +void registerAggregateFunctionGroupUniqArray(AggregateFunctionFactory &); +void registerAggregateFunctionGroupArrayInsertAt(AggregateFunctionFactory &); +void registerAggregateFunctionsQuantile(AggregateFunctionFactory &); +void registerAggregateFunctionsSequenceMatch(AggregateFunctionFactory &); +void registerAggregateFunctionWindowFunnel(AggregateFunctionFactory &); +void registerAggregateFunctionRate(AggregateFunctionFactory &); +void registerAggregateFunctionsMinMaxAny(AggregateFunctionFactory &); +void registerAggregateFunctionsStatisticsStable(AggregateFunctionFactory &); +void registerAggregateFunctionsStatisticsSimple(AggregateFunctionFactory &); +void registerAggregateFunctionSum(AggregateFunctionFactory &); +void registerAggregateFunctionSumMap(AggregateFunctionFactory &); +void registerAggregateFunctionsUniq(AggregateFunctionFactory &); +void registerAggregateFunctionUniqCombined(AggregateFunctionFactory &); +void registerAggregateFunctionUniqUpTo(AggregateFunctionFactory &); +void registerAggregateFunctionTopK(AggregateFunctionFactory &); +void registerAggregateFunctionsBitwise(AggregateFunctionFactory &); +void registerAggregateFunctionsBitmap(AggregateFunctionFactory &); +void registerAggregateFunctionsMaxIntersections(AggregateFunctionFactory &); +void registerAggregateFunctionHistogram(AggregateFunctionFactory &); +void registerAggregateFunctionRetention(AggregateFunctionFactory &); +void registerAggregateFunctionTimeSeriesGroupSum(AggregateFunctionFactory &); +void registerAggregateFunctionMLMethod(AggregateFunctionFactory &); +void registerAggregateFunctionEntropy(AggregateFunctionFactory &); +void registerAggregateFunctionSimpleLinearRegression(AggregateFunctionFactory &); +void registerAggregateFunctionMoving(AggregateFunctionFactory &); +void registerAggregateFunctionCategoricalIV(AggregateFunctionFactory &); + +class AggregateFunctionCombinatorFactory; +void registerAggregateFunctionCombinatorIf(AggregateFunctionCombinatorFactory &); +void registerAggregateFunctionCombinatorArray(AggregateFunctionCombinatorFactory &); +void registerAggregateFunctionCombinatorForEach(AggregateFunctionCombinatorFactory &); +void registerAggregateFunctionCombinatorState(AggregateFunctionCombinatorFactory &); +void registerAggregateFunctionCombinatorMerge(AggregateFunctionCombinatorFactory &); +void registerAggregateFunctionCombinatorNull(AggregateFunctionCombinatorFactory &); +void registerAggregateFunctionCombinatorOrFill(AggregateFunctionCombinatorFactory &); +void registerAggregateFunctionCombinatorResample(AggregateFunctionCombinatorFactory &); + void registerAggregateFunctions(); } diff --git a/dbms/src/Columns/ColumnsCommon.cpp b/dbms/src/Columns/ColumnsCommon.cpp index 0745a3d5b9f..a363e26a690 100644 --- a/dbms/src/Columns/ColumnsCommon.cpp +++ b/dbms/src/Columns/ColumnsCommon.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include "ColumnsCommon.h" namespace DB diff --git a/dbms/src/Common/Exception.cpp b/dbms/src/Common/Exception.cpp index bf3364390ad..28a86c620d1 100644 --- a/dbms/src/Common/Exception.cpp +++ b/dbms/src/Common/Exception.cpp @@ -76,7 +76,7 @@ void tryLogCurrentException(Poco::Logger * logger, const std::string & start_of_ } } -void getNoSpaceLeftInfoMessage(std::filesystem::path path, std::string & msg) +static void getNoSpaceLeftInfoMessage(std::filesystem::path path, std::string & msg) { path = std::filesystem::absolute(path); /// It's possible to get ENOSPC for non existent file (e.g. if there are no free inodes and creat() fails) @@ -97,7 +97,7 @@ void getNoSpaceLeftInfoMessage(std::filesystem::path path, std::string & msg) #endif } -std::string getExtraExceptionInfo(const std::exception & e) +static std::string getExtraExceptionInfo(const std::exception & e) { String msg; try diff --git a/dbms/src/Common/FieldVisitors.h b/dbms/src/Common/FieldVisitors.h index 1fc11350535..e3fa487477a 100644 --- a/dbms/src/Common/FieldVisitors.h +++ b/dbms/src/Common/FieldVisitors.h @@ -18,7 +18,13 @@ namespace ErrorCodes extern const int LOGICAL_ERROR; } -UInt128 stringToUUID(const String &); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wredundant-decls" +// Just dont mess with it. If the redundant redeclaration is removed then ReaderHelpers.h should be included. +// This leads to Arena.h inclusion which has a problem with ASAN stuff included properly and messing macro definition +// which intefrers with... You dont want to know, really. +UInt128 stringToUUID(const String & str); +#pragma GCC diagnostic pop /** StaticVisitor (and its descendants) - class with overloaded operator() for all types of fields. diff --git a/dbms/src/Common/OpenSSLHelpers.cpp b/dbms/src/Common/OpenSSLHelpers.cpp index a0a8ea91dbc..0147e1e8f3e 100644 --- a/dbms/src/Common/OpenSSLHelpers.cpp +++ b/dbms/src/Common/OpenSSLHelpers.cpp @@ -6,6 +6,7 @@ namespace DB { +#pragma GCC diagnostic warning "-Wold-style-cast" String getOpenSSLErrors() { diff --git a/dbms/src/Common/PODArray.h b/dbms/src/Common/PODArray.h index b875e174243..441befd2d5f 100644 --- a/dbms/src/Common/PODArray.h +++ b/dbms/src/Common/PODArray.h @@ -71,6 +71,9 @@ extern const char EmptyPODArray[EmptyPODArraySize]; /** Base class that depend only on size of element, not on element itself. * You can static_cast to this class if you want to insert some data regardless to the actual type T. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnull-dereference" + template class PODArrayBase : private boost::noncopyable, private TAllocator /// empty base optimization { @@ -621,6 +624,6 @@ void swap(PODArray & lhs, PODArray void write(const std::vector & arr, WriteBuffer & out) write(elem, out); } -void write(const ACL & acl, WriteBuffer & out) +static void write(const ACL & acl, WriteBuffer & out) { write(acl.permissions, out); write(acl.scheme, out); @@ -308,24 +308,24 @@ void write(const ACL & acl, WriteBuffer & out) } -void read(int64_t & x, ReadBuffer & in) +static void read(int64_t & x, ReadBuffer & in) { readBinary(x, in); x = __builtin_bswap64(x); } -void read(int32_t & x, ReadBuffer & in) +static void read(int32_t & x, ReadBuffer & in) { readBinary(x, in); x = __builtin_bswap32(x); } -void read(bool & x, ReadBuffer & in) +static void read(bool & x, ReadBuffer & in) { readBinary(x, in); } -void read(String & s, ReadBuffer & in) +static void read(String & s, ReadBuffer & in) { int32_t size = 0; read(size, in); @@ -356,7 +356,7 @@ template void read(std::array & s, ReadBuffer & in) in.read(s.data(), N); } -void read(Stat & stat, ReadBuffer & in) +static void read(Stat & stat, ReadBuffer & in) { read(stat.czxid, in); read(stat.mzxid, in); @@ -1387,14 +1387,17 @@ void ZooKeeper::finalize(bool error_send, bool error_receive) if (info.callback) { ResponsePtr response = info.request->makeResponse(); - response->error = ZSESSIONEXPIRED; - try + if (response) { - info.callback(*response); - } - catch (...) - { - tryLogCurrentException(__PRETTY_FUNCTION__); + response->error = ZSESSIONEXPIRED; + try + { + info.callback(*response); + } + catch (...) + { + tryLogCurrentException(__PRETTY_FUNCTION__); + } } } if (info.watch) diff --git a/dbms/src/Common/malloc.cpp b/dbms/src/Common/malloc.cpp index 1c45fd88605..4e57fbbebdc 100644 --- a/dbms/src/Common/malloc.cpp +++ b/dbms/src/Common/malloc.cpp @@ -4,6 +4,9 @@ /// Interposing these symbols explicitly. The idea works like this: malloc.cpp compiles to a /// dedicated object (namely clickhouse_malloc.o), and it will show earlier in the link command /// than malloc libs like libjemalloc.a. As a result, these symbols get picked in time right after. + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wredundant-decls" extern "C" { void *malloc(size_t size); @@ -16,6 +19,7 @@ extern "C" void *memalign(size_t alignment, size_t size); void *pvalloc(size_t size); } +#pragma GCC diagnostic pop template inline void ignore(T x __attribute__((unused))) diff --git a/dbms/src/Common/tests/AvalancheTest.cpp b/dbms/src/Common/tests/AvalancheTest.cpp index 098ec232dea..59be4896af9 100644 --- a/dbms/src/Common/tests/AvalancheTest.cpp +++ b/dbms/src/Common/tests/AvalancheTest.cpp @@ -4,40 +4,6 @@ //----------------------------------------------------------------------------- -void PrintAvalancheDiagram(int x, int y, int reps, double scale, int * bins) -{ - const char * symbols = ".123456789X"; - - for (int i = 0; i < y; i++) - { - printf("["); - for (int j = 0; j < x; j++) - { - int k = (y - i) - 1; - - int bin = bins[k + (j * y)]; - - double b = double(bin) / double(reps); - b = fabs(b * 2 - 1); - - b *= scale; - - int s = static_cast(floor(b * 10)); - - if (s > 10) - s = 10; - if (s < 0) - s = 0; - - printf("%c", symbols[s]); - } - - printf("]\n"); - } -} - -//---------------------------------------------------------------------------- - double maxBias(std::vector & counts, int reps) { double worst = 0; diff --git a/dbms/src/Common/tests/compact_array.cpp b/dbms/src/Common/tests/compact_array.cpp index 3714b6ef176..e238263c801 100644 --- a/dbms/src/Common/tests/compact_array.cpp +++ b/dbms/src/Common/tests/compact_array.cpp @@ -17,7 +17,7 @@ namespace fs = std::filesystem; -std::string createTmpPath(const std::string & filename) +static std::string createTmpPath(const std::string & filename) { char pattern[] = "/tmp/fileXXXXXX"; char * dir = mkdtemp(pattern); @@ -246,7 +246,7 @@ struct Generator3 } }; -void runTests() +static void runTests() { std::cout << "Test set 1\n"; TestSet::execute(); diff --git a/dbms/src/Common/tests/gtest_thread_pool_schedule_exception.cpp b/dbms/src/Common/tests/gtest_thread_pool_schedule_exception.cpp index 373c9421e94..fb620539c14 100644 --- a/dbms/src/Common/tests/gtest_thread_pool_schedule_exception.cpp +++ b/dbms/src/Common/tests/gtest_thread_pool_schedule_exception.cpp @@ -5,7 +5,7 @@ #include -bool check() +static bool check() { ThreadPool pool(10); diff --git a/dbms/src/Common/tests/int_hashes_perf.cpp b/dbms/src/Common/tests/int_hashes_perf.cpp index 24f3f36a7da..5f028cbbde8 100644 --- a/dbms/src/Common/tests/int_hashes_perf.cpp +++ b/dbms/src/Common/tests/int_hashes_perf.cpp @@ -12,7 +12,7 @@ #include -void setAffinity() +static void setAffinity() { #if !defined(__APPLE__) && !defined(__FreeBSD__) cpu_set_t mask; @@ -200,7 +200,7 @@ const size_t BUF_SIZE = 1024; using Source = std::vector; -void report(const char * name, size_t n, double elapsed, UInt64 tsc_diff, size_t res) +static void report(const char * name, size_t n, double elapsed, UInt64 tsc_diff, size_t res) { std::cerr << name << std::endl << "Done in " << elapsed diff --git a/dbms/src/Common/tests/integer_hash_tables_and_hashes.cpp b/dbms/src/Common/tests/integer_hash_tables_and_hashes.cpp index 091eb4acb93..544f6f2ceb7 100644 --- a/dbms/src/Common/tests/integer_hash_tables_and_hashes.cpp +++ b/dbms/src/Common/tests/integer_hash_tables_and_hashes.cpp @@ -325,7 +325,7 @@ void NO_INLINE testForEachHash(const Key * data, size_t size, Init && init) test(data, size, init); } -void NO_INLINE testForEachMapAndHash(const Key * data, size_t size) +static void NO_INLINE testForEachMapAndHash(const Key * data, size_t size) { auto nothing = [](auto &){}; diff --git a/dbms/src/Common/tests/multi_version.cpp b/dbms/src/Common/tests/multi_version.cpp index a4645a16e6e..b33c665d1b7 100644 --- a/dbms/src/Common/tests/multi_version.cpp +++ b/dbms/src/Common/tests/multi_version.cpp @@ -11,13 +11,13 @@ using MV = MultiVersion; using Results = std::vector; -void thread1(MV & x, T & result) +static void thread1(MV & x, T & result) { MV::Version v = x.get(); result = *v; } -void thread2(MV & x, const char * result) +static void thread2(MV & x, const char * result) { x.set(std::make_unique(result)); } diff --git a/dbms/src/Common/tests/parallel_aggregation.cpp b/dbms/src/Common/tests/parallel_aggregation.cpp index 21fc9179d21..738d4c1adcd 100644 --- a/dbms/src/Common/tests/parallel_aggregation.cpp +++ b/dbms/src/Common/tests/parallel_aggregation.cpp @@ -63,7 +63,7 @@ using Mutex = std::mutex; HashTableAllocator>;*/ -void aggregate1(Map & map, Source::const_iterator begin, Source::const_iterator end) +static void aggregate1(Map & map, Source::const_iterator begin, Source::const_iterator end) { for (auto it = begin; it != end; ++it) ++map[*it]; @@ -74,7 +74,7 @@ void aggregate1(Map & map, Source::const_iterator begin, Source::const_iterator #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif -void aggregate12(Map & map, Source::const_iterator begin, Source::const_iterator end) +static void aggregate12(Map & map, Source::const_iterator begin, Source::const_iterator end) { Map::LookupResult found = nullptr; auto prev_it = end; @@ -93,13 +93,13 @@ void aggregate12(Map & map, Source::const_iterator begin, Source::const_iterator } } -void aggregate2(MapTwoLevel & map, Source::const_iterator begin, Source::const_iterator end) +static void aggregate2(MapTwoLevel & map, Source::const_iterator begin, Source::const_iterator end) { for (auto it = begin; it != end; ++it) ++map[*it]; } -void aggregate22(MapTwoLevel & map, Source::const_iterator begin, Source::const_iterator end) +static void aggregate22(MapTwoLevel & map, Source::const_iterator begin, Source::const_iterator end) { MapTwoLevel::LookupResult found = nullptr; auto prev_it = end; @@ -122,14 +122,14 @@ void aggregate22(MapTwoLevel & map, Source::const_iterator begin, Source::const_ #pragma GCC diagnostic pop #endif -void merge2(MapTwoLevel * maps, size_t num_threads, size_t bucket) +static void merge2(MapTwoLevel * maps, size_t num_threads, size_t bucket) { for (size_t i = 1; i < num_threads; ++i) for (auto it = maps[i].impls[bucket].begin(); it != maps[i].impls[bucket].end(); ++it) maps[0].impls[bucket][it->getKey()] += it->getMapped(); } -void aggregate3(Map & local_map, Map & global_map, Mutex & mutex, Source::const_iterator begin, Source::const_iterator end) +static void aggregate3(Map & local_map, Map & global_map, Mutex & mutex, Source::const_iterator begin, Source::const_iterator end) { static constexpr size_t threshold = 65536; @@ -154,7 +154,7 @@ void aggregate3(Map & local_map, Map & global_map, Mutex & mutex, Source::const_ } } -void aggregate33(Map & local_map, Map & global_map, Mutex & mutex, Source::const_iterator begin, Source::const_iterator end) +static void aggregate33(Map & local_map, Map & global_map, Mutex & mutex, Source::const_iterator begin, Source::const_iterator end) { static constexpr size_t threshold = 65536; @@ -176,7 +176,7 @@ void aggregate33(Map & local_map, Map & global_map, Mutex & mutex, Source::const } } -void aggregate4(Map & local_map, MapTwoLevel & global_map, Mutex * mutexes, Source::const_iterator begin, Source::const_iterator end) +static void aggregate4(Map & local_map, MapTwoLevel & global_map, Mutex * mutexes, Source::const_iterator begin, Source::const_iterator end) { static constexpr size_t threshold = 65536; static constexpr size_t block_size = 8192; diff --git a/dbms/src/Common/tests/pod_array.cpp b/dbms/src/Common/tests/pod_array.cpp index fe586bafe63..f9d24d439f7 100644 --- a/dbms/src/Common/tests/pod_array.cpp +++ b/dbms/src/Common/tests/pod_array.cpp @@ -14,7 +14,7 @@ do \ } \ while (0) -void test1() +static void test1() { using namespace DB; @@ -135,7 +135,7 @@ void test1() std::cerr << "Some errors were found in test 1\n"; } -void test2() +static void test2() { using namespace DB; @@ -385,7 +385,7 @@ void test2() std::cerr << "Some errors were found in test 2\n"; } -void test3() +static void test3() { using namespace DB; diff --git a/dbms/src/Common/tests/radix_sort.cpp b/dbms/src/Common/tests/radix_sort.cpp index 4cd9da2a926..44225d2b218 100644 --- a/dbms/src/Common/tests/radix_sort.cpp +++ b/dbms/src/Common/tests/radix_sort.cpp @@ -9,17 +9,17 @@ using Key = double; -void NO_INLINE sort1(Key * data, size_t size) +static void NO_INLINE sort1(Key * data, size_t size) { std::sort(data, data + size); } -void NO_INLINE sort2(Key * data, size_t size) +static void NO_INLINE sort2(Key * data, size_t size) { radixSortLSD(data, size); } -void NO_INLINE sort3(Key * data, size_t size) +static void NO_INLINE sort3(Key * data, size_t size) { std::sort(data, data + size, [](Key a, Key b) { diff --git a/dbms/src/Common/tests/simple_cache.cpp b/dbms/src/Common/tests/simple_cache.cpp index 34346e67fd4..8fe18c5594c 100644 --- a/dbms/src/Common/tests/simple_cache.cpp +++ b/dbms/src/Common/tests/simple_cache.cpp @@ -2,7 +2,7 @@ #include -int func(int x, int y) +static int func(int x, int y) { std::cerr << x << " + " << y << "\n"; return x + y; diff --git a/dbms/src/Common/tests/sip_hash.cpp b/dbms/src/Common/tests/sip_hash.cpp index ac08a2de584..046ea0edc15 100644 --- a/dbms/src/Common/tests/sip_hash.cpp +++ b/dbms/src/Common/tests/sip_hash.cpp @@ -88,7 +88,7 @@ uint8_t vectors[64][8] = }; -int test_vectors() +static int test_vectors() { #define MAXLEN 64 char in[MAXLEN]; diff --git a/dbms/src/Common/tests/symbol_index.cpp b/dbms/src/Common/tests/symbol_index.cpp index 9f7ed2e9321..d1867cb524e 100644 --- a/dbms/src/Common/tests/symbol_index.cpp +++ b/dbms/src/Common/tests/symbol_index.cpp @@ -6,11 +6,13 @@ #include #include - -NO_INLINE const void * getAddress() +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +static NO_INLINE const void * getAddress() { return __builtin_return_address(0); } +#pragma GCC diagnostic pop int main(int argc, char ** argv) { diff --git a/dbms/src/Common/tests/thread_creation_latency.cpp b/dbms/src/Common/tests/thread_creation_latency.cpp index 480199f211f..351f709013a 100644 --- a/dbms/src/Common/tests/thread_creation_latency.cpp +++ b/dbms/src/Common/tests/thread_creation_latency.cpp @@ -10,8 +10,8 @@ int value = 0; -void f() { ++value; } -void * g(void *) { f(); return {}; } +static void f() { ++value; } +static void * g(void *) { f(); return {}; } namespace DB diff --git a/dbms/src/Compression/CompressionCodecDelta.h b/dbms/src/Compression/CompressionCodecDelta.h index 05068cd467e..27b433f6e76 100644 --- a/dbms/src/Compression/CompressionCodecDelta.h +++ b/dbms/src/Compression/CompressionCodecDelta.h @@ -28,4 +28,7 @@ private: UInt8 delta_bytes_size; }; +class CompressionCodecFactory; +void registerCodecDelta(CompressionCodecFactory & factory); + } diff --git a/dbms/src/Compression/CompressionCodecDoubleDelta.h b/dbms/src/Compression/CompressionCodecDoubleDelta.h index 19c07214115..3fdaf5f76d8 100644 --- a/dbms/src/Compression/CompressionCodecDoubleDelta.h +++ b/dbms/src/Compression/CompressionCodecDoubleDelta.h @@ -27,4 +27,7 @@ private: UInt8 data_bytes_size; }; +class CompressionCodecFactory; +void registerCodecDoubleDelta(CompressionCodecFactory & factory); + } diff --git a/dbms/src/Compression/CompressionCodecGorilla.h b/dbms/src/Compression/CompressionCodecGorilla.h index a3947434ad9..0bbd220cb59 100644 --- a/dbms/src/Compression/CompressionCodecGorilla.h +++ b/dbms/src/Compression/CompressionCodecGorilla.h @@ -27,4 +27,7 @@ private: UInt8 data_bytes_size; }; +class CompressionCodecFactory; +void registerCodecGorilla(CompressionCodecFactory & factory); + } diff --git a/dbms/src/Compression/CompressionCodecLZ4.cpp b/dbms/src/Compression/CompressionCodecLZ4.cpp index 08553e0920c..3e4aabd09cf 100644 --- a/dbms/src/Compression/CompressionCodecLZ4.cpp +++ b/dbms/src/Compression/CompressionCodecLZ4.cpp @@ -37,12 +37,18 @@ String CompressionCodecLZ4::getCodecDesc() const UInt32 CompressionCodecLZ4::getMaxCompressedDataSize(UInt32 uncompressed_size) const { +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wold-style-cast" return LZ4_COMPRESSBOUND(uncompressed_size); +#pragma GCC diagnostic pop } UInt32 CompressionCodecLZ4::doCompressData(const char * source, UInt32 source_size, char * dest) const { +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wold-style-cast" return LZ4_compress_default(source, dest, source_size, LZ4_COMPRESSBOUND(source_size)); +#pragma GCC diagnostic pop } void CompressionCodecLZ4::doDecompressData(const char * source, UInt32 source_size, char * dest, UInt32 uncompressed_size) const @@ -66,7 +72,10 @@ String CompressionCodecLZ4HC::getCodecDesc() const UInt32 CompressionCodecLZ4HC::doCompressData(const char * source, UInt32 source_size, char * dest) const { +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wold-style-cast" auto success = LZ4_compress_HC(source, dest, source_size, LZ4_COMPRESSBOUND(source_size), level); +#pragma GCC diagnostic pop if (!success) throw Exception("Cannot LZ4_compress_HC", ErrorCodes::CANNOT_COMPRESS); diff --git a/dbms/src/Compression/CompressionCodecLZ4.h b/dbms/src/Compression/CompressionCodecLZ4.h index 2550e4bc697..59e6096faf1 100644 --- a/dbms/src/Compression/CompressionCodecLZ4.h +++ b/dbms/src/Compression/CompressionCodecLZ4.h @@ -29,6 +29,9 @@ private: mutable LZ4::PerformanceStatistics lz4_stat; }; +class CompressionCodecFactory; +void registerCodecLZ4(CompressionCodecFactory & factory); + class CompressionCodecLZ4HC : public CompressionCodecLZ4 { public: @@ -44,4 +47,7 @@ private: const int level; }; +class CompressionCodecFactory; +void registerCodecLZ4HC(CompressionCodecFactory & factory); + } diff --git a/dbms/src/Compression/CompressionCodecMultiple.h b/dbms/src/Compression/CompressionCodecMultiple.h index 8702a7ab538..5f6d18df01c 100644 --- a/dbms/src/Compression/CompressionCodecMultiple.h +++ b/dbms/src/Compression/CompressionCodecMultiple.h @@ -29,4 +29,8 @@ private: }; + +class CompressionCodecFactory; +void registerCodecMultiple(CompressionCodecFactory & factory); + } diff --git a/dbms/src/Compression/CompressionCodecNone.h b/dbms/src/Compression/CompressionCodecNone.h index ab3f1176734..81046f77070 100644 --- a/dbms/src/Compression/CompressionCodecNone.h +++ b/dbms/src/Compression/CompressionCodecNone.h @@ -22,4 +22,6 @@ protected: }; +class CompressionCodecFactory; +void registerCodecNone(CompressionCodecFactory & factory); } diff --git a/dbms/src/Compression/CompressionCodecT64.h b/dbms/src/Compression/CompressionCodecT64.h index ec720e14c78..048057f9e79 100644 --- a/dbms/src/Compression/CompressionCodecT64.h +++ b/dbms/src/Compression/CompressionCodecT64.h @@ -53,4 +53,7 @@ private: Variant variant; }; +class CompressionCodecFactory; +void registerCodecT64(CompressionCodecFactory & factory); + } diff --git a/dbms/src/Compression/CompressionCodecZSTD.h b/dbms/src/Compression/CompressionCodecZSTD.h index 97c12ce2f31..3244e4ec886 100644 --- a/dbms/src/Compression/CompressionCodecZSTD.h +++ b/dbms/src/Compression/CompressionCodecZSTD.h @@ -30,4 +30,8 @@ private: const int level; }; + +class CompressionCodecFactory; +void registerCodecZSTD(CompressionCodecFactory & factory); + } diff --git a/dbms/src/Compression/CompressionFactory.cpp b/dbms/src/Compression/CompressionFactory.cpp index 5dd238d85d8..3a02c3b4540 100644 --- a/dbms/src/Compression/CompressionFactory.cpp +++ b/dbms/src/Compression/CompressionFactory.cpp @@ -131,11 +131,8 @@ void CompressionCodecFactory::registerSimpleCompressionCodec( } -void registerCodecLZ4(CompressionCodecFactory & factory); void registerCodecNone(CompressionCodecFactory & factory); void registerCodecZSTD(CompressionCodecFactory & factory); -void registerCodecMultiple(CompressionCodecFactory & factory); -void registerCodecLZ4HC(CompressionCodecFactory & factory); void registerCodecDelta(CompressionCodecFactory & factory); void registerCodecT64(CompressionCodecFactory & factory); void registerCodecDoubleDelta(CompressionCodecFactory & factory); diff --git a/dbms/src/Core/ColumnWithTypeAndName.h b/dbms/src/Core/ColumnWithTypeAndName.h index 9c52145f581..27b09710258 100644 --- a/dbms/src/Core/ColumnWithTypeAndName.h +++ b/dbms/src/Core/ColumnWithTypeAndName.h @@ -14,7 +14,8 @@ class WriteBuffer; * Column data could be nullptr - to represent just 'header' of column. * Name could be either name from a table or some temporary generated name during expression evaluation. */ - +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnull-dereference" struct ColumnWithTypeAndName { ColumnPtr column; @@ -35,5 +36,6 @@ struct ColumnWithTypeAndName void dumpStructure(WriteBuffer & out) const; String dumpStructure() const; }; +#pragma GCC diagnostic pop } diff --git a/dbms/src/Core/MySQLProtocol.h b/dbms/src/Core/MySQLProtocol.h index 25ce6213641..9b2a2cba249 100644 --- a/dbms/src/Core/MySQLProtocol.h +++ b/dbms/src/Core/MySQLProtocol.h @@ -1040,7 +1040,10 @@ public: throw Exception("Failed to write public key to memory. Error: " + getOpenSSLErrors(), ErrorCodes::OPENSSL_ERROR); } char * pem_buf = nullptr; +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wold-style-cast" long pem_size = BIO_get_mem_data(mem, &pem_buf); +# pragma GCC diagnostic pop String pem(pem_buf, pem_size); LOG_TRACE(log, "Key: " << pem); diff --git a/dbms/src/Core/iostream_debug_helpers.h b/dbms/src/Core/iostream_debug_helpers.h index dc48da931f0..b9e5efa5d95 100644 --- a/dbms/src/Core/iostream_debug_helpers.h +++ b/dbms/src/Core/iostream_debug_helpers.h @@ -25,6 +25,9 @@ std::ostream & operator<<(std::ostream & stream, const IStorage & what); class TableStructureReadLock; std::ostream & operator<<(std::ostream & stream, const TableStructureReadLock & what); +class IFunctionOverloadResolver; +std::ostream & operator<<(std::ostream & stream, const IFunctionOverloadResolver & what); + class IFunctionBase; std::ostream & operator<<(std::ostream & stream, const IFunctionBase & what); diff --git a/dbms/src/Core/tests/gtest_DecimalFunctions.cpp b/dbms/src/Core/tests/gtest_DecimalFunctions.cpp index 8bbd3b8d836..d03be3ff3b8 100644 --- a/dbms/src/Core/tests/gtest_DecimalFunctions.cpp +++ b/dbms/src/Core/tests/gtest_DecimalFunctions.cpp @@ -1,3 +1,4 @@ +#pragma GCC diagnostic ignored "-Wmissing-declarations" #include #include diff --git a/dbms/src/DataStreams/narrowBlockInputStreams.cpp b/dbms/src/DataStreams/narrowBlockInputStreams.cpp index ede12019d25..35b60253fab 100644 --- a/dbms/src/DataStreams/narrowBlockInputStreams.cpp +++ b/dbms/src/DataStreams/narrowBlockInputStreams.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "narrowBlockInputStreams.h" namespace DB diff --git a/dbms/src/DataStreams/tests/gtest_blocks_size_merging_streams.cpp b/dbms/src/DataStreams/tests/gtest_blocks_size_merging_streams.cpp index 57cd68d16d8..ff89cebd156 100644 --- a/dbms/src/DataStreams/tests/gtest_blocks_size_merging_streams.cpp +++ b/dbms/src/DataStreams/tests/gtest_blocks_size_merging_streams.cpp @@ -8,7 +8,7 @@ using namespace DB; -Block getBlockWithSize(const std::vector & columns, size_t rows, size_t stride, size_t & start) +static Block getBlockWithSize(const std::vector & columns, size_t rows, size_t stride, size_t & start) { ColumnsWithTypeAndName cols; @@ -27,7 +27,7 @@ Block getBlockWithSize(const std::vector & columns, size_t rows, si } -BlockInputStreams getInputStreams(const std::vector & column_names, const std::vector> & block_sizes) +static BlockInputStreams getInputStreams(const std::vector & column_names, const std::vector> & block_sizes) { BlockInputStreams result; for (auto [block_size_in_bytes, blocks_count, stride] : block_sizes) @@ -43,7 +43,7 @@ BlockInputStreams getInputStreams(const std::vector & column_names, } -BlockInputStreams getInputStreamsEqualStride(const std::vector & column_names, const std::vector> & block_sizes) +static BlockInputStreams getInputStreamsEqualStride(const std::vector & column_names, const std::vector> & block_sizes) { BlockInputStreams result; size_t i = 0; @@ -61,7 +61,7 @@ BlockInputStreams getInputStreamsEqualStride(const std::vector & co } -SortDescription getSortDescription(const std::vector & column_names) +static SortDescription getSortDescription(const std::vector & column_names) { SortDescription descr; for (const auto & column : column_names) diff --git a/dbms/src/DataTypes/DataTypeFactory.cpp b/dbms/src/DataTypes/DataTypeFactory.cpp index 64cf8745c5c..29e76cd9490 100644 --- a/dbms/src/DataTypes/DataTypeFactory.cpp +++ b/dbms/src/DataTypes/DataTypeFactory.cpp @@ -157,27 +157,6 @@ const DataTypeFactory::Creator& DataTypeFactory::findCreatorByName(const String throw Exception("Unknown data type family: " + family_name, ErrorCodes::UNKNOWN_TYPE); } -void registerDataTypeNumbers(DataTypeFactory & factory); -void registerDataTypeDecimal(DataTypeFactory & factory); -void registerDataTypeDate(DataTypeFactory & factory); -void registerDataTypeDateTime(DataTypeFactory & factory); -void registerDataTypeDateTime64(DataTypeFactory & factory); -void registerDataTypeString(DataTypeFactory & factory); -void registerDataTypeFixedString(DataTypeFactory & factory); -void registerDataTypeEnum(DataTypeFactory & factory); -void registerDataTypeArray(DataTypeFactory & factory); -void registerDataTypeTuple(DataTypeFactory & factory); -void registerDataTypeNullable(DataTypeFactory & factory); -void registerDataTypeNothing(DataTypeFactory & factory); -void registerDataTypeUUID(DataTypeFactory & factory); -void registerDataTypeAggregateFunction(DataTypeFactory & factory); -void registerDataTypeNested(DataTypeFactory & factory); -void registerDataTypeInterval(DataTypeFactory & factory); -void registerDataTypeLowCardinality(DataTypeFactory & factory); -void registerDataTypeDomainIPv4AndIPv6(DataTypeFactory & factory); -void registerDataTypeDomainSimpleAggregateFunction(DataTypeFactory & factory); - - DataTypeFactory::DataTypeFactory() { registerDataTypeNumbers(*this); diff --git a/dbms/src/DataTypes/DataTypeFactory.h b/dbms/src/DataTypes/DataTypeFactory.h index 15eb0c6a6bd..ed1719950ba 100644 --- a/dbms/src/DataTypes/DataTypeFactory.h +++ b/dbms/src/DataTypes/DataTypeFactory.h @@ -65,4 +65,24 @@ private: String getFactoryName() const override { return "DataTypeFactory"; } }; +void registerDataTypeNumbers(DataTypeFactory & factory); +void registerDataTypeDecimal(DataTypeFactory & factory); +void registerDataTypeDate(DataTypeFactory & factory); +void registerDataTypeDateTime(DataTypeFactory & factory); +void registerDataTypeString(DataTypeFactory & factory); +void registerDataTypeFixedString(DataTypeFactory & factory); +void registerDataTypeEnum(DataTypeFactory & factory); +void registerDataTypeArray(DataTypeFactory & factory); +void registerDataTypeTuple(DataTypeFactory & factory); +void registerDataTypeNullable(DataTypeFactory & factory); +void registerDataTypeNothing(DataTypeFactory & factory); +void registerDataTypeUUID(DataTypeFactory & factory); +void registerDataTypeAggregateFunction(DataTypeFactory & factory); +void registerDataTypeNested(DataTypeFactory & factory); +void registerDataTypeInterval(DataTypeFactory & factory); +void registerDataTypeLowCardinality(DataTypeFactory & factory); +void registerDataTypeDomainIPv4AndIPv6(DataTypeFactory & factory); +void registerDataTypeDomainSimpleAggregateFunction(DataTypeFactory & factory); +void registerDataTypeDateTime64(DataTypeFactory & factory); + } diff --git a/dbms/src/DataTypes/tests/gtest_data_type_get_common_type.cpp b/dbms/src/DataTypes/tests/gtest_data_type_get_common_type.cpp index 93f7eeef16d..36326a6210f 100644 --- a/dbms/src/DataTypes/tests/gtest_data_type_get_common_type.cpp +++ b/dbms/src/DataTypes/tests/gtest_data_type_get_common_type.cpp @@ -3,18 +3,18 @@ #include #include - +#pragma GCC diagnostic ignored "-Wmissing-declarations" #include namespace DB { -bool operator==(const IDataType & left, const IDataType & right) +static bool operator==(const IDataType & left, const IDataType & right) { return left.equals(right); } -std::ostream & operator<<(std::ostream & ostr, const IDataType & dt) +static std::ostream & operator<<(std::ostream & ostr, const IDataType & dt) { return ostr << dt.getName(); } @@ -23,13 +23,13 @@ std::ostream & operator<<(std::ostream & ostr, const IDataType & dt) using namespace DB; -auto typeFromString(const std::string & str) +static auto typeFromString(const std::string & str) { auto & data_type_factory = DataTypeFactory::instance(); return data_type_factory.get(str); }; -auto typesFromString(const std::string & str) +static auto typesFromString(const std::string & str) { std::istringstream data_types_stream(str); DataTypes data_types; @@ -46,7 +46,7 @@ struct TypesTestCase const char * expected_type = nullptr; }; -std::ostream & operator<<(std::ostream & ostr, const TypesTestCase & test_case) +static std::ostream & operator<<(std::ostream & ostr, const TypesTestCase & test_case) { ostr << "TypesTestCase{\"" << test_case.from_types << "\", "; if (test_case.expected_type) diff --git a/dbms/src/Databases/DatabaseMySQL.cpp b/dbms/src/Databases/DatabaseMySQL.cpp index f52893cdeaf..de95103ce10 100644 --- a/dbms/src/Databases/DatabaseMySQL.cpp +++ b/dbms/src/Databases/DatabaseMySQL.cpp @@ -43,7 +43,7 @@ namespace ErrorCodes constexpr static const auto suffix = ".remove_flag"; static constexpr const std::chrono::seconds cleaner_sleep_time{30}; -String toQueryStringWithQuote(const std::vector & quote_list) +static String toQueryStringWithQuote(const std::vector & quote_list) { WriteBufferFromOwnString quote_list_query; quote_list_query << "("; diff --git a/dbms/src/Dictionaries/CacheDictionary.cpp b/dbms/src/Dictionaries/CacheDictionary.cpp index 57498221141..4dcb87c7b8a 100644 --- a/dbms/src/Dictionaries/CacheDictionary.cpp +++ b/dbms/src/Dictionaries/CacheDictionary.cpp @@ -2,18 +2,14 @@ #include #include -#include #include -#include #include #include #include #include #include -#include #include #include -#include #include #include #include "CacheDictionary.inc.h" diff --git a/dbms/src/Dictionaries/ClickHouseDictionarySource.cpp b/dbms/src/Dictionaries/ClickHouseDictionarySource.cpp index 2d2afd4c3fe..c93186ca364 100644 --- a/dbms/src/Dictionaries/ClickHouseDictionarySource.cpp +++ b/dbms/src/Dictionaries/ClickHouseDictionarySource.cpp @@ -5,13 +5,13 @@ #include #include #include -#include #include #include "DictionarySourceFactory.h" #include "DictionaryStructure.h" #include "ExternalQueryBuilder.h" #include "readInvalidateQuery.h" #include "writeParenthesisedString.h" +#include "DictionaryFactory.h" namespace DB diff --git a/dbms/src/Dictionaries/DictionaryFactory.h b/dbms/src/Dictionaries/DictionaryFactory.h index d9efd3f42f1..69cfe695afb 100644 --- a/dbms/src/Dictionaries/DictionaryFactory.h +++ b/dbms/src/Dictionaries/DictionaryFactory.h @@ -1,6 +1,7 @@ #pragma once #include "IDictionary.h" +#include "registerDictionaries.h" #include diff --git a/dbms/src/Dictionaries/ExecutableDictionarySource.cpp b/dbms/src/Dictionaries/ExecutableDictionarySource.cpp index 68c48d2b457..6aadaaeaed1 100644 --- a/dbms/src/Dictionaries/ExecutableDictionarySource.cpp +++ b/dbms/src/Dictionaries/ExecutableDictionarySource.cpp @@ -14,6 +14,7 @@ #include "DictionarySourceFactory.h" #include "DictionarySourceHelpers.h" #include "DictionaryStructure.h" +#include "registerDictionaries.h" namespace DB diff --git a/dbms/src/Dictionaries/FileDictionarySource.cpp b/dbms/src/Dictionaries/FileDictionarySource.cpp index 1c9f9d60ce3..c1608712310 100644 --- a/dbms/src/Dictionaries/FileDictionarySource.cpp +++ b/dbms/src/Dictionaries/FileDictionarySource.cpp @@ -1,11 +1,11 @@ #include "FileDictionarySource.h" - #include #include #include #include #include "DictionarySourceFactory.h" #include "DictionaryStructure.h" +#include "registerDictionaries.h" namespace DB { diff --git a/dbms/src/Dictionaries/HTTPDictionarySource.cpp b/dbms/src/Dictionaries/HTTPDictionarySource.cpp index 3dfdaa3e6ca..b815221f2cb 100644 --- a/dbms/src/Dictionaries/HTTPDictionarySource.cpp +++ b/dbms/src/Dictionaries/HTTPDictionarySource.cpp @@ -1,5 +1,4 @@ #include "HTTPDictionarySource.h" - #include #include #include @@ -13,6 +12,7 @@ #include "DictionarySourceFactory.h" #include "DictionarySourceHelpers.h" #include "DictionaryStructure.h" +#include "registerDictionaries.h" namespace DB diff --git a/dbms/src/Dictionaries/LibraryDictionarySource.cpp b/dbms/src/Dictionaries/LibraryDictionarySource.cpp index 2cb74b944d3..93289ce746a 100644 --- a/dbms/src/Dictionaries/LibraryDictionarySource.cpp +++ b/dbms/src/Dictionaries/LibraryDictionarySource.cpp @@ -1,6 +1,5 @@ #include "LibraryDictionarySource.h" #include -#include #include #include #include @@ -10,7 +9,7 @@ #include "DictionarySourceFactory.h" #include "DictionaryStructure.h" #include "LibraryDictionarySourceExternal.h" - +#include "registerDictionaries.h" namespace DB { diff --git a/dbms/src/Dictionaries/MongoDBDictionarySource.cpp b/dbms/src/Dictionaries/MongoDBDictionarySource.cpp index 18d9f840426..72b359de010 100644 --- a/dbms/src/Dictionaries/MongoDBDictionarySource.cpp +++ b/dbms/src/Dictionaries/MongoDBDictionarySource.cpp @@ -1,6 +1,7 @@ #include "MongoDBDictionarySource.h" #include "DictionarySourceFactory.h" #include "DictionaryStructure.h" +#include "registerDictionaries.h" namespace DB { diff --git a/dbms/src/Dictionaries/MySQLDictionarySource.cpp b/dbms/src/Dictionaries/MySQLDictionarySource.cpp index 497448bf64c..d884e95d737 100644 --- a/dbms/src/Dictionaries/MySQLDictionarySource.cpp +++ b/dbms/src/Dictionaries/MySQLDictionarySource.cpp @@ -1,11 +1,9 @@ #include "MySQLDictionarySource.h" - #include -#include "config_core.h" #include "DictionarySourceFactory.h" #include "DictionaryStructure.h" - - +#include "config_core.h" +#include "registerDictionaries.h" namespace DB { diff --git a/dbms/src/Dictionaries/RangeHashedDictionary.cpp b/dbms/src/Dictionaries/RangeHashedDictionary.cpp index b1412d98f75..1d80ea8c497 100644 --- a/dbms/src/Dictionaries/RangeHashedDictionary.cpp +++ b/dbms/src/Dictionaries/RangeHashedDictionary.cpp @@ -61,7 +61,7 @@ bool RangeHashedDictionary::Range::contains(const RangeStorageType & value) cons return left <= value && value <= right; } -bool operator<(const RangeHashedDictionary::Range & left, const RangeHashedDictionary::Range & right) +static bool operator<(const RangeHashedDictionary::Range & left, const RangeHashedDictionary::Range & right) { return std::tie(left.left, left.right) < std::tie(right.left, right.right); } diff --git a/dbms/src/Dictionaries/RedisDictionarySource.cpp b/dbms/src/Dictionaries/RedisDictionarySource.cpp index 905ae104dc0..3a24110f6b2 100644 --- a/dbms/src/Dictionaries/RedisDictionarySource.cpp +++ b/dbms/src/Dictionaries/RedisDictionarySource.cpp @@ -1,6 +1,7 @@ #include "RedisDictionarySource.h" #include "DictionarySourceFactory.h" #include "DictionaryStructure.h" +#include "registerDictionaries.h" namespace DB { diff --git a/dbms/src/Dictionaries/TrieDictionary.cpp b/dbms/src/Dictionaries/TrieDictionary.cpp index f7f4f8c33a6..4432a1ec548 100644 --- a/dbms/src/Dictionaries/TrieDictionary.cpp +++ b/dbms/src/Dictionaries/TrieDictionary.cpp @@ -509,7 +509,10 @@ void TrieDictionary::getItemsImpl( { auto addr = Int32(first_column->get64(i)); uintptr_t slot = btrie_find(trie, addr); +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wold-style-cast" set_value(i, slot != BTRIE_NULL ? static_cast(vec[slot]) : get_default(i)); +#pragma GCC diagnostic pop } } else @@ -521,7 +524,10 @@ void TrieDictionary::getItemsImpl( throw Exception("Expected key to be FixedString(16)", ErrorCodes::LOGICAL_ERROR); uintptr_t slot = btrie_find_a6(trie, reinterpret_cast(addr.data)); +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wold-style-cast" set_value(i, slot != BTRIE_NULL ? static_cast(vec[slot]) : get_default(i)); +#pragma GCC diagnostic pop } } @@ -637,7 +643,10 @@ void TrieDictionary::has(const Attribute &, const Columns & key_columns, PaddedP { auto addr = Int32(first_column->get64(i)); uintptr_t slot = btrie_find(trie, addr); +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wold-style-cast" out[i] = (slot != BTRIE_NULL); +#pragma GCC diagnostic pop } } else @@ -649,7 +658,10 @@ void TrieDictionary::has(const Attribute &, const Columns & key_columns, PaddedP throw Exception("Expected key to be FixedString(16)", ErrorCodes::LOGICAL_ERROR); uintptr_t slot = btrie_find_a6(trie, reinterpret_cast(addr.data)); +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wold-style-cast" out[i] = (slot != BTRIE_NULL); +#pragma GCC diagnostic pop } } @@ -678,8 +690,10 @@ void TrieDictionary::trieTraverse(const btrie_t * tree, Getter && getter) const { node = stack.top(); stack.pop(); - +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wold-style-cast" if (node && node->value != BTRIE_NULL) +#pragma GCC diagnostic pop getter(key, stack.size()); if (node && node->right) diff --git a/dbms/src/Dictionaries/XDBCDictionarySource.cpp b/dbms/src/Dictionaries/XDBCDictionarySource.cpp index 12b6b72fceb..c9237ec4552 100644 --- a/dbms/src/Dictionaries/XDBCDictionarySource.cpp +++ b/dbms/src/Dictionaries/XDBCDictionarySource.cpp @@ -17,6 +17,8 @@ #include "readInvalidateQuery.h" #include +#include "registerDictionaries.h" + #if USE_POCO_SQLODBC || USE_POCO_DATAODBC # include #endif diff --git a/dbms/src/Dictionaries/registerDictionaries.cpp b/dbms/src/Dictionaries/registerDictionaries.cpp index ee320d7177b..4ebaae04116 100644 --- a/dbms/src/Dictionaries/registerDictionaries.cpp +++ b/dbms/src/Dictionaries/registerDictionaries.cpp @@ -3,25 +3,6 @@ namespace DB { -void registerDictionarySourceFile(DictionarySourceFactory & source_factory); -void registerDictionarySourceMysql(DictionarySourceFactory & source_factory); -void registerDictionarySourceClickHouse(DictionarySourceFactory & source_factory); -void registerDictionarySourceMongoDB(DictionarySourceFactory & source_factory); -void registerDictionarySourceRedis(DictionarySourceFactory & source_factory); -void registerDictionarySourceXDBC(DictionarySourceFactory & source_factory); -void registerDictionarySourceJDBC(DictionarySourceFactory & source_factory); -void registerDictionarySourceExecutable(DictionarySourceFactory & source_factory); -void registerDictionarySourceHTTP(DictionarySourceFactory & source_factory); -void registerDictionarySourceLibrary(DictionarySourceFactory & source_factory); - -void registerDictionaryRangeHashed(DictionaryFactory & factory); -void registerDictionaryComplexKeyHashed(DictionaryFactory & factory); -void registerDictionaryComplexKeyCache(DictionaryFactory & factory); -void registerDictionaryTrie(DictionaryFactory & factory); -void registerDictionaryFlat(DictionaryFactory & factory); -void registerDictionaryHashed(DictionaryFactory & factory); -void registerDictionaryCache(DictionaryFactory & factory); - void registerDictionaries() { diff --git a/dbms/src/Dictionaries/registerDictionaries.h b/dbms/src/Dictionaries/registerDictionaries.h index e8480277c2c..3f2e730b5e3 100644 --- a/dbms/src/Dictionaries/registerDictionaries.h +++ b/dbms/src/Dictionaries/registerDictionaries.h @@ -2,5 +2,28 @@ namespace DB { + +class DictionarySourceFactory; + +void registerDictionarySourceFile(DictionarySourceFactory & source_factory); +void registerDictionarySourceMysql(DictionarySourceFactory & source_factory); +void registerDictionarySourceClickHouse(DictionarySourceFactory & source_factory); +void registerDictionarySourceMongoDB(DictionarySourceFactory & source_factory); +void registerDictionarySourceRedis(DictionarySourceFactory & source_factory); +void registerDictionarySourceXDBC(DictionarySourceFactory & source_factory); +void registerDictionarySourceJDBC(DictionarySourceFactory & source_factory); +void registerDictionarySourceExecutable(DictionarySourceFactory & source_factory); +void registerDictionarySourceHTTP(DictionarySourceFactory & source_factory); +void registerDictionarySourceLibrary(DictionarySourceFactory & source_factory); + +class DictionaryFactory; +void registerDictionaryRangeHashed(DictionaryFactory & factory); +void registerDictionaryComplexKeyHashed(DictionaryFactory & factory); +void registerDictionaryComplexKeyCache(DictionaryFactory & factory); +void registerDictionaryTrie(DictionaryFactory & factory); +void registerDictionaryFlat(DictionaryFactory & factory); +void registerDictionaryHashed(DictionaryFactory & factory); +void registerDictionaryCache(DictionaryFactory & factory); + void registerDictionaries(); } diff --git a/dbms/src/Dictionaries/tests/gtest_dictionary_configuration.cpp b/dbms/src/Dictionaries/tests/gtest_dictionary_configuration.cpp index 7cda09a259a..ce96cfc3e99 100644 --- a/dbms/src/Dictionaries/tests/gtest_dictionary_configuration.cpp +++ b/dbms/src/Dictionaries/tests/gtest_dictionary_configuration.cpp @@ -22,7 +22,8 @@ using namespace DB; static bool registered = false; /// For debug -std::string configurationToString(const DictionaryConfigurationPtr & config) +#pragma GCC diagnostic ignored "-Wunused-function" +static std::string configurationToString(const DictionaryConfigurationPtr & config) { const Poco::Util::XMLConfiguration * xml_config = dynamic_cast(config.get()); std::ostringstream oss; diff --git a/dbms/src/Disks/DiskLocal.h b/dbms/src/Disks/DiskLocal.h index 263c7e59376..b88c38307ba 100644 --- a/dbms/src/Disks/DiskLocal.h +++ b/dbms/src/Disks/DiskLocal.h @@ -117,4 +117,7 @@ private: CurrentMetrics::Increment metric_increment; }; +class DiskFactory; +void registerDiskLocal(DiskFactory & factory); + } diff --git a/dbms/src/Disks/registerDisks.cpp b/dbms/src/Disks/registerDisks.cpp index 6fcca800974..d80f31d9e81 100644 --- a/dbms/src/Disks/registerDisks.cpp +++ b/dbms/src/Disks/registerDisks.cpp @@ -1,4 +1,5 @@ #include "DiskFactory.h" +#include "registerDisks.h" namespace DB { diff --git a/dbms/src/Formats/CMakeLists.txt b/dbms/src/Formats/CMakeLists.txt index fe434bbb07a..4929c141fe3 100644 --- a/dbms/src/Formats/CMakeLists.txt +++ b/dbms/src/Formats/CMakeLists.txt @@ -1,4 +1,4 @@ -configure_file(config_formats.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/config_formats.h) +configure_file(config_formats.h.in ${ConfigIncludePath}/config_formats.h) if (ENABLE_TESTS) add_subdirectory (tests) diff --git a/dbms/src/Formats/FormatFactory.cpp b/dbms/src/Formats/FormatFactory.cpp index dfbaef334e0..aa65fe5765f 100644 --- a/dbms/src/Formats/FormatFactory.cpp +++ b/dbms/src/Formats/FormatFactory.cpp @@ -262,61 +262,6 @@ void FormatFactory::registerFileSegmentationEngine(const String & name, FileSegm target = file_segmentation_engine; } -/// Formats for both input/output. - -void registerInputFormatNative(FormatFactory & factory); -void registerOutputFormatNative(FormatFactory & factory); - -void registerInputFormatProcessorNative(FormatFactory & factory); -void registerOutputFormatProcessorNative(FormatFactory & factory); -void registerInputFormatProcessorRowBinary(FormatFactory & factory); -void registerOutputFormatProcessorRowBinary(FormatFactory & factory); -void registerInputFormatProcessorTabSeparated(FormatFactory & factory); -void registerOutputFormatProcessorTabSeparated(FormatFactory & factory); -void registerInputFormatProcessorValues(FormatFactory & factory); -void registerOutputFormatProcessorValues(FormatFactory & factory); -void registerInputFormatProcessorCSV(FormatFactory & factory); -void registerOutputFormatProcessorCSV(FormatFactory & factory); -void registerInputFormatProcessorTSKV(FormatFactory & factory); -void registerOutputFormatProcessorTSKV(FormatFactory & factory); -void registerInputFormatProcessorJSONEachRow(FormatFactory & factory); -void registerOutputFormatProcessorJSONEachRow(FormatFactory & factory); -void registerInputFormatProcessorJSONCompactEachRow(FormatFactory & factory); -void registerOutputFormatProcessorJSONCompactEachRow(FormatFactory & factory); -void registerInputFormatProcessorParquet(FormatFactory & factory); -void registerInputFormatProcessorORC(FormatFactory & factory); -void registerOutputFormatProcessorParquet(FormatFactory & factory); -void registerInputFormatProcessorProtobuf(FormatFactory & factory); -void registerOutputFormatProcessorProtobuf(FormatFactory & factory); -void registerInputFormatProcessorTemplate(FormatFactory & factory); -void registerOutputFormatProcessorTemplate(FormatFactory &factory); - -/// File Segmentation Engines for parallel reading - -void registerFileSegmentationEngineTabSeparated(FormatFactory & factory); -void registerFileSegmentationEngineCSV(FormatFactory & factory); -void registerFileSegmentationEngineJSONEachRow(FormatFactory & factory); - -/// Output only (presentational) formats. - -void registerOutputFormatNull(FormatFactory & factory); - -void registerOutputFormatProcessorPretty(FormatFactory & factory); -void registerOutputFormatProcessorPrettyCompact(FormatFactory & factory); -void registerOutputFormatProcessorPrettySpace(FormatFactory & factory); -void registerOutputFormatProcessorVertical(FormatFactory & factory); -void registerOutputFormatProcessorJSON(FormatFactory & factory); -void registerOutputFormatProcessorJSONCompact(FormatFactory & factory); -void registerOutputFormatProcessorJSONEachRowWithProgress(FormatFactory & factory); -void registerOutputFormatProcessorXML(FormatFactory & factory); -void registerOutputFormatProcessorODBCDriver(FormatFactory & factory); -void registerOutputFormatProcessorODBCDriver2(FormatFactory & factory); -void registerOutputFormatProcessorNull(FormatFactory & factory); -void registerOutputFormatProcessorMySQLWrite(FormatFactory & factory); - -/// Input only formats. -void registerInputFormatProcessorCapnProto(FormatFactory & factory); - FormatFactory::FormatFactory() { registerInputFormatNative(*this); diff --git a/dbms/src/Formats/FormatFactory.h b/dbms/src/Formats/FormatFactory.h index 46b19a55870..ee2cf3ee444 100644 --- a/dbms/src/Formats/FormatFactory.h +++ b/dbms/src/Formats/FormatFactory.h @@ -144,4 +144,59 @@ private: const Creators & getCreators(const String & name) const; }; +/// Formats for both input/output. + +void registerInputFormatNative(FormatFactory & factory); +void registerOutputFormatNative(FormatFactory & factory); + +void registerInputFormatProcessorNative(FormatFactory & factory); +void registerOutputFormatProcessorNative(FormatFactory & factory); +void registerInputFormatProcessorRowBinary(FormatFactory & factory); +void registerOutputFormatProcessorRowBinary(FormatFactory & factory); +void registerInputFormatProcessorTabSeparated(FormatFactory & factory); +void registerOutputFormatProcessorTabSeparated(FormatFactory & factory); +void registerInputFormatProcessorValues(FormatFactory & factory); +void registerOutputFormatProcessorValues(FormatFactory & factory); +void registerInputFormatProcessorCSV(FormatFactory & factory); +void registerOutputFormatProcessorCSV(FormatFactory & factory); +void registerInputFormatProcessorTSKV(FormatFactory & factory); +void registerOutputFormatProcessorTSKV(FormatFactory & factory); +void registerInputFormatProcessorJSONEachRow(FormatFactory & factory); +void registerOutputFormatProcessorJSONEachRow(FormatFactory & factory); +void registerInputFormatProcessorJSONCompactEachRow(FormatFactory & factory); +void registerOutputFormatProcessorJSONCompactEachRow(FormatFactory & factory); +void registerInputFormatProcessorParquet(FormatFactory & factory); +void registerInputFormatProcessorORC(FormatFactory & factory); +void registerOutputFormatProcessorParquet(FormatFactory & factory); +void registerInputFormatProcessorProtobuf(FormatFactory & factory); +void registerOutputFormatProcessorProtobuf(FormatFactory & factory); +void registerInputFormatProcessorTemplate(FormatFactory & factory); +void registerOutputFormatProcessorTemplate(FormatFactory &factory); + +/// File Segmentation Engines for parallel reading + +void registerFileSegmentationEngineTabSeparated(FormatFactory & factory); +void registerFileSegmentationEngineCSV(FormatFactory & factory); +void registerFileSegmentationEngineJSONEachRow(FormatFactory & factory); + +/// Output only (presentational) formats. + +void registerOutputFormatNull(FormatFactory & factory); + +void registerOutputFormatProcessorPretty(FormatFactory & factory); +void registerOutputFormatProcessorPrettyCompact(FormatFactory & factory); +void registerOutputFormatProcessorPrettySpace(FormatFactory & factory); +void registerOutputFormatProcessorVertical(FormatFactory & factory); +void registerOutputFormatProcessorJSON(FormatFactory & factory); +void registerOutputFormatProcessorJSONCompact(FormatFactory & factory); +void registerOutputFormatProcessorJSONEachRowWithProgress(FormatFactory & factory); +void registerOutputFormatProcessorXML(FormatFactory & factory); +void registerOutputFormatProcessorODBCDriver(FormatFactory & factory); +void registerOutputFormatProcessorODBCDriver2(FormatFactory & factory); +void registerOutputFormatProcessorNull(FormatFactory & factory); +void registerOutputFormatProcessorMySQLWrite(FormatFactory & factory); + +/// Input only formats. +void registerInputFormatProcessorCapnProto(FormatFactory & factory); + } diff --git a/dbms/src/Functions/CMakeLists.txt b/dbms/src/Functions/CMakeLists.txt index 41658ca2ba5..6db48932093 100644 --- a/dbms/src/Functions/CMakeLists.txt +++ b/dbms/src/Functions/CMakeLists.txt @@ -1,4 +1,4 @@ -configure_file(config_functions.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/config_functions.h) +configure_file(config_functions.h.in ${ConfigIncludePath}/config_functions.h) include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake) add_headers_and_sources(clickhouse_functions .) diff --git a/dbms/src/Functions/CRC.cpp b/dbms/src/Functions/CRC.cpp index e506812d94c..0af35387639 100644 --- a/dbms/src/Functions/CRC.cpp +++ b/dbms/src/Functions/CRC.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerFunctions.h" namespace { diff --git a/dbms/src/Functions/FunctionFQDN.cpp b/dbms/src/Functions/FunctionFQDN.cpp index ed49b43632e..90aa7d35383 100644 --- a/dbms/src/Functions/FunctionFQDN.cpp +++ b/dbms/src/Functions/FunctionFQDN.cpp @@ -3,7 +3,7 @@ #include #include #include - +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionFactory.h b/dbms/src/Functions/FunctionFactory.h index 3add395e52a..75930f92c46 100644 --- a/dbms/src/Functions/FunctionFactory.h +++ b/dbms/src/Functions/FunctionFactory.h @@ -2,7 +2,8 @@ #include #include - +#include "URL/registerFunctionsURL.h" +#include "registerFunctions.h" #include #include diff --git a/dbms/src/Functions/FunctionJoinGet.cpp b/dbms/src/Functions/FunctionJoinGet.cpp index 83d0cca1694..3bcbf69e21e 100644 --- a/dbms/src/Functions/FunctionJoinGet.cpp +++ b/dbms/src/Functions/FunctionJoinGet.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/FunctionsBitmap.cpp b/dbms/src/Functions/FunctionsBitmap.cpp index c94566b04b0..240299e5ced 100644 --- a/dbms/src/Functions/FunctionsBitmap.cpp +++ b/dbms/src/Functions/FunctionsBitmap.cpp @@ -1,4 +1,5 @@ #include +#include "registerFunctions.h" // TODO include this last because of a broken roaring header. See the comment // inside. diff --git a/dbms/src/Functions/FunctionsCoding.cpp b/dbms/src/Functions/FunctionsCoding.cpp index 934dfd150f9..997c42e55ca 100644 --- a/dbms/src/Functions/FunctionsCoding.cpp +++ b/dbms/src/Functions/FunctionsCoding.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionsConversion.cpp b/dbms/src/Functions/FunctionsConversion.cpp index b583783fe36..4e6e0fe6e29 100644 --- a/dbms/src/Functions/FunctionsConversion.cpp +++ b/dbms/src/Functions/FunctionsConversion.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionsEmbeddedDictionaries.cpp b/dbms/src/Functions/FunctionsEmbeddedDictionaries.cpp index 63136be6790..683de258ef7 100644 --- a/dbms/src/Functions/FunctionsEmbeddedDictionaries.cpp +++ b/dbms/src/Functions/FunctionsEmbeddedDictionaries.cpp @@ -1,5 +1,6 @@ #include "FunctionFactory.h" #include "FunctionsEmbeddedDictionaries.h" +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionsExternalDictionaries.cpp b/dbms/src/Functions/FunctionsExternalDictionaries.cpp index b28b7901eea..65909564702 100644 --- a/dbms/src/Functions/FunctionsExternalDictionaries.cpp +++ b/dbms/src/Functions/FunctionsExternalDictionaries.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionsExternalModels.cpp b/dbms/src/Functions/FunctionsExternalModels.cpp index df9c438d4ca..a9d3ee45c91 100644 --- a/dbms/src/Functions/FunctionsExternalModels.cpp +++ b/dbms/src/Functions/FunctionsExternalModels.cpp @@ -15,6 +15,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/FunctionsFindCluster.cpp b/dbms/src/Functions/FunctionsFindCluster.cpp index 4f15adbc418..c05740e5f97 100644 --- a/dbms/src/Functions/FunctionsFindCluster.cpp +++ b/dbms/src/Functions/FunctionsFindCluster.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionsFindCluster.h b/dbms/src/Functions/FunctionsFindCluster.h index 997fd0d3645..5fddb9fe4da 100644 --- a/dbms/src/Functions/FunctionsFindCluster.h +++ b/dbms/src/Functions/FunctionsFindCluster.h @@ -42,7 +42,7 @@ enum ClusterOperation /// functions (eg. Hamming distance) using Clickhouse lambdas. // Centroids array has the same size as number of clusters. -size_t find_centroid(Float64 x, std::vector & centroids) +inline size_t find_centroid(Float64 x, std::vector & centroids) { // Centroids array has to have at least one element, and if it has only one element, // it is also the result of this Function. diff --git a/dbms/src/Functions/FunctionsFormatting.cpp b/dbms/src/Functions/FunctionsFormatting.cpp index 64c62d0ff44..aca4df091db 100644 --- a/dbms/src/Functions/FunctionsFormatting.cpp +++ b/dbms/src/Functions/FunctionsFormatting.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionsHashing.cpp b/dbms/src/Functions/FunctionsHashing.cpp index 4a98a7993b4..aab0f6e1e16 100644 --- a/dbms/src/Functions/FunctionsHashing.cpp +++ b/dbms/src/Functions/FunctionsHashing.cpp @@ -1,6 +1,7 @@ #include "FunctionsHashing.h" #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionsJSON.cpp b/dbms/src/Functions/FunctionsJSON.cpp index 79dea768f61..4e62a06c0a9 100644 --- a/dbms/src/Functions/FunctionsJSON.cpp +++ b/dbms/src/Functions/FunctionsJSON.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/FunctionsRandom.cpp b/dbms/src/Functions/FunctionsRandom.cpp index 19b2f08cdba..a6865b96e0b 100644 --- a/dbms/src/Functions/FunctionsRandom.cpp +++ b/dbms/src/Functions/FunctionsRandom.cpp @@ -3,6 +3,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/FunctionsReinterpret.cpp b/dbms/src/Functions/FunctionsReinterpret.cpp index 6f8a8def815..61a1e56ceac 100644 --- a/dbms/src/Functions/FunctionsReinterpret.cpp +++ b/dbms/src/Functions/FunctionsReinterpret.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionsRound.cpp b/dbms/src/Functions/FunctionsRound.cpp index 6897336ae74..3c48ff26c1a 100644 --- a/dbms/src/Functions/FunctionsRound.cpp +++ b/dbms/src/Functions/FunctionsRound.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionsStringArray.cpp b/dbms/src/Functions/FunctionsStringArray.cpp index 97fd34fb1e8..6f50369d52f 100644 --- a/dbms/src/Functions/FunctionsStringArray.cpp +++ b/dbms/src/Functions/FunctionsStringArray.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/FunctionsStringRegex.cpp b/dbms/src/Functions/FunctionsStringRegex.cpp index 12fb2b781f6..6f0c52347fe 100644 --- a/dbms/src/Functions/FunctionsStringRegex.cpp +++ b/dbms/src/Functions/FunctionsStringRegex.cpp @@ -1,4 +1,5 @@ #include "FunctionsStringRegex.h" +#include "registerFunctions.h" #include "FunctionsStringSearch.h" #include diff --git a/dbms/src/Functions/FunctionsStringSearch.cpp b/dbms/src/Functions/FunctionsStringSearch.cpp index c39d536927c..25ef3c7c800 100644 --- a/dbms/src/Functions/FunctionsStringSearch.cpp +++ b/dbms/src/Functions/FunctionsStringSearch.cpp @@ -1,4 +1,5 @@ #include "FunctionsStringSearch.h" +#include "registerFunctions.h" #include #include diff --git a/dbms/src/Functions/FunctionsStringSimilarity.cpp b/dbms/src/Functions/FunctionsStringSimilarity.cpp index 9dda521cd29..464458f6288 100644 --- a/dbms/src/Functions/FunctionsStringSimilarity.cpp +++ b/dbms/src/Functions/FunctionsStringSimilarity.cpp @@ -1,4 +1,5 @@ #include +#include "registerFunctions.h" #include #include diff --git a/dbms/src/Functions/GatherUtils/concat.cpp b/dbms/src/Functions/GatherUtils/concat.cpp index bcae43d91ec..fdea79b2cc4 100644 --- a/dbms/src/Functions/GatherUtils/concat.cpp +++ b/dbms/src/Functions/GatherUtils/concat.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/GatherUtils/createArraySink.cpp b/dbms/src/Functions/GatherUtils/createArraySink.cpp index e6d80cdab9f..c68b10747d1 100644 --- a/dbms/src/Functions/GatherUtils/createArraySink.cpp +++ b/dbms/src/Functions/GatherUtils/createArraySink.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Sinks.h" #include "Sources.h" #include diff --git a/dbms/src/Functions/GatherUtils/createArraySource.cpp b/dbms/src/Functions/GatherUtils/createArraySource.cpp index b7690a3f53c..7d816315d04 100644 --- a/dbms/src/Functions/GatherUtils/createArraySource.cpp +++ b/dbms/src/Functions/GatherUtils/createArraySource.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Sinks.h" #include "Sources.h" #include diff --git a/dbms/src/Functions/GatherUtils/createValueSource.cpp b/dbms/src/Functions/GatherUtils/createValueSource.cpp index c74c41999aa..77eeda1bbdd 100644 --- a/dbms/src/Functions/GatherUtils/createValueSource.cpp +++ b/dbms/src/Functions/GatherUtils/createValueSource.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Sinks.h" #include "Sources.h" #include diff --git a/dbms/src/Functions/GatherUtils/has.cpp b/dbms/src/Functions/GatherUtils/has.cpp index 1d2df2e0b49..38d63032ceb 100644 --- a/dbms/src/Functions/GatherUtils/has.cpp +++ b/dbms/src/Functions/GatherUtils/has.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/GatherUtils/push.cpp b/dbms/src/Functions/GatherUtils/push.cpp index 2bdfaa694b9..83a7851dbb0 100644 --- a/dbms/src/Functions/GatherUtils/push.cpp +++ b/dbms/src/Functions/GatherUtils/push.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/GatherUtils/resizeConstantSize.cpp b/dbms/src/Functions/GatherUtils/resizeConstantSize.cpp index 3947d5cee7b..5b1e9b59548 100644 --- a/dbms/src/Functions/GatherUtils/resizeConstantSize.cpp +++ b/dbms/src/Functions/GatherUtils/resizeConstantSize.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/GatherUtils/resizeDynamicSize.cpp b/dbms/src/Functions/GatherUtils/resizeDynamicSize.cpp index eb1db1990f5..2f601f2354d 100644 --- a/dbms/src/Functions/GatherUtils/resizeDynamicSize.cpp +++ b/dbms/src/Functions/GatherUtils/resizeDynamicSize.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/GatherUtils/sliceDynamicOffsetBounded.cpp b/dbms/src/Functions/GatherUtils/sliceDynamicOffsetBounded.cpp index 842fdd30da7..b266a253eeb 100644 --- a/dbms/src/Functions/GatherUtils/sliceDynamicOffsetBounded.cpp +++ b/dbms/src/Functions/GatherUtils/sliceDynamicOffsetBounded.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/GatherUtils/sliceDynamicOffsetUnbounded.cpp b/dbms/src/Functions/GatherUtils/sliceDynamicOffsetUnbounded.cpp index 675d7bab3dd..9cb2a74367e 100644 --- a/dbms/src/Functions/GatherUtils/sliceDynamicOffsetUnbounded.cpp +++ b/dbms/src/Functions/GatherUtils/sliceDynamicOffsetUnbounded.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/GatherUtils/sliceFromLeftConstantOffsetBounded.cpp b/dbms/src/Functions/GatherUtils/sliceFromLeftConstantOffsetBounded.cpp index 092cf402942..5b86fdff682 100644 --- a/dbms/src/Functions/GatherUtils/sliceFromLeftConstantOffsetBounded.cpp +++ b/dbms/src/Functions/GatherUtils/sliceFromLeftConstantOffsetBounded.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/GatherUtils/sliceFromLeftConstantOffsetUnbounded.cpp b/dbms/src/Functions/GatherUtils/sliceFromLeftConstantOffsetUnbounded.cpp index 8eaec294048..d2f7dcc0789 100644 --- a/dbms/src/Functions/GatherUtils/sliceFromLeftConstantOffsetUnbounded.cpp +++ b/dbms/src/Functions/GatherUtils/sliceFromLeftConstantOffsetUnbounded.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/GatherUtils/sliceFromRightConstantOffsetBounded.cpp b/dbms/src/Functions/GatherUtils/sliceFromRightConstantOffsetBounded.cpp index ebfcf073375..b46547ddff8 100644 --- a/dbms/src/Functions/GatherUtils/sliceFromRightConstantOffsetBounded.cpp +++ b/dbms/src/Functions/GatherUtils/sliceFromRightConstantOffsetBounded.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/GatherUtils/sliceFromRightConstantOffsetUnbounded.cpp b/dbms/src/Functions/GatherUtils/sliceFromRightConstantOffsetUnbounded.cpp index 04d46898c1f..9e95a338ab6 100644 --- a/dbms/src/Functions/GatherUtils/sliceFromRightConstantOffsetUnbounded.cpp +++ b/dbms/src/Functions/GatherUtils/sliceFromRightConstantOffsetUnbounded.cpp @@ -1,3 +1,4 @@ +#include "GatherUtils.h" #include "Selectors.h" #include "Algorithms.h" diff --git a/dbms/src/Functions/URL/basename.cpp b/dbms/src/Functions/URL/basename.cpp index 22c219688b2..a180b2899a8 100644 --- a/dbms/src/Functions/URL/basename.cpp +++ b/dbms/src/Functions/URL/basename.cpp @@ -1,7 +1,8 @@ #include #include -#include "FunctionsURL.h" +#include #include +#include "FunctionsURL.h" namespace DB { diff --git a/dbms/src/Functions/URL/registerFunctionsURL.cpp b/dbms/src/Functions/URL/registerFunctionsURL.cpp index 906b2adfb3f..8ca5131abbf 100644 --- a/dbms/src/Functions/URL/registerFunctionsURL.cpp +++ b/dbms/src/Functions/URL/registerFunctionsURL.cpp @@ -1,31 +1,8 @@ +#include "registerFunctionsURL.h" + namespace DB { -class FunctionFactory; - -void registerFunctionProtocol(FunctionFactory &); -void registerFunctionDomain(FunctionFactory &); -void registerFunctionDomainWithoutWWW(FunctionFactory &); -void registerFunctionFirstSignificantSubdomain(FunctionFactory &); -void registerFunctionTopLevelDomain(FunctionFactory &); -void registerFunctionPath(FunctionFactory &); -void registerFunctionPathFull(FunctionFactory &); -void registerFunctionQueryString(FunctionFactory &); -void registerFunctionFragment(FunctionFactory &); -void registerFunctionQueryStringAndFragment(FunctionFactory &); -void registerFunctionExtractURLParameter(FunctionFactory &); -void registerFunctionExtractURLParameters(FunctionFactory &); -void registerFunctionExtractURLParameterNames(FunctionFactory &); -void registerFunctionURLHierarchy(FunctionFactory &); -void registerFunctionURLPathHierarchy(FunctionFactory &); -void registerFunctionCutToFirstSignificantSubdomain(FunctionFactory &); -void registerFunctionCutWWW(FunctionFactory &); -void registerFunctionCutQueryString(FunctionFactory &); -void registerFunctionCutFragment(FunctionFactory &); -void registerFunctionCutQueryStringAndFragment(FunctionFactory &); -void registerFunctionCutURLParameter(FunctionFactory &); -void registerFunctionDecodeURLComponent(FunctionFactory &); - void registerFunctionsURL(FunctionFactory & factory) { registerFunctionProtocol(factory); diff --git a/dbms/src/Functions/URL/registerFunctionsURL.h b/dbms/src/Functions/URL/registerFunctionsURL.h new file mode 100644 index 00000000000..94ba5a037a4 --- /dev/null +++ b/dbms/src/Functions/URL/registerFunctionsURL.h @@ -0,0 +1,32 @@ +#pragma once + +namespace DB +{ +class FunctionFactory; + +void registerFunctionProtocol(FunctionFactory &); +void registerFunctionDomain(FunctionFactory &); +void registerFunctionDomainWithoutWWW(FunctionFactory &); +void registerFunctionFirstSignificantSubdomain(FunctionFactory &); +void registerFunctionTopLevelDomain(FunctionFactory &); +void registerFunctionPath(FunctionFactory &); +void registerFunctionPathFull(FunctionFactory &); +void registerFunctionQueryString(FunctionFactory &); +void registerFunctionFragment(FunctionFactory &); +void registerFunctionQueryStringAndFragment(FunctionFactory &); +void registerFunctionExtractURLParameter(FunctionFactory &); +void registerFunctionExtractURLParameters(FunctionFactory &); +void registerFunctionExtractURLParameterNames(FunctionFactory &); +void registerFunctionURLHierarchy(FunctionFactory &); +void registerFunctionURLPathHierarchy(FunctionFactory &); +void registerFunctionCutToFirstSignificantSubdomain(FunctionFactory &); +void registerFunctionCutWWW(FunctionFactory &); +void registerFunctionCutQueryString(FunctionFactory &); +void registerFunctionCutFragment(FunctionFactory &); +void registerFunctionCutQueryStringAndFragment(FunctionFactory &); +void registerFunctionCutURLParameter(FunctionFactory &); +void registerFunctionDecodeURLComponent(FunctionFactory &); + +void registerFunctionsURL(FunctionFactory &); + +} diff --git a/dbms/src/Functions/acos.cpp b/dbms/src/Functions/acos.cpp index 5d562743f3b..e4fc8146eda 100644 --- a/dbms/src/Functions/acos.cpp +++ b/dbms/src/Functions/acos.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/addDays.cpp b/dbms/src/Functions/addDays.cpp index da85377323f..f8d384a9c08 100644 --- a/dbms/src/Functions/addDays.cpp +++ b/dbms/src/Functions/addDays.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/addHours.cpp b/dbms/src/Functions/addHours.cpp index 3052f7d0acd..f0a70b91328 100644 --- a/dbms/src/Functions/addHours.cpp +++ b/dbms/src/Functions/addHours.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/addMinutes.cpp b/dbms/src/Functions/addMinutes.cpp index 5c22059f792..fc1c4a50d45 100644 --- a/dbms/src/Functions/addMinutes.cpp +++ b/dbms/src/Functions/addMinutes.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/addMonths.cpp b/dbms/src/Functions/addMonths.cpp index d2f44d4efbd..661a4daf75e 100644 --- a/dbms/src/Functions/addMonths.cpp +++ b/dbms/src/Functions/addMonths.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/addQuarters.cpp b/dbms/src/Functions/addQuarters.cpp index dd158186383..eaf64f0b85d 100644 --- a/dbms/src/Functions/addQuarters.cpp +++ b/dbms/src/Functions/addQuarters.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/addSeconds.cpp b/dbms/src/Functions/addSeconds.cpp index efc7129a62e..1fedcad7f28 100644 --- a/dbms/src/Functions/addSeconds.cpp +++ b/dbms/src/Functions/addSeconds.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/addWeeks.cpp b/dbms/src/Functions/addWeeks.cpp index 050091c0b74..9751913bfc9 100644 --- a/dbms/src/Functions/addWeeks.cpp +++ b/dbms/src/Functions/addWeeks.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/addYears.cpp b/dbms/src/Functions/addYears.cpp index f47e13a144b..fd338483b77 100644 --- a/dbms/src/Functions/addYears.cpp +++ b/dbms/src/Functions/addYears.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/addressToLine.cpp b/dbms/src/Functions/addressToLine.cpp index b87a3816fc5..d1e2ecb7658 100644 --- a/dbms/src/Functions/addressToLine.cpp +++ b/dbms/src/Functions/addressToLine.cpp @@ -18,6 +18,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/addressToSymbol.cpp b/dbms/src/Functions/addressToSymbol.cpp index e9e9f8e6ca6..91c95252909 100644 --- a/dbms/src/Functions/addressToSymbol.cpp +++ b/dbms/src/Functions/addressToSymbol.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/appendTrailingCharIfAbsent.cpp b/dbms/src/Functions/appendTrailingCharIfAbsent.cpp index 1c3267343ca..b3829e87116 100644 --- a/dbms/src/Functions/appendTrailingCharIfAbsent.cpp +++ b/dbms/src/Functions/appendTrailingCharIfAbsent.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/array/array.cpp b/dbms/src/Functions/array/array.cpp index d517ced8203..0dc0196357a 100644 --- a/dbms/src/Functions/array/array.cpp +++ b/dbms/src/Functions/array/array.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayAll.cpp b/dbms/src/Functions/array/arrayAll.cpp index 43d10f0eb4f..6f9771d4f0a 100644 --- a/dbms/src/Functions/array/arrayAll.cpp +++ b/dbms/src/Functions/array/arrayAll.cpp @@ -2,6 +2,7 @@ #include #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayCompact.cpp b/dbms/src/Functions/array/arrayCompact.cpp index 489d18440e0..d57b108a597 100644 --- a/dbms/src/Functions/array/arrayCompact.cpp +++ b/dbms/src/Functions/array/arrayCompact.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayConcat.cpp b/dbms/src/Functions/array/arrayConcat.cpp index 30da20c7766..06e5db6e93e 100644 --- a/dbms/src/Functions/array/arrayConcat.cpp +++ b/dbms/src/Functions/array/arrayConcat.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayCount.cpp b/dbms/src/Functions/array/arrayCount.cpp index 49623cf0446..cbb27b8857b 100644 --- a/dbms/src/Functions/array/arrayCount.cpp +++ b/dbms/src/Functions/array/arrayCount.cpp @@ -2,6 +2,7 @@ #include #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayCumSum.cpp b/dbms/src/Functions/array/arrayCumSum.cpp index 79f705e74fa..d8be7aa3562 100644 --- a/dbms/src/Functions/array/arrayCumSum.cpp +++ b/dbms/src/Functions/array/arrayCumSum.cpp @@ -4,6 +4,7 @@ #include #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayCumSumNonNegative.cpp b/dbms/src/Functions/array/arrayCumSumNonNegative.cpp index 88a2b258571..b07fe7b6faf 100644 --- a/dbms/src/Functions/array/arrayCumSumNonNegative.cpp +++ b/dbms/src/Functions/array/arrayCumSumNonNegative.cpp @@ -4,6 +4,7 @@ #include #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayDifference.cpp b/dbms/src/Functions/array/arrayDifference.cpp index 545749e5ec0..fe01ab5a366 100644 --- a/dbms/src/Functions/array/arrayDifference.cpp +++ b/dbms/src/Functions/array/arrayDifference.cpp @@ -4,6 +4,7 @@ #include #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayDistinct.cpp b/dbms/src/Functions/array/arrayDistinct.cpp index 3246539d497..e2bcb532b08 100644 --- a/dbms/src/Functions/array/arrayDistinct.cpp +++ b/dbms/src/Functions/array/arrayDistinct.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayElement.cpp b/dbms/src/Functions/array/arrayElement.cpp index 2921a4bd02a..876f7a49755 100644 --- a/dbms/src/Functions/array/arrayElement.cpp +++ b/dbms/src/Functions/array/arrayElement.cpp @@ -12,6 +12,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayEnumerate.cpp b/dbms/src/Functions/array/arrayEnumerate.cpp index a228c310fbc..a35a9e63b69 100644 --- a/dbms/src/Functions/array/arrayEnumerate.cpp +++ b/dbms/src/Functions/array/arrayEnumerate.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayEnumerateDense.cpp b/dbms/src/Functions/array/arrayEnumerateDense.cpp index 4539aed18ab..be2cb2cb69e 100644 --- a/dbms/src/Functions/array/arrayEnumerateDense.cpp +++ b/dbms/src/Functions/array/arrayEnumerateDense.cpp @@ -1,5 +1,6 @@ #include "arrayEnumerateExtended.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayEnumerateDenseRanked.cpp b/dbms/src/Functions/array/arrayEnumerateDenseRanked.cpp index 735211fb3df..0b6eba4639f 100644 --- a/dbms/src/Functions/array/arrayEnumerateDenseRanked.cpp +++ b/dbms/src/Functions/array/arrayEnumerateDenseRanked.cpp @@ -1,5 +1,6 @@ #include #include "arrayEnumerateRanked.h" +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayEnumerateRanked.cpp b/dbms/src/Functions/array/arrayEnumerateRanked.cpp index 7be0cbc44ce..758c2db4414 100644 --- a/dbms/src/Functions/array/arrayEnumerateRanked.cpp +++ b/dbms/src/Functions/array/arrayEnumerateRanked.cpp @@ -2,6 +2,7 @@ #include #include #include "arrayEnumerateRanked.h" +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayEnumerateUniq.cpp b/dbms/src/Functions/array/arrayEnumerateUniq.cpp index 848b29064c4..cb4e72dd1cd 100644 --- a/dbms/src/Functions/array/arrayEnumerateUniq.cpp +++ b/dbms/src/Functions/array/arrayEnumerateUniq.cpp @@ -1,5 +1,6 @@ #include "arrayEnumerateExtended.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayEnumerateUniqRanked.cpp b/dbms/src/Functions/array/arrayEnumerateUniqRanked.cpp index 2cd1fe40c2e..75da44105a6 100644 --- a/dbms/src/Functions/array/arrayEnumerateUniqRanked.cpp +++ b/dbms/src/Functions/array/arrayEnumerateUniqRanked.cpp @@ -1,5 +1,6 @@ #include "Functions/FunctionFactory.h" #include "arrayEnumerateRanked.h" +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayExists.cpp b/dbms/src/Functions/array/arrayExists.cpp index 770e19ceec2..b8ec0c6317b 100644 --- a/dbms/src/Functions/array/arrayExists.cpp +++ b/dbms/src/Functions/array/arrayExists.cpp @@ -2,7 +2,7 @@ #include #include "FunctionArrayMapped.h" #include - +#include "registerFunctionsArray.h" namespace DB { diff --git a/dbms/src/Functions/array/arrayFill.cpp b/dbms/src/Functions/array/arrayFill.cpp index 544cd0a8849..f2ea9d9ad70 100644 --- a/dbms/src/Functions/array/arrayFill.cpp +++ b/dbms/src/Functions/array/arrayFill.cpp @@ -2,7 +2,7 @@ #include #include "FunctionArrayMapped.h" #include - +#include "registerFunctionsArray.h" namespace DB { diff --git a/dbms/src/Functions/array/arrayFilter.cpp b/dbms/src/Functions/array/arrayFilter.cpp index e5db2b34e23..6140fc7e053 100644 --- a/dbms/src/Functions/array/arrayFilter.cpp +++ b/dbms/src/Functions/array/arrayFilter.cpp @@ -2,6 +2,7 @@ #include #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayFirst.cpp b/dbms/src/Functions/array/arrayFirst.cpp index 98de4f8f1e5..b7ec1f09254 100644 --- a/dbms/src/Functions/array/arrayFirst.cpp +++ b/dbms/src/Functions/array/arrayFirst.cpp @@ -2,6 +2,7 @@ #include #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayFirstIndex.cpp b/dbms/src/Functions/array/arrayFirstIndex.cpp index fccbf05c66c..1f61dd0b8aa 100644 --- a/dbms/src/Functions/array/arrayFirstIndex.cpp +++ b/dbms/src/Functions/array/arrayFirstIndex.cpp @@ -2,6 +2,7 @@ #include #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayFlatten.cpp b/dbms/src/Functions/array/arrayFlatten.cpp index 8ddb187f421..939142aeff7 100644 --- a/dbms/src/Functions/array/arrayFlatten.cpp +++ b/dbms/src/Functions/array/arrayFlatten.cpp @@ -3,6 +3,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB { diff --git a/dbms/src/Functions/array/arrayIntersect.cpp b/dbms/src/Functions/array/arrayIntersect.cpp index 4673f4a7a05..933567cebf2 100644 --- a/dbms/src/Functions/array/arrayIntersect.cpp +++ b/dbms/src/Functions/array/arrayIntersect.cpp @@ -22,6 +22,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayJoin.cpp b/dbms/src/Functions/array/arrayJoin.cpp index 6302f01b762..62b2848cde3 100644 --- a/dbms/src/Functions/array/arrayJoin.cpp +++ b/dbms/src/Functions/array/arrayJoin.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayMap.cpp b/dbms/src/Functions/array/arrayMap.cpp index e3afaf7fb66..ea456c29fd5 100644 --- a/dbms/src/Functions/array/arrayMap.cpp +++ b/dbms/src/Functions/array/arrayMap.cpp @@ -1,5 +1,6 @@ #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayPopBack.cpp b/dbms/src/Functions/array/arrayPopBack.cpp index d69e59e7128..a2421cc86cc 100644 --- a/dbms/src/Functions/array/arrayPopBack.cpp +++ b/dbms/src/Functions/array/arrayPopBack.cpp @@ -1,5 +1,6 @@ #include "arrayPop.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayPopFront.cpp b/dbms/src/Functions/array/arrayPopFront.cpp index ca9ce923aaa..61c250403ec 100644 --- a/dbms/src/Functions/array/arrayPopFront.cpp +++ b/dbms/src/Functions/array/arrayPopFront.cpp @@ -1,5 +1,6 @@ #include "arrayPop.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayPushBack.cpp b/dbms/src/Functions/array/arrayPushBack.cpp index a9c4ed88a7a..ad91cfdfd26 100644 --- a/dbms/src/Functions/array/arrayPushBack.cpp +++ b/dbms/src/Functions/array/arrayPushBack.cpp @@ -1,5 +1,6 @@ #include "arrayPush.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayPushFront.cpp b/dbms/src/Functions/array/arrayPushFront.cpp index e0cc56c8ae2..d79990fb7e8 100644 --- a/dbms/src/Functions/array/arrayPushFront.cpp +++ b/dbms/src/Functions/array/arrayPushFront.cpp @@ -1,5 +1,6 @@ #include "arrayPush.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayReduce.cpp b/dbms/src/Functions/array/arrayReduce.cpp index 41409706428..103d0fe5fa8 100644 --- a/dbms/src/Functions/array/arrayReduce.cpp +++ b/dbms/src/Functions/array/arrayReduce.cpp @@ -12,6 +12,7 @@ #include #include #include +#include "registerFunctionsArray.h" #include diff --git a/dbms/src/Functions/array/arrayResize.cpp b/dbms/src/Functions/array/arrayResize.cpp index e7cda17cd27..e7dde32bd68 100644 --- a/dbms/src/Functions/array/arrayResize.cpp +++ b/dbms/src/Functions/array/arrayResize.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayReverse.cpp b/dbms/src/Functions/array/arrayReverse.cpp index a4f2f1ab90a..931785e1198 100644 --- a/dbms/src/Functions/array/arrayReverse.cpp +++ b/dbms/src/Functions/array/arrayReverse.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arraySlice.cpp b/dbms/src/Functions/array/arraySlice.cpp index a952aa72d2e..8233a5cdf2d 100644 --- a/dbms/src/Functions/array/arraySlice.cpp +++ b/dbms/src/Functions/array/arraySlice.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arraySort.cpp b/dbms/src/Functions/array/arraySort.cpp index 17a711e8902..0b0a76c941e 100644 --- a/dbms/src/Functions/array/arraySort.cpp +++ b/dbms/src/Functions/array/arraySort.cpp @@ -1,5 +1,6 @@ #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arraySplit.cpp b/dbms/src/Functions/array/arraySplit.cpp index c23f3b0af21..7a29136e513 100644 --- a/dbms/src/Functions/array/arraySplit.cpp +++ b/dbms/src/Functions/array/arraySplit.cpp @@ -2,6 +2,7 @@ #include #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arraySum.cpp b/dbms/src/Functions/array/arraySum.cpp index ea4101fa556..fcb5796c592 100644 --- a/dbms/src/Functions/array/arraySum.cpp +++ b/dbms/src/Functions/array/arraySum.cpp @@ -4,6 +4,7 @@ #include #include "FunctionArrayMapped.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayUniq.cpp b/dbms/src/Functions/array/arrayUniq.cpp index 1b66a3da318..ad2b0044aee 100644 --- a/dbms/src/Functions/array/arrayUniq.cpp +++ b/dbms/src/Functions/array/arrayUniq.cpp @@ -11,6 +11,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayWithConstant.cpp b/dbms/src/Functions/array/arrayWithConstant.cpp index 0396f007aae..6d816939a6d 100644 --- a/dbms/src/Functions/array/arrayWithConstant.cpp +++ b/dbms/src/Functions/array/arrayWithConstant.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/arrayZip.cpp b/dbms/src/Functions/array/arrayZip.cpp index 20fca29bae8..93b3ceeee1c 100644 --- a/dbms/src/Functions/array/arrayZip.cpp +++ b/dbms/src/Functions/array/arrayZip.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/countEqual.cpp b/dbms/src/Functions/array/countEqual.cpp index fd4914e90f4..dfb0f902714 100644 --- a/dbms/src/Functions/array/countEqual.cpp +++ b/dbms/src/Functions/array/countEqual.cpp @@ -1,5 +1,6 @@ #include "arrayIndex.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/emptyArray.cpp b/dbms/src/Functions/array/emptyArray.cpp index 0a5b6473112..c981ff339ae 100644 --- a/dbms/src/Functions/array/emptyArray.cpp +++ b/dbms/src/Functions/array/emptyArray.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/emptyArrayToSingle.cpp b/dbms/src/Functions/array/emptyArrayToSingle.cpp index 27f4e01c547..404aded8fa2 100644 --- a/dbms/src/Functions/array/emptyArrayToSingle.cpp +++ b/dbms/src/Functions/array/emptyArrayToSingle.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/has.cpp b/dbms/src/Functions/array/has.cpp index 772facea52d..112ef2b85c7 100644 --- a/dbms/src/Functions/array/has.cpp +++ b/dbms/src/Functions/array/has.cpp @@ -1,5 +1,6 @@ #include "arrayIndex.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/hasAll.cpp b/dbms/src/Functions/array/hasAll.cpp index 6ae1640e382..bb67f21a0dd 100644 --- a/dbms/src/Functions/array/hasAll.cpp +++ b/dbms/src/Functions/array/hasAll.cpp @@ -1,5 +1,6 @@ #include "hasAllAny.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/hasAny.cpp b/dbms/src/Functions/array/hasAny.cpp index 756e5311b50..b71542d4eca 100644 --- a/dbms/src/Functions/array/hasAny.cpp +++ b/dbms/src/Functions/array/hasAny.cpp @@ -1,5 +1,6 @@ #include "hasAllAny.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/indexOf.cpp b/dbms/src/Functions/array/indexOf.cpp index d180a9f65d4..cc47d885762 100644 --- a/dbms/src/Functions/array/indexOf.cpp +++ b/dbms/src/Functions/array/indexOf.cpp @@ -1,5 +1,6 @@ #include "arrayIndex.h" #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/length.cpp b/dbms/src/Functions/array/length.cpp index 67267434794..3243e78dfb9 100644 --- a/dbms/src/Functions/array/length.cpp +++ b/dbms/src/Functions/array/length.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/range.cpp b/dbms/src/Functions/array/range.cpp index b04dcce7519..9ed508ce18d 100644 --- a/dbms/src/Functions/array/range.cpp +++ b/dbms/src/Functions/array/range.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "registerFunctionsArray.h" namespace DB diff --git a/dbms/src/Functions/array/registerFunctionsArray.cpp b/dbms/src/Functions/array/registerFunctionsArray.cpp index 2d78055b5fc..06a36d47f5c 100644 --- a/dbms/src/Functions/array/registerFunctionsArray.cpp +++ b/dbms/src/Functions/array/registerFunctionsArray.cpp @@ -1,39 +1,8 @@ +#include "registerFunctionsArray.h" + namespace DB { -class FunctionFactory; - -void registerFunctionArray(FunctionFactory &); -void registerFunctionArrayElement(FunctionFactory &); -void registerFunctionArrayResize(FunctionFactory &); -void registerFunctionHas(FunctionFactory &); -void registerFunctionHasAll(FunctionFactory &); -void registerFunctionHasAny(FunctionFactory &); -void registerFunctionIndexOf(FunctionFactory &); -void registerFunctionCountEqual(FunctionFactory &); -void registerFunctionArrayIntersect(FunctionFactory &); -void registerFunctionArrayPushFront(FunctionFactory &); -void registerFunctionArrayPushBack(FunctionFactory &); -void registerFunctionArrayPopFront(FunctionFactory &); -void registerFunctionArrayPopBack(FunctionFactory &); -void registerFunctionArrayConcat(FunctionFactory &); -void registerFunctionArraySlice(FunctionFactory &); -void registerFunctionArrayReverse(FunctionFactory &); -void registerFunctionArrayReduce(FunctionFactory &); -void registerFunctionRange(FunctionFactory &); -void registerFunctionsEmptyArray(FunctionFactory &); -void registerFunctionEmptyArrayToSingle(FunctionFactory &); -void registerFunctionArrayEnumerate(FunctionFactory &); -void registerFunctionArrayEnumerateUniq(FunctionFactory &); -void registerFunctionArrayEnumerateDense(FunctionFactory &); -void registerFunctionArrayEnumerateUniqRanked(FunctionFactory &); -void registerFunctionArrayEnumerateDenseRanked(FunctionFactory &); -void registerFunctionArrayUniq(FunctionFactory &); -void registerFunctionArrayDistinct(FunctionFactory &); -void registerFunctionArrayFlatten(FunctionFactory &); -void registerFunctionArrayWithConstant(FunctionFactory &); -void registerFunctionArrayZip(FunctionFactory &); - void registerFunctionsArray(FunctionFactory & factory) { registerFunctionArray(factory); diff --git a/dbms/src/Functions/array/registerFunctionsArray.h b/dbms/src/Functions/array/registerFunctionsArray.h new file mode 100644 index 00000000000..ab8fa210106 --- /dev/null +++ b/dbms/src/Functions/array/registerFunctionsArray.h @@ -0,0 +1,58 @@ +#pragma once + +namespace DB +{ +class FunctionFactory; + +void registerFunctionArray(FunctionFactory &); +void registerFunctionArrayElement(FunctionFactory &); +void registerFunctionArrayResize(FunctionFactory &); +void registerFunctionHas(FunctionFactory &); +void registerFunctionHasAll(FunctionFactory &); +void registerFunctionHasAny(FunctionFactory &); +void registerFunctionIndexOf(FunctionFactory &); +void registerFunctionCountEqual(FunctionFactory &); +void registerFunctionArrayIntersect(FunctionFactory &); +void registerFunctionArrayPushFront(FunctionFactory &); +void registerFunctionArrayPushBack(FunctionFactory &); +void registerFunctionArrayPopFront(FunctionFactory &); +void registerFunctionArrayPopBack(FunctionFactory &); +void registerFunctionArrayConcat(FunctionFactory &); +void registerFunctionArraySlice(FunctionFactory &); +void registerFunctionArrayReverse(FunctionFactory &); +void registerFunctionArrayReduce(FunctionFactory &); +void registerFunctionRange(FunctionFactory &); +void registerFunctionsEmptyArray(FunctionFactory &); +void registerFunctionEmptyArrayToSingle(FunctionFactory &); +void registerFunctionArrayEnumerate(FunctionFactory &); +void registerFunctionArrayEnumerateUniq(FunctionFactory &); +void registerFunctionArrayEnumerateDense(FunctionFactory &); +void registerFunctionArrayEnumerateUniqRanked(FunctionFactory &); +void registerFunctionArrayEnumerateDenseRanked(FunctionFactory &); +void registerFunctionArrayUniq(FunctionFactory &); +void registerFunctionArrayDistinct(FunctionFactory &); +void registerFunctionArrayFlatten(FunctionFactory &); +void registerFunctionArrayWithConstant(FunctionFactory &); +void registerFunctionArrayZip(FunctionFactory &); + +void registerFunctionArrayMap(FunctionFactory &); +void registerFunctionArrayFilter(FunctionFactory &); +void registerFunctionArrayCount(FunctionFactory &); +void registerFunctionArrayExists(FunctionFactory &); +void registerFunctionArrayAll(FunctionFactory &); +void registerFunctionArrayCompact(FunctionFactory &); +void registerFunctionArraySum(FunctionFactory &); +void registerFunctionArrayFirst(FunctionFactory &); +void registerFunctionArrayFirstIndex(FunctionFactory &); +void registerFunctionsArrayFill(FunctionFactory &); +void registerFunctionsArraySplit(FunctionFactory &); +void registerFunctionsArraySort(FunctionFactory &); +void registerFunctionArrayCumSum(FunctionFactory &); +void registerFunctionArrayCumSumNonNegative(FunctionFactory &); +void registerFunctionArrayDifference(FunctionFactory &); +void registerFunctionArrayJoin(FunctionFactory &); +void registerFunctionLength(FunctionFactory &); + +void registerFunctionsArray(FunctionFactory & factory); + +} diff --git a/dbms/src/Functions/asin.cpp b/dbms/src/Functions/asin.cpp index 147df233fe4..577256e3fbd 100644 --- a/dbms/src/Functions/asin.cpp +++ b/dbms/src/Functions/asin.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/assumeNotNull.cpp b/dbms/src/Functions/assumeNotNull.cpp index 4fc98e43b12..fb277e71a94 100644 --- a/dbms/src/Functions/assumeNotNull.cpp +++ b/dbms/src/Functions/assumeNotNull.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/atan.cpp b/dbms/src/Functions/atan.cpp index 751b508c7cd..a29a5ca7ffd 100644 --- a/dbms/src/Functions/atan.cpp +++ b/dbms/src/Functions/atan.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/bar.cpp b/dbms/src/Functions/bar.cpp index 7c0f962cd80..a95ad079a6f 100644 --- a/dbms/src/Functions/bar.cpp +++ b/dbms/src/Functions/bar.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB diff --git a/dbms/src/Functions/base64Decode.cpp b/dbms/src/Functions/base64Decode.cpp index 35c74ebc041..1167d68bb11 100644 --- a/dbms/src/Functions/base64Decode.cpp +++ b/dbms/src/Functions/base64Decode.cpp @@ -2,6 +2,7 @@ #if USE_BASE64 #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/base64Encode.cpp b/dbms/src/Functions/base64Encode.cpp index 482c7722bee..eccff39d3e1 100644 --- a/dbms/src/Functions/base64Encode.cpp +++ b/dbms/src/Functions/base64Encode.cpp @@ -1,5 +1,7 @@ #include #include +#include "config_functions.h" + #if USE_BASE64 #include diff --git a/dbms/src/Functions/bitAnd.cpp b/dbms/src/Functions/bitAnd.cpp index 0cf27ab9bc4..180c9456c70 100644 --- a/dbms/src/Functions/bitAnd.cpp +++ b/dbms/src/Functions/bitAnd.cpp @@ -1,5 +1,6 @@ #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/bitBoolMaskAnd.cpp b/dbms/src/Functions/bitBoolMaskAnd.cpp index eaa1a2a3343..3d7a3354fae 100644 --- a/dbms/src/Functions/bitBoolMaskAnd.cpp +++ b/dbms/src/Functions/bitBoolMaskAnd.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/bitBoolMaskOr.cpp b/dbms/src/Functions/bitBoolMaskOr.cpp index 903c3582375..4e5b0d9c0c4 100644 --- a/dbms/src/Functions/bitBoolMaskOr.cpp +++ b/dbms/src/Functions/bitBoolMaskOr.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/bitNot.cpp b/dbms/src/Functions/bitNot.cpp index 0317e9fce2d..d86daeb9187 100644 --- a/dbms/src/Functions/bitNot.cpp +++ b/dbms/src/Functions/bitNot.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "registerFunctions.h" namespace DB { diff --git a/dbms/src/Functions/extractTimeZoneFromFunctionArguments.h b/dbms/src/Functions/extractTimeZoneFromFunctionArguments.h index 7c90feb7da2..dea740f0ae5 100644 --- a/dbms/src/Functions/extractTimeZoneFromFunctionArguments.h +++ b/dbms/src/Functions/extractTimeZoneFromFunctionArguments.h @@ -1,3 +1,5 @@ +#pragma once + #include #include #include diff --git a/dbms/src/Functions/now64.cpp b/dbms/src/Functions/now64.cpp index 6f2faee6741..fbc2b7c1d99 100644 --- a/dbms/src/Functions/now64.cpp +++ b/dbms/src/Functions/now64.cpp @@ -18,7 +18,7 @@ namespace ErrorCodes extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; } -DateTime64::NativeType nowSubsecond(UInt32 scale) +static DateTime64::NativeType nowSubsecond(UInt32 scale) { const Int32 fractional_scale = 9; timespec spec; diff --git a/dbms/src/Functions/registerFunctions.cpp b/dbms/src/Functions/registerFunctions.cpp index 501f8e7f90a..178c92236af 100644 --- a/dbms/src/Functions/registerFunctions.cpp +++ b/dbms/src/Functions/registerFunctions.cpp @@ -1,46 +1,9 @@ #include +#include #include namespace DB { -/** These functions are defined in a separate translation units. - * This is done in order to reduce the consumption of RAM during build, and to speed up the parallel build. - */ -void registerFunctionsArithmetic(FunctionFactory &); -void registerFunctionsArray(FunctionFactory &); -void registerFunctionsTuple(FunctionFactory &); -void registerFunctionsBitmap(FunctionFactory &); -void registerFunctionsCoding(FunctionFactory &); -void registerFunctionsComparison(FunctionFactory &); -void registerFunctionsConditional(FunctionFactory &); -void registerFunctionsConversion(FunctionFactory &); -void registerFunctionsDateTime(FunctionFactory &); -void registerFunctionsEmbeddedDictionaries(FunctionFactory &); -void registerFunctionsExternalDictionaries(FunctionFactory &); -void registerFunctionsExternalModels(FunctionFactory &); -void registerFunctionsFormatting(FunctionFactory &); -void registerFunctionsHashing(FunctionFactory &); -void registerFunctionsHigherOrder(FunctionFactory &); -void registerFunctionsLogical(FunctionFactory &); -void registerFunctionsMiscellaneous(FunctionFactory &); -void registerFunctionsRandom(FunctionFactory &); -void registerFunctionsReinterpret(FunctionFactory &); -void registerFunctionsRound(FunctionFactory &); -void registerFunctionsString(FunctionFactory &); -void registerFunctionsStringArray(FunctionFactory &); -void registerFunctionsStringSearch(FunctionFactory &); -void registerFunctionsStringRegex(FunctionFactory &); -void registerFunctionsStringSimilarity(FunctionFactory &); -void registerFunctionsURL(FunctionFactory &); -void registerFunctionsVisitParam(FunctionFactory &); -void registerFunctionsMath(FunctionFactory &); -void registerFunctionsGeo(FunctionFactory &); -void registerFunctionsIntrospection(FunctionFactory &); -void registerFunctionsNull(FunctionFactory &); -void registerFunctionsFindCluster(FunctionFactory &); -void registerFunctionsJSON(FunctionFactory &); -void registerFunctionsIntrospection(FunctionFactory &); -void registerFunctionsConsistentHashing(FunctionFactory & factory); void registerFunctions() { diff --git a/dbms/src/Functions/registerFunctions.h b/dbms/src/Functions/registerFunctions.h index d426fb9ebef..087fd6b7e2b 100644 --- a/dbms/src/Functions/registerFunctions.h +++ b/dbms/src/Functions/registerFunctions.h @@ -1,7 +1,307 @@ #pragma once +#include "config_core.h" +#include "config_functions.h" namespace DB { +class FunctionFactory; + +void registerFunctionCurrentDatabase(FunctionFactory &); +void registerFunctionCurrentUser(FunctionFactory &); +void registerFunctionCurrentQuota(FunctionFactory &); +void registerFunctionHostName(FunctionFactory &); +void registerFunctionFQDN(FunctionFactory &); +void registerFunctionVisibleWidth(FunctionFactory &); +void registerFunctionToTypeName(FunctionFactory &); +void registerFunctionGetSizeOfEnumType(FunctionFactory &); +void registerFunctionToColumnTypeName(FunctionFactory &); +void registerFunctionDumpColumnStructure(FunctionFactory &); +void registerFunctionDefaultValueOfArgumentType(FunctionFactory &); +void registerFunctionBlockSize(FunctionFactory &); +void registerFunctionBlockNumber(FunctionFactory &); +void registerFunctionRowNumberInBlock(FunctionFactory &); +void registerFunctionRowNumberInAllBlocks(FunctionFactory &); +void registerFunctionNeighbor(FunctionFactory &); +void registerFunctionSleep(FunctionFactory &); +void registerFunctionSleepEachRow(FunctionFactory &); +void registerFunctionMaterialize(FunctionFactory &); +void registerFunctionIgnore(FunctionFactory &); +void registerFunctionIgnoreExceptNull(FunctionFactory &); +void registerFunctionIndexHint(FunctionFactory &); +void registerFunctionIdentity(FunctionFactory &); +void registerFunctionReplicate(FunctionFactory &); +void registerFunctionBar(FunctionFactory &); +void registerFunctionHasColumnInTable(FunctionFactory &); +void registerFunctionIsFinite(FunctionFactory &); +void registerFunctionIsInfinite(FunctionFactory &); +void registerFunctionIsNaN(FunctionFactory &); +void registerFunctionThrowIf(FunctionFactory &); +void registerFunctionVersion(FunctionFactory &); +void registerFunctionUptime(FunctionFactory &); +void registerFunctionTimeZone(FunctionFactory &); +void registerFunctionRunningAccumulate(FunctionFactory &); +void registerFunctionRunningDifference(FunctionFactory &); +void registerFunctionRunningDifferenceStartingWithFirstValue(FunctionFactory &); +void registerFunctionFinalizeAggregation(FunctionFactory &); +void registerFunctionToLowCardinality(FunctionFactory &); +void registerFunctionLowCardinalityIndices(FunctionFactory &); +void registerFunctionLowCardinalityKeys(FunctionFactory &); +void registerFunctionsIn(FunctionFactory &); +void registerFunctionJoinGet(FunctionFactory &); +void registerFunctionFilesystem(FunctionFactory &); +void registerFunctionEvalMLMethod(FunctionFactory &); +void registerFunctionBasename(FunctionFactory &); +void registerFunctionTransform(FunctionFactory &); +void registerFunctionGetMacro(FunctionFactory &); +void registerFunctionGetScalar(FunctionFactory &); + +#if USE_ICU +void registerFunctionConvertCharset(FunctionFactory &); +#endif + +void registerFunctionsArithmetic(FunctionFactory &); +void registerFunctionsTuple(FunctionFactory &); +void registerFunctionsBitmap(FunctionFactory &); +void registerFunctionsCoding(FunctionFactory &); +void registerFunctionsComparison(FunctionFactory &); +void registerFunctionsConditional(FunctionFactory &); +void registerFunctionsConversion(FunctionFactory &); +void registerFunctionsDateTime(FunctionFactory &); +void registerFunctionsEmbeddedDictionaries(FunctionFactory &); +void registerFunctionsExternalDictionaries(FunctionFactory &); +void registerFunctionsExternalModels(FunctionFactory &); +void registerFunctionsFormatting(FunctionFactory &); +void registerFunctionsHashing(FunctionFactory &); +void registerFunctionsHigherOrder(FunctionFactory &); +void registerFunctionsLogical(FunctionFactory &); +void registerFunctionsMiscellaneous(FunctionFactory &); +void registerFunctionsRandom(FunctionFactory &); +void registerFunctionsReinterpret(FunctionFactory &); +void registerFunctionsRound(FunctionFactory &); +void registerFunctionsString(FunctionFactory &); +void registerFunctionsStringArray(FunctionFactory &); +void registerFunctionsStringSearch(FunctionFactory &); +void registerFunctionsStringRegex(FunctionFactory &); +void registerFunctionsStringSimilarity(FunctionFactory &); +void registerFunctionsVisitParam(FunctionFactory &); +void registerFunctionsMath(FunctionFactory &); +void registerFunctionsGeo(FunctionFactory &); +void registerFunctionsIntrospection(FunctionFactory &); +void registerFunctionsNull(FunctionFactory &); +void registerFunctionsFindCluster(FunctionFactory &); +void registerFunctionsJSON(FunctionFactory &); +void registerFunctionsConsistentHashing(FunctionFactory & factory); + +void registerFunctionPlus(FunctionFactory & factory); +void registerFunctionMinus(FunctionFactory & factory); +void registerFunctionMultiply(FunctionFactory & factory); +void registerFunctionDivide(FunctionFactory & factory); +void registerFunctionIntDiv(FunctionFactory & factory); +void registerFunctionIntDivOrZero(FunctionFactory & factory); +void registerFunctionModulo(FunctionFactory & factory); +void registerFunctionNegate(FunctionFactory & factory); +void registerFunctionAbs(FunctionFactory & factory); +void registerFunctionBitAnd(FunctionFactory & factory); +void registerFunctionBitOr(FunctionFactory & factory); +void registerFunctionBitXor(FunctionFactory & factory); +void registerFunctionBitNot(FunctionFactory & factory); +void registerFunctionBitShiftLeft(FunctionFactory & factory); +void registerFunctionBitShiftRight(FunctionFactory & factory); +void registerFunctionBitRotateLeft(FunctionFactory & factory); +void registerFunctionBitRotateRight(FunctionFactory & factory); +void registerFunctionLeast(FunctionFactory & factory); +void registerFunctionGreatest(FunctionFactory & factory); +void registerFunctionBitTest(FunctionFactory & factory); +void registerFunctionBitTestAny(FunctionFactory & factory); +void registerFunctionBitTestAll(FunctionFactory & factory); +void registerFunctionGCD(FunctionFactory & factory); +void registerFunctionLCM(FunctionFactory & factory); +void registerFunctionIntExp2(FunctionFactory & factory); +void registerFunctionIntExp10(FunctionFactory & factory); +void registerFunctionRoundToExp2(FunctionFactory & factory); +void registerFunctionRoundDuration(FunctionFactory & factory); +void registerFunctionRoundAge(FunctionFactory & factory); + +void registerFunctionBitBoolMaskOr(FunctionFactory & factory); +void registerFunctionBitBoolMaskAnd(FunctionFactory & factory); +void registerFunctionBitWrapperFunc(FunctionFactory & factory); +void registerFunctionBitSwapLastTwo(FunctionFactory & factory); + +void registerFunctionEquals(FunctionFactory & factory); +void registerFunctionNotEquals(FunctionFactory & factory); +void registerFunctionLess(FunctionFactory & factory); +void registerFunctionGreater(FunctionFactory & factory); +void registerFunctionLessOrEquals(FunctionFactory & factory); +void registerFunctionGreaterOrEquals(FunctionFactory & factory); + +void registerFunctionIf(FunctionFactory & factory); +void registerFunctionMultiIf(FunctionFactory & factory); +void registerFunctionCaseWithExpression(FunctionFactory & factory); + +void registerFunctionYandexConsistentHash(FunctionFactory & factory); +void registerFunctionJumpConsistentHash(FunctionFactory & factory); +void registerFunctionSumburConsistentHash(FunctionFactory & factory); + +void registerFunctionToYear(FunctionFactory &); +void registerFunctionToQuarter(FunctionFactory &); +void registerFunctionToMonth(FunctionFactory &); +void registerFunctionToDayOfMonth(FunctionFactory &); +void registerFunctionToDayOfWeek(FunctionFactory &); +void registerFunctionToDayOfYear(FunctionFactory &); +void registerFunctionToHour(FunctionFactory &); +void registerFunctionToMinute(FunctionFactory &); +void registerFunctionToSecond(FunctionFactory &); +void registerFunctionToStartOfDay(FunctionFactory &); +void registerFunctionToMonday(FunctionFactory &); +void registerFunctionToISOWeek(FunctionFactory &); +void registerFunctionToISOYear(FunctionFactory &); +void registerFunctionToCustomWeek(FunctionFactory &); +void registerFunctionToStartOfMonth(FunctionFactory &); +void registerFunctionToStartOfQuarter(FunctionFactory &); +void registerFunctionToStartOfYear(FunctionFactory &); +void registerFunctionToStartOfMinute(FunctionFactory &); +void registerFunctionToStartOfFiveMinute(FunctionFactory &); +void registerFunctionToStartOfTenMinutes(FunctionFactory &); +void registerFunctionToStartOfFifteenMinutes(FunctionFactory &); +void registerFunctionToStartOfHour(FunctionFactory &); +void registerFunctionToStartOfInterval(FunctionFactory &); +void registerFunctionToStartOfISOYear(FunctionFactory &); +void registerFunctionToRelativeYearNum(FunctionFactory &); +void registerFunctionToRelativeQuarterNum(FunctionFactory &); +void registerFunctionToRelativeMonthNum(FunctionFactory &); +void registerFunctionToRelativeWeekNum(FunctionFactory &); +void registerFunctionToRelativeDayNum(FunctionFactory &); +void registerFunctionToRelativeHourNum(FunctionFactory &); +void registerFunctionToRelativeMinuteNum(FunctionFactory &); +void registerFunctionToRelativeSecondNum(FunctionFactory &); +void registerFunctionToTime(FunctionFactory &); +void registerFunctionNow(FunctionFactory &); +void registerFunctionNow64(FunctionFactory &); +void registerFunctionToday(FunctionFactory &); +void registerFunctionYesterday(FunctionFactory &); +void registerFunctionTimeSlot(FunctionFactory &); +void registerFunctionTimeSlots(FunctionFactory &); +void registerFunctionToYYYYMM(FunctionFactory &); +void registerFunctionToYYYYMMDD(FunctionFactory &); +void registerFunctionToYYYYMMDDhhmmss(FunctionFactory &); +void registerFunctionAddSeconds(FunctionFactory &); +void registerFunctionAddMinutes(FunctionFactory &); +void registerFunctionAddHours(FunctionFactory &); +void registerFunctionAddDays(FunctionFactory &); +void registerFunctionAddWeeks(FunctionFactory &); +void registerFunctionAddMonths(FunctionFactory &); +void registerFunctionAddQuarters(FunctionFactory &); +void registerFunctionAddYears(FunctionFactory &); +void registerFunctionSubtractSeconds(FunctionFactory &); +void registerFunctionSubtractMinutes(FunctionFactory &); +void registerFunctionSubtractHours(FunctionFactory &); +void registerFunctionSubtractDays(FunctionFactory &); +void registerFunctionSubtractWeeks(FunctionFactory &); +void registerFunctionSubtractMonths(FunctionFactory &); +void registerFunctionSubtractQuarters(FunctionFactory &); +void registerFunctionSubtractYears(FunctionFactory &); +void registerFunctionDateDiff(FunctionFactory &); +void registerFunctionToTimeZone(FunctionFactory &); +void registerFunctionFormatDateTime(FunctionFactory &); + +void registerFunctionGeoDistance(FunctionFactory & factory); +void registerFunctionPointInEllipses(FunctionFactory & factory); +void registerFunctionPointInPolygon(FunctionFactory & factory); +void registerFunctionGeohashEncode(FunctionFactory & factory); +void registerFunctionGeohashDecode(FunctionFactory & factory); +void registerFunctionGeohashesInBox(FunctionFactory & factory); + +#if USE_H3 +void registerFunctionGeoToH3(FunctionFactory &); +void registerFunctionH3EdgeAngle(FunctionFactory &); +void registerFunctionH3EdgeLengthM(FunctionFactory &); +void registerFunctionH3GetResolution(FunctionFactory &); +void registerFunctionH3IsValid(FunctionFactory &); +void registerFunctionH3KRing(FunctionFactory &); +#endif + +#if defined(OS_LINUX) +void registerFunctionAddressToSymbol(FunctionFactory & factory); +void registerFunctionAddressToLine(FunctionFactory & factory); +#endif +void registerFunctionDemangle(FunctionFactory & factory); +void registerFunctionTrap(FunctionFactory & factory); + +void registerFunctionE(FunctionFactory & factory); +void registerFunctionPi(FunctionFactory & factory); +void registerFunctionExp(FunctionFactory & factory); +void registerFunctionLog(FunctionFactory & factory); +void registerFunctionExp2(FunctionFactory & factory); +void registerFunctionLog2(FunctionFactory & factory); +void registerFunctionExp10(FunctionFactory & factory); +void registerFunctionLog10(FunctionFactory & factory); +void registerFunctionSqrt(FunctionFactory & factory); +void registerFunctionCbrt(FunctionFactory & factory); +void registerFunctionErf(FunctionFactory & factory); +void registerFunctionErfc(FunctionFactory & factory); +void registerFunctionLGamma(FunctionFactory & factory); +void registerFunctionTGamma(FunctionFactory & factory); +void registerFunctionSin(FunctionFactory & factory); +void registerFunctionCos(FunctionFactory & factory); +void registerFunctionTan(FunctionFactory & factory); +void registerFunctionAsin(FunctionFactory & factory); +void registerFunctionAcos(FunctionFactory & factory); +void registerFunctionAtan(FunctionFactory & factory); +void registerFunctionSigmoid(FunctionFactory & factory); +void registerFunctionTanh(FunctionFactory & factory); +void registerFunctionPow(FunctionFactory & factory); + +void registerFunctionIsNull(FunctionFactory & factory); +void registerFunctionIsNotNull(FunctionFactory & factory); +void registerFunctionCoalesce(FunctionFactory & factory); +void registerFunctionIfNull(FunctionFactory & factory); +void registerFunctionNullIf(FunctionFactory & factory); +void registerFunctionAssumeNotNull(FunctionFactory & factory); +void registerFunctionToNullable(FunctionFactory & factory); + +void registerFunctionRand(FunctionFactory & factory); +void registerFunctionRand64(FunctionFactory & factory); +void registerFunctionRandConstant(FunctionFactory & factory); +void registerFunctionGenerateUUIDv4(FunctionFactory & factory); + +void registerFunctionRepeat(FunctionFactory &); +void registerFunctionEmpty(FunctionFactory &); +void registerFunctionNotEmpty(FunctionFactory &); +void registerFunctionLengthUTF8(FunctionFactory &); +void registerFunctionIsValidUTF8(FunctionFactory &); +void registerFunctionToValidUTF8(FunctionFactory &); +void registerFunctionLower(FunctionFactory &); +void registerFunctionUpper(FunctionFactory &); +void registerFunctionLowerUTF8(FunctionFactory &); +void registerFunctionUpperUTF8(FunctionFactory &); +void registerFunctionReverse(FunctionFactory &); +void registerFunctionReverseUTF8(FunctionFactory &); +void registerFunctionsConcat(FunctionFactory &); +void registerFunctionFormat(FunctionFactory &); +void registerFunctionSubstring(FunctionFactory &); +void registerFunctionCRC(FunctionFactory &); +void registerFunctionAppendTrailingCharIfAbsent(FunctionFactory &); +void registerFunctionStartsWith(FunctionFactory &); +void registerFunctionEndsWith(FunctionFactory &); +void registerFunctionTrim(FunctionFactory &); +void registerFunctionRegexpQuoteMeta(FunctionFactory &); + +#if USE_BASE64 +void registerFunctionBase64Encode(FunctionFactory &); +void registerFunctionBase64Decode(FunctionFactory &); +void registerFunctionTryBase64Decode(FunctionFactory &); +#endif + +void registerFunctionTuple(FunctionFactory &); +void registerFunctionTupleElement(FunctionFactory &); + +void registerFunctionVisitParamHas(FunctionFactory & factory); +void registerFunctionVisitParamExtractUInt(FunctionFactory & factory); +void registerFunctionVisitParamExtractInt(FunctionFactory & factory); +void registerFunctionVisitParamExtractFloat(FunctionFactory & factory); +void registerFunctionVisitParamExtractBool(FunctionFactory & factory); +void registerFunctionVisitParamExtractRaw(FunctionFactory & factory); +void registerFunctionVisitParamExtractString(FunctionFactory & factory); void registerFunctions(); diff --git a/dbms/src/Functions/registerFunctionsArithmetic.cpp b/dbms/src/Functions/registerFunctionsArithmetic.cpp index 1faa28e395e..4d05fe0d885 100644 --- a/dbms/src/Functions/registerFunctionsArithmetic.cpp +++ b/dbms/src/Functions/registerFunctionsArithmetic.cpp @@ -1,43 +1,6 @@ +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionPlus(FunctionFactory & factory); -void registerFunctionMinus(FunctionFactory & factory); -void registerFunctionMultiply(FunctionFactory & factory); -void registerFunctionDivide(FunctionFactory & factory); -void registerFunctionIntDiv(FunctionFactory & factory); -void registerFunctionIntDivOrZero(FunctionFactory & factory); -void registerFunctionModulo(FunctionFactory & factory); -void registerFunctionNegate(FunctionFactory & factory); -void registerFunctionAbs(FunctionFactory & factory); -void registerFunctionBitAnd(FunctionFactory & factory); -void registerFunctionBitOr(FunctionFactory & factory); -void registerFunctionBitXor(FunctionFactory & factory); -void registerFunctionBitNot(FunctionFactory & factory); -void registerFunctionBitShiftLeft(FunctionFactory & factory); -void registerFunctionBitShiftRight(FunctionFactory & factory); -void registerFunctionBitRotateLeft(FunctionFactory & factory); -void registerFunctionBitRotateRight(FunctionFactory & factory); -void registerFunctionLeast(FunctionFactory & factory); -void registerFunctionGreatest(FunctionFactory & factory); -void registerFunctionBitTest(FunctionFactory & factory); -void registerFunctionBitTestAny(FunctionFactory & factory); -void registerFunctionBitTestAll(FunctionFactory & factory); -void registerFunctionGCD(FunctionFactory & factory); -void registerFunctionLCM(FunctionFactory & factory); -void registerFunctionIntExp2(FunctionFactory & factory); -void registerFunctionIntExp10(FunctionFactory & factory); -void registerFunctionRoundToExp2(FunctionFactory & factory); -void registerFunctionRoundDuration(FunctionFactory & factory); -void registerFunctionRoundAge(FunctionFactory & factory); - -void registerFunctionBitBoolMaskOr(FunctionFactory & factory); -void registerFunctionBitBoolMaskAnd(FunctionFactory & factory); -void registerFunctionBitWrapperFunc(FunctionFactory & factory); -void registerFunctionBitSwapLastTwo(FunctionFactory & factory); - void registerFunctionsArithmetic(FunctionFactory & factory) { registerFunctionPlus(factory); diff --git a/dbms/src/Functions/registerFunctionsComparison.cpp b/dbms/src/Functions/registerFunctionsComparison.cpp index f9ceb6e4821..5ea2f2034a0 100644 --- a/dbms/src/Functions/registerFunctionsComparison.cpp +++ b/dbms/src/Functions/registerFunctionsComparison.cpp @@ -1,15 +1,6 @@ +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionEquals(FunctionFactory & factory); -void registerFunctionNotEquals(FunctionFactory & factory); -void registerFunctionLess(FunctionFactory & factory); -void registerFunctionGreater(FunctionFactory & factory); -void registerFunctionLessOrEquals(FunctionFactory & factory); -void registerFunctionGreaterOrEquals(FunctionFactory & factory); - void registerFunctionsComparison(FunctionFactory & factory) { registerFunctionEquals(factory); diff --git a/dbms/src/Functions/registerFunctionsConditional.cpp b/dbms/src/Functions/registerFunctionsConditional.cpp index 782399c1d4b..23704ae5d65 100644 --- a/dbms/src/Functions/registerFunctionsConditional.cpp +++ b/dbms/src/Functions/registerFunctionsConditional.cpp @@ -1,12 +1,6 @@ +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionIf(FunctionFactory & factory); -void registerFunctionMultiIf(FunctionFactory & factory); -void registerFunctionCaseWithExpression(FunctionFactory & factory); - void registerFunctionsConditional(FunctionFactory & factory) { registerFunctionIf(factory); @@ -15,6 +9,3 @@ void registerFunctionsConditional(FunctionFactory & factory) } } - - - diff --git a/dbms/src/Functions/registerFunctionsConsistentHashing.cpp b/dbms/src/Functions/registerFunctionsConsistentHashing.cpp index dc1e90826bf..b5eb232558c 100644 --- a/dbms/src/Functions/registerFunctionsConsistentHashing.cpp +++ b/dbms/src/Functions/registerFunctionsConsistentHashing.cpp @@ -1,12 +1,6 @@ +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionYandexConsistentHash(FunctionFactory & factory); -void registerFunctionJumpConsistentHash(FunctionFactory & factory); -void registerFunctionSumburConsistentHash(FunctionFactory & factory); - void registerFunctionsConsistentHashing(FunctionFactory & factory) { registerFunctionYandexConsistentHash(factory); @@ -15,4 +9,3 @@ void registerFunctionsConsistentHashing(FunctionFactory & factory) } } - diff --git a/dbms/src/Functions/registerFunctionsDateTime.cpp b/dbms/src/Functions/registerFunctionsDateTime.cpp index a8489dbc5c1..3714f62a410 100644 --- a/dbms/src/Functions/registerFunctionsDateTime.cpp +++ b/dbms/src/Functions/registerFunctionsDateTime.cpp @@ -1,71 +1,6 @@ +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionToYear(FunctionFactory &); -void registerFunctionToQuarter(FunctionFactory &); -void registerFunctionToMonth(FunctionFactory &); -void registerFunctionToDayOfMonth(FunctionFactory &); -void registerFunctionToDayOfWeek(FunctionFactory &); -void registerFunctionToDayOfYear(FunctionFactory &); -void registerFunctionToHour(FunctionFactory &); -void registerFunctionToMinute(FunctionFactory &); -void registerFunctionToSecond(FunctionFactory &); -void registerFunctionToStartOfDay(FunctionFactory &); -void registerFunctionToMonday(FunctionFactory &); -void registerFunctionToISOWeek(FunctionFactory &); -void registerFunctionToISOYear(FunctionFactory &); -void registerFunctionToCustomWeek(FunctionFactory &); -void registerFunctionToStartOfMonth(FunctionFactory &); -void registerFunctionToStartOfQuarter(FunctionFactory &); -void registerFunctionToStartOfYear(FunctionFactory &); -void registerFunctionToStartOfMinute(FunctionFactory &); -void registerFunctionToStartOfFiveMinute(FunctionFactory &); -void registerFunctionToStartOfTenMinutes(FunctionFactory &); -void registerFunctionToStartOfFifteenMinutes(FunctionFactory &); -void registerFunctionToStartOfHour(FunctionFactory &); -void registerFunctionToStartOfInterval(FunctionFactory &); -void registerFunctionToStartOfISOYear(FunctionFactory &); -void registerFunctionToRelativeYearNum(FunctionFactory &); -void registerFunctionToRelativeQuarterNum(FunctionFactory &); -void registerFunctionToRelativeMonthNum(FunctionFactory &); -void registerFunctionToRelativeWeekNum(FunctionFactory &); -void registerFunctionToRelativeDayNum(FunctionFactory &); -void registerFunctionToRelativeHourNum(FunctionFactory &); -void registerFunctionToRelativeMinuteNum(FunctionFactory &); -void registerFunctionToRelativeSecondNum(FunctionFactory &); -void registerFunctionToTime(FunctionFactory &); -void registerFunctionNow(FunctionFactory &); -void registerFunctionNow64(FunctionFactory &); -void registerFunctionToday(FunctionFactory &); -void registerFunctionYesterday(FunctionFactory &); -void registerFunctionTimeSlot(FunctionFactory &); -void registerFunctionTimeSlots(FunctionFactory &); -void registerFunctionToYYYYMM(FunctionFactory &); -void registerFunctionToYYYYMMDD(FunctionFactory &); -void registerFunctionToYYYYMMDDhhmmss(FunctionFactory &); -void registerFunctionAddSeconds(FunctionFactory &); -void registerFunctionAddMinutes(FunctionFactory &); -void registerFunctionAddHours(FunctionFactory &); -void registerFunctionAddDays(FunctionFactory &); -void registerFunctionAddWeeks(FunctionFactory &); -void registerFunctionAddMonths(FunctionFactory &); -void registerFunctionAddQuarters(FunctionFactory &); -void registerFunctionAddYears(FunctionFactory &); -void registerFunctionSubtractSeconds(FunctionFactory &); -void registerFunctionSubtractMinutes(FunctionFactory &); -void registerFunctionSubtractHours(FunctionFactory &); -void registerFunctionSubtractDays(FunctionFactory &); -void registerFunctionSubtractWeeks(FunctionFactory &); -void registerFunctionSubtractMonths(FunctionFactory &); -void registerFunctionSubtractQuarters(FunctionFactory &); -void registerFunctionSubtractYears(FunctionFactory &); -void registerFunctionDateDiff(FunctionFactory &); -void registerFunctionToTimeZone(FunctionFactory &); -void registerFunctionFormatDateTime(FunctionFactory &); - - void registerFunctionsDateTime(FunctionFactory & factory) { registerFunctionToYear(factory); diff --git a/dbms/src/Functions/registerFunctionsGeo.cpp b/dbms/src/Functions/registerFunctionsGeo.cpp index d1a251bacbf..7dc7ab471a8 100644 --- a/dbms/src/Functions/registerFunctionsGeo.cpp +++ b/dbms/src/Functions/registerFunctionsGeo.cpp @@ -1,26 +1,7 @@ -#include "config_functions.h" +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionGeoDistance(FunctionFactory & factory); -void registerFunctionPointInEllipses(FunctionFactory & factory); -void registerFunctionPointInPolygon(FunctionFactory & factory); -void registerFunctionGeohashEncode(FunctionFactory & factory); -void registerFunctionGeohashDecode(FunctionFactory & factory); -void registerFunctionGeohashesInBox(FunctionFactory & factory); - -#if USE_H3 -void registerFunctionGeoToH3(FunctionFactory &); -void registerFunctionH3EdgeAngle(FunctionFactory &); -void registerFunctionH3EdgeLengthM(FunctionFactory &); -void registerFunctionH3GetResolution(FunctionFactory &); -void registerFunctionH3IsValid(FunctionFactory &); -void registerFunctionH3KRing(FunctionFactory &); -#endif - void registerFunctionsGeo(FunctionFactory & factory) { registerFunctionGeoDistance(factory); @@ -41,4 +22,3 @@ void registerFunctionsGeo(FunctionFactory & factory) } } - diff --git a/dbms/src/Functions/registerFunctionsHigherOrder.cpp b/dbms/src/Functions/registerFunctionsHigherOrder.cpp index 8a9a47b48a3..42c639f6926 100644 --- a/dbms/src/Functions/registerFunctionsHigherOrder.cpp +++ b/dbms/src/Functions/registerFunctionsHigherOrder.cpp @@ -1,24 +1,8 @@ +#include "registerFunctions.h" +#include "array/registerFunctionsArray.h" + namespace DB { - -class FunctionFactory; - -void registerFunctionArrayMap(FunctionFactory &); -void registerFunctionArrayFilter(FunctionFactory &); -void registerFunctionArrayCount(FunctionFactory &); -void registerFunctionArrayExists(FunctionFactory &); -void registerFunctionArrayAll(FunctionFactory &); -void registerFunctionArrayCompact(FunctionFactory &); -void registerFunctionArraySum(FunctionFactory &); -void registerFunctionArrayFirst(FunctionFactory &); -void registerFunctionArrayFirstIndex(FunctionFactory &); -void registerFunctionsArrayFill(FunctionFactory &); -void registerFunctionsArraySplit(FunctionFactory &); -void registerFunctionsArraySort(FunctionFactory &); -void registerFunctionArrayCumSum(FunctionFactory &); -void registerFunctionArrayCumSumNonNegative(FunctionFactory &); -void registerFunctionArrayDifference(FunctionFactory &); - void registerFunctionsHigherOrder(FunctionFactory & factory) { registerFunctionArrayMap(factory); diff --git a/dbms/src/Functions/registerFunctionsIntrospection.cpp b/dbms/src/Functions/registerFunctionsIntrospection.cpp index 267c2e0bef9..9eb92ef57c5 100644 --- a/dbms/src/Functions/registerFunctionsIntrospection.cpp +++ b/dbms/src/Functions/registerFunctionsIntrospection.cpp @@ -1,17 +1,7 @@ -#include +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -#if defined(OS_LINUX) -void registerFunctionAddressToSymbol(FunctionFactory & factory); -void registerFunctionAddressToLine(FunctionFactory & factory); -#endif -void registerFunctionDemangle(FunctionFactory & factory); -void registerFunctionTrap(FunctionFactory & factory); - void registerFunctionsIntrospection(FunctionFactory & factory) { #if defined(OS_LINUX) diff --git a/dbms/src/Functions/registerFunctionsMath.cpp b/dbms/src/Functions/registerFunctionsMath.cpp index 2a963d1ee79..a34bf9fb987 100644 --- a/dbms/src/Functions/registerFunctionsMath.cpp +++ b/dbms/src/Functions/registerFunctionsMath.cpp @@ -1,32 +1,6 @@ +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionE(FunctionFactory & factory); -void registerFunctionPi(FunctionFactory & factory); -void registerFunctionExp(FunctionFactory & factory); -void registerFunctionLog(FunctionFactory & factory); -void registerFunctionExp2(FunctionFactory & factory); -void registerFunctionLog2(FunctionFactory & factory); -void registerFunctionExp10(FunctionFactory & factory); -void registerFunctionLog10(FunctionFactory & factory); -void registerFunctionSqrt(FunctionFactory & factory); -void registerFunctionCbrt(FunctionFactory & factory); -void registerFunctionErf(FunctionFactory & factory); -void registerFunctionErfc(FunctionFactory & factory); -void registerFunctionLGamma(FunctionFactory & factory); -void registerFunctionTGamma(FunctionFactory & factory); -void registerFunctionSin(FunctionFactory & factory); -void registerFunctionCos(FunctionFactory & factory); -void registerFunctionTan(FunctionFactory & factory); -void registerFunctionAsin(FunctionFactory & factory); -void registerFunctionAcos(FunctionFactory & factory); -void registerFunctionAtan(FunctionFactory & factory); -void registerFunctionSigmoid(FunctionFactory & factory); -void registerFunctionTanh(FunctionFactory & factory); -void registerFunctionPow(FunctionFactory & factory); - void registerFunctionsMath(FunctionFactory & factory) { registerFunctionE(factory); @@ -55,4 +29,3 @@ void registerFunctionsMath(FunctionFactory & factory) } } - diff --git a/dbms/src/Functions/registerFunctionsMiscellaneous.cpp b/dbms/src/Functions/registerFunctionsMiscellaneous.cpp index 9529cd3a56a..c45ccf57f64 100644 --- a/dbms/src/Functions/registerFunctionsMiscellaneous.cpp +++ b/dbms/src/Functions/registerFunctionsMiscellaneous.cpp @@ -1,64 +1,8 @@ -#include "config_core.h" +#include +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionCurrentDatabase(FunctionFactory &); -void registerFunctionCurrentUser(FunctionFactory &); -void registerFunctionCurrentQuota(FunctionFactory &); -void registerFunctionHostName(FunctionFactory &); -void registerFunctionFQDN(FunctionFactory &); -void registerFunctionVisibleWidth(FunctionFactory &); -void registerFunctionToTypeName(FunctionFactory &); -void registerFunctionGetSizeOfEnumType(FunctionFactory &); -void registerFunctionToColumnTypeName(FunctionFactory &); -void registerFunctionDumpColumnStructure(FunctionFactory &); -void registerFunctionDefaultValueOfArgumentType(FunctionFactory &); -void registerFunctionBlockSize(FunctionFactory &); -void registerFunctionBlockNumber(FunctionFactory &); -void registerFunctionRowNumberInBlock(FunctionFactory &); -void registerFunctionRowNumberInAllBlocks(FunctionFactory &); -void registerFunctionNeighbor(FunctionFactory &); -void registerFunctionSleep(FunctionFactory &); -void registerFunctionSleepEachRow(FunctionFactory &); -void registerFunctionMaterialize(FunctionFactory &); -void registerFunctionIgnore(FunctionFactory &); -void registerFunctionIgnoreExceptNull(FunctionFactory &); -void registerFunctionIndexHint(FunctionFactory &); -void registerFunctionIdentity(FunctionFactory &); -void registerFunctionArrayJoin(FunctionFactory &); -void registerFunctionReplicate(FunctionFactory &); -void registerFunctionBar(FunctionFactory &); -void registerFunctionHasColumnInTable(FunctionFactory &); -void registerFunctionIsFinite(FunctionFactory &); -void registerFunctionIsInfinite(FunctionFactory &); -void registerFunctionIsNaN(FunctionFactory &); -void registerFunctionThrowIf(FunctionFactory &); -void registerFunctionVersion(FunctionFactory &); -void registerFunctionUptime(FunctionFactory &); -void registerFunctionTimeZone(FunctionFactory &); -void registerFunctionRunningAccumulate(FunctionFactory &); -void registerFunctionRunningDifference(FunctionFactory &); -void registerFunctionRunningDifferenceStartingWithFirstValue(FunctionFactory &); -void registerFunctionFinalizeAggregation(FunctionFactory &); -void registerFunctionToLowCardinality(FunctionFactory &); -void registerFunctionLowCardinalityIndices(FunctionFactory &); -void registerFunctionLowCardinalityKeys(FunctionFactory &); -void registerFunctionsIn(FunctionFactory &); -void registerFunctionJoinGet(FunctionFactory &); -void registerFunctionFilesystem(FunctionFactory &); -void registerFunctionEvalMLMethod(FunctionFactory &); -void registerFunctionBasename(FunctionFactory &); -void registerFunctionTransform(FunctionFactory &); -void registerFunctionGetMacro(FunctionFactory &); -void registerFunctionGetScalar(FunctionFactory &); - -#if USE_ICU -void registerFunctionConvertCharset(FunctionFactory &); -#endif - void registerFunctionsMiscellaneous(FunctionFactory & factory) { registerFunctionCurrentDatabase(factory); diff --git a/dbms/src/Functions/registerFunctionsNull.cpp b/dbms/src/Functions/registerFunctionsNull.cpp index 0cc447c3db3..dd73ea2c16e 100644 --- a/dbms/src/Functions/registerFunctionsNull.cpp +++ b/dbms/src/Functions/registerFunctionsNull.cpp @@ -1,16 +1,6 @@ +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionIsNull(FunctionFactory & factory); -void registerFunctionIsNotNull(FunctionFactory & factory); -void registerFunctionCoalesce(FunctionFactory & factory); -void registerFunctionIfNull(FunctionFactory & factory); -void registerFunctionNullIf(FunctionFactory & factory); -void registerFunctionAssumeNotNull(FunctionFactory & factory); -void registerFunctionToNullable(FunctionFactory & factory); - void registerFunctionsNull(FunctionFactory & factory) { registerFunctionIsNull(factory); @@ -23,4 +13,3 @@ void registerFunctionsNull(FunctionFactory & factory) } } - diff --git a/dbms/src/Functions/registerFunctionsRandom.cpp b/dbms/src/Functions/registerFunctionsRandom.cpp index 92a0505d530..6bf41df6b22 100644 --- a/dbms/src/Functions/registerFunctionsRandom.cpp +++ b/dbms/src/Functions/registerFunctionsRandom.cpp @@ -1,13 +1,6 @@ +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionRand(FunctionFactory & factory); -void registerFunctionRand64(FunctionFactory & factory); -void registerFunctionRandConstant(FunctionFactory & factory); -void registerFunctionGenerateUUIDv4(FunctionFactory & factory); - void registerFunctionsRandom(FunctionFactory & factory) { registerFunctionRand(factory); @@ -17,5 +10,3 @@ void registerFunctionsRandom(FunctionFactory & factory) } } - - diff --git a/dbms/src/Functions/registerFunctionsString.cpp b/dbms/src/Functions/registerFunctionsString.cpp index df407750d35..3c8020432a9 100644 --- a/dbms/src/Functions/registerFunctionsString.cpp +++ b/dbms/src/Functions/registerFunctionsString.cpp @@ -1,38 +1,9 @@ +#include #include "config_functions.h" +#include "registerFunctions.h" namespace DB { -class FunctionFactory; - -void registerFunctionRepeat(FunctionFactory &); -void registerFunctionEmpty(FunctionFactory &); -void registerFunctionNotEmpty(FunctionFactory &); -void registerFunctionLength(FunctionFactory &); -void registerFunctionLengthUTF8(FunctionFactory &); -void registerFunctionIsValidUTF8(FunctionFactory &); -void registerFunctionToValidUTF8(FunctionFactory &); -void registerFunctionLower(FunctionFactory &); -void registerFunctionUpper(FunctionFactory &); -void registerFunctionLowerUTF8(FunctionFactory &); -void registerFunctionUpperUTF8(FunctionFactory &); -void registerFunctionReverse(FunctionFactory &); -void registerFunctionReverseUTF8(FunctionFactory &); -void registerFunctionsConcat(FunctionFactory &); -void registerFunctionFormat(FunctionFactory &); -void registerFunctionSubstring(FunctionFactory &); -void registerFunctionCRC(FunctionFactory &); -void registerFunctionAppendTrailingCharIfAbsent(FunctionFactory &); -void registerFunctionStartsWith(FunctionFactory &); -void registerFunctionEndsWith(FunctionFactory &); -void registerFunctionTrim(FunctionFactory &); -void registerFunctionRegexpQuoteMeta(FunctionFactory &); - -#if USE_BASE64 -void registerFunctionBase64Encode(FunctionFactory &); -void registerFunctionBase64Decode(FunctionFactory &); -void registerFunctionTryBase64Decode(FunctionFactory &); -#endif - void registerFunctionsString(FunctionFactory & factory) { registerFunctionRepeat(factory); diff --git a/dbms/src/Functions/registerFunctionsTuple.cpp b/dbms/src/Functions/registerFunctionsTuple.cpp index 12092e1e7e0..d5a16734dd1 100644 --- a/dbms/src/Functions/registerFunctionsTuple.cpp +++ b/dbms/src/Functions/registerFunctionsTuple.cpp @@ -1,11 +1,6 @@ +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionTuple(FunctionFactory &); -void registerFunctionTupleElement(FunctionFactory &); - void registerFunctionsTuple(FunctionFactory & factory) { registerFunctionTuple(factory); diff --git a/dbms/src/Functions/registerFunctionsVisitParam.cpp b/dbms/src/Functions/registerFunctionsVisitParam.cpp index 01084594f08..db3fffc9dcc 100644 --- a/dbms/src/Functions/registerFunctionsVisitParam.cpp +++ b/dbms/src/Functions/registerFunctionsVisitParam.cpp @@ -1,16 +1,6 @@ +#include "registerFunctions.h" namespace DB { - -class FunctionFactory; - -void registerFunctionVisitParamHas(FunctionFactory & factory); -void registerFunctionVisitParamExtractUInt(FunctionFactory & factory); -void registerFunctionVisitParamExtractInt(FunctionFactory & factory); -void registerFunctionVisitParamExtractFloat(FunctionFactory & factory); -void registerFunctionVisitParamExtractBool(FunctionFactory & factory); -void registerFunctionVisitParamExtractRaw(FunctionFactory & factory); -void registerFunctionVisitParamExtractString(FunctionFactory & factory); - void registerFunctionsVisitParam(FunctionFactory & factory) { registerFunctionVisitParamHas(factory); diff --git a/dbms/src/Functions/tests/number_traits.cpp b/dbms/src/Functions/tests/number_traits.cpp index 05fbb4a8824..f32ffd5ea97 100644 --- a/dbms/src/Functions/tests/number_traits.cpp +++ b/dbms/src/Functions/tests/number_traits.cpp @@ -3,17 +3,17 @@ #include -void printType(DB::UInt8) { std::cout << "UInt8"; } -void printType(DB::UInt16) { std::cout << "UInt16"; } -void printType(DB::UInt32) { std::cout << "UInt32"; } -void printType(DB::UInt64) { std::cout << "UInt64"; } -void printType(DB::Int8) { std::cout << "Int8"; } -void printType(DB::Int16) { std::cout << "Int16"; } -void printType(DB::Int32) { std::cout << "Int32"; } -void printType(DB::Int64) { std::cout << "Int64"; } -void printType(DB::Float32) { std::cout << "Float32"; } -void printType(DB::Float64) { std::cout << "Float64"; } -void printType(DB::NumberTraits::Error) { std::cout << "Error"; } +static void printType(DB::UInt8) { std::cout << "UInt8"; } +static void printType(DB::UInt16) { std::cout << "UInt16"; } +static void printType(DB::UInt32) { std::cout << "UInt32"; } +static void printType(DB::UInt64) { std::cout << "UInt64"; } +static void printType(DB::Int8) { std::cout << "Int8"; } +static void printType(DB::Int16) { std::cout << "Int16"; } +static void printType(DB::Int32) { std::cout << "Int32"; } +static void printType(DB::Int64) { std::cout << "Int64"; } +static void printType(DB::Float32) { std::cout << "Float32"; } +static void printType(DB::Float64) { std::cout << "Float64"; } +static void printType(DB::NumberTraits::Error) { std::cout << "Error"; } template void ifRightType() diff --git a/dbms/src/Functions/trap.cpp b/dbms/src/Functions/trap.cpp index 14cd6075a88..217b7091dc1 100644 --- a/dbms/src/Functions/trap.cpp +++ b/dbms/src/Functions/trap.cpp @@ -1,3 +1,4 @@ +#include "registerFunctions.h" #if 0 #include diff --git a/dbms/src/IO/ReadHelpers.h b/dbms/src/IO/ReadHelpers.h index 140af9afff3..47206039435 100644 --- a/dbms/src/IO/ReadHelpers.h +++ b/dbms/src/IO/ReadHelpers.h @@ -605,8 +605,13 @@ inline T parseFromString(const String & str) return parse(str.data(), str.size()); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wredundant-decls" +// Just dont mess with it. If the redundant redeclaration is removed then ReaderHelpers.h should be included. +// This leads to Arena.h inclusion which has a problem with ASAN stuff included properly and messing macro definition +// which intefrers with... You dont want to know, really. UInt128 stringToUUID(const String & str); - +#pragma GCC diagnostic pop template ReturnType readDateTimeTextFallback(time_t & datetime, ReadBuffer & buf, const DateLUTImpl & date_lut); diff --git a/dbms/src/IO/tests/gtest_DateTime64_parsing_and_writing.cpp b/dbms/src/IO/tests/gtest_DateTime64_parsing_and_writing.cpp index ab7a62beadf..08ca5dc88ee 100644 --- a/dbms/src/IO/tests/gtest_DateTime64_parsing_and_writing.cpp +++ b/dbms/src/IO/tests/gtest_DateTime64_parsing_and_writing.cpp @@ -1,3 +1,4 @@ +#pragma GCC diagnostic ignored "-Wmissing-declarations" #include #include @@ -20,7 +21,7 @@ struct DateTime64StringsTestParam const DateLUTImpl & timezone = DateLUT::instance(); }; -std::ostream & operator << (std::ostream & ostr, const DateTime64StringsTestParam & param) +static std::ostream & operator << (std::ostream & ostr, const DateTime64StringsTestParam & param) { return ostr << param.comment; } diff --git a/dbms/src/IO/tests/gtest_bit_io.cpp b/dbms/src/IO/tests/gtest_bit_io.cpp index 85df2580783..3def664231f 100644 --- a/dbms/src/IO/tests/gtest_bit_io.cpp +++ b/dbms/src/IO/tests/gtest_bit_io.cpp @@ -15,7 +15,7 @@ #include #include #include - +#pragma GCC diagnostic ignored "-Wmissing-declarations" #include using namespace DB; diff --git a/dbms/src/IO/tests/gtest_cascade_and_memory_write_buffer.cpp b/dbms/src/IO/tests/gtest_cascade_and_memory_write_buffer.cpp index aa95ab7cb58..1dd62682f36 100644 --- a/dbms/src/IO/tests/gtest_cascade_and_memory_write_buffer.cpp +++ b/dbms/src/IO/tests/gtest_cascade_and_memory_write_buffer.cpp @@ -134,8 +134,14 @@ static void checkHTTPHandlerCase(size_t input_size, size_t memory_buffer_size) [res_buf] (const WriteBufferPtr & prev_buf) { auto prev_memory_buffer = typeid_cast(prev_buf.get()); - auto rdbuf = prev_memory_buffer->tryGetReadBuffer(); - copyData(*rdbuf , *res_buf); + if (prev_memory_buffer != nullptr) + { + auto rdbuf = prev_memory_buffer->tryGetReadBuffer(); + if (rdbuf != nullptr) + { + copyData(*rdbuf, *res_buf); + } + } return res_buf; } }); @@ -219,6 +225,7 @@ try ASSERT_EQ(tmp_template, tmp_filename.substr(0, tmp_template.size())); auto reread_buf = buf->tryGetReadBuffer(); + ASSERT_TRUE(reread_buf != nullptr); std::string decoded_data; { WriteBufferFromString wbuf_decode(decoded_data); diff --git a/dbms/src/IO/tests/gtest_peekable_read_buffer.cpp b/dbms/src/IO/tests/gtest_peekable_read_buffer.cpp index 4fccd7a8496..0ba1e79799e 100644 --- a/dbms/src/IO/tests/gtest_peekable_read_buffer.cpp +++ b/dbms/src/IO/tests/gtest_peekable_read_buffer.cpp @@ -12,7 +12,7 @@ namespace DB::ErrorCodes extern const int MEMORY_LIMIT_EXCEEDED; } -void readAndAssert(DB::ReadBuffer & buf, const char * str) +static void readAndAssert(DB::ReadBuffer & buf, const char * str) { size_t n = strlen(str); char tmp[n]; @@ -20,7 +20,7 @@ void readAndAssert(DB::ReadBuffer & buf, const char * str) ASSERT_EQ(strncmp(tmp, str, n), 0); } -void assertAvailable(DB::ReadBuffer & buf, const char * str) +static void assertAvailable(DB::ReadBuffer & buf, const char * str) { size_t n = strlen(str); ASSERT_EQ(buf.available(), n); diff --git a/dbms/src/IO/tests/hashing_buffer.h b/dbms/src/IO/tests/hashing_buffer.h index a15bfbd73e7..f00a42d4a6a 100644 --- a/dbms/src/IO/tests/hashing_buffer.h +++ b/dbms/src/IO/tests/hashing_buffer.h @@ -4,7 +4,7 @@ #define FAIL(msg) do { std::cout << msg; exit(1); } while (0) -CityHash_v1_0_2::uint128 referenceHash(const char * data, size_t len) +static CityHash_v1_0_2::uint128 referenceHash(const char * data, size_t len) { const size_t block_size = DBMS_DEFAULT_HASHING_BLOCK_SIZE; CityHash_v1_0_2::uint128 state(0, 0); diff --git a/dbms/src/IO/tests/hashing_read_buffer.cpp b/dbms/src/IO/tests/hashing_read_buffer.cpp index 3ad85a8bc85..cb6108d15d8 100644 --- a/dbms/src/IO/tests/hashing_read_buffer.cpp +++ b/dbms/src/IO/tests/hashing_read_buffer.cpp @@ -4,7 +4,7 @@ #include "hashing_buffer.h" #include -void test(size_t data_size) +static void test(size_t data_size) { std::vector vec(data_size); char * data = vec.data(); diff --git a/dbms/src/IO/tests/hashing_write_buffer.cpp b/dbms/src/IO/tests/hashing_write_buffer.cpp index 96aa0025898..cf7c18d1c77 100644 --- a/dbms/src/IO/tests/hashing_write_buffer.cpp +++ b/dbms/src/IO/tests/hashing_write_buffer.cpp @@ -3,7 +3,7 @@ #include "hashing_buffer.h" -void test(size_t data_size) +static void test(size_t data_size) { std::vector vec(data_size); char * data = vec.data(); diff --git a/dbms/src/IO/tests/mempbrk.cpp b/dbms/src/IO/tests/mempbrk.cpp index 85b3e2d89ee..55097d989af 100644 --- a/dbms/src/IO/tests/mempbrk.cpp +++ b/dbms/src/IO/tests/mempbrk.cpp @@ -23,7 +23,7 @@ namespace ErrorCodes namespace test { - void readEscapedString(DB::String & s, DB::ReadBuffer & buf) +static void readEscapedString(DB::String & s, DB::ReadBuffer & buf) { s = ""; while (!buf.eof()) diff --git a/dbms/src/IO/tests/parse_int_perf.cpp b/dbms/src/IO/tests/parse_int_perf.cpp index 4e24d89f100..11558289d24 100644 --- a/dbms/src/IO/tests/parse_int_perf.cpp +++ b/dbms/src/IO/tests/parse_int_perf.cpp @@ -15,7 +15,7 @@ #include -UInt64 rdtsc() +static UInt64 rdtsc() { #if defined(__x86_64__) UInt64 val; diff --git a/dbms/src/IO/tests/write_int.cpp b/dbms/src/IO/tests/write_int.cpp index 18396542485..c1d02c93922 100644 --- a/dbms/src/IO/tests/write_int.cpp +++ b/dbms/src/IO/tests/write_int.cpp @@ -10,7 +10,7 @@ using namespace DB; -void NO_INLINE write(WriteBuffer & out, size_t size) +static void NO_INLINE write(WriteBuffer & out, size_t size) { for (size_t i = 0; i < size; ++i) { diff --git a/dbms/src/Interpreters/ActionsVisitor.cpp b/dbms/src/Interpreters/ActionsVisitor.cpp index 554e05077b1..e366edc641b 100644 --- a/dbms/src/Interpreters/ActionsVisitor.cpp +++ b/dbms/src/Interpreters/ActionsVisitor.cpp @@ -50,7 +50,7 @@ namespace ErrorCodes extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; } -NamesAndTypesList::iterator findColumn(const String & name, NamesAndTypesList & cols) +static NamesAndTypesList::iterator findColumn(const String & name, NamesAndTypesList & cols) { return std::find_if(cols.begin(), cols.end(), [&](const NamesAndTypesList::value_type & val) { return val.name == name; }); diff --git a/dbms/src/Interpreters/ExpressionJIT.cpp b/dbms/src/Interpreters/ExpressionJIT.cpp index 6f687a1227d..a8459ecb6c9 100644 --- a/dbms/src/Interpreters/ExpressionJIT.cpp +++ b/dbms/src/Interpreters/ExpressionJIT.cpp @@ -133,7 +133,7 @@ static llvm::TargetMachine * getNativeMachine() } #if LLVM_VERSION_MAJOR >= 7 -auto wrapJITSymbolResolver(llvm::JITSymbolResolver & jsr) +static auto wrapJITSymbolResolver(llvm::JITSymbolResolver & jsr) { #if USE_INTERNAL_LLVM_LIBRARY && LLVM_VERSION_PATCH == 0 // REMOVE AFTER contrib/llvm upgrade @@ -587,7 +587,7 @@ static bool isCompilable(const IFunctionBase & function) return function.isCompilable(); } -std::vector>> getActionsDependents(const ExpressionActions::Actions & actions, const Names & output_columns) +static std::vector>> getActionsDependents(const ExpressionActions::Actions & actions, const Names & output_columns) { /// an empty optional is a poisoned value prohibiting the column's producer from being removed /// (which it could be, if it was inlined into every dependent function). diff --git a/dbms/src/Interpreters/InterpreterExistsQuery.cpp b/dbms/src/Interpreters/InterpreterExistsQuery.cpp index 3d3b41a1818..a7c2b812796 100644 --- a/dbms/src/Interpreters/InterpreterExistsQuery.cpp +++ b/dbms/src/Interpreters/InterpreterExistsQuery.cpp @@ -39,14 +39,14 @@ BlockInputStreamPtr InterpreterExistsQuery::executeImpl() { ASTQueryWithTableAndOutput * exists_query; bool result = false; - if (exists_query = query_ptr->as(); exists_query) + if ((exists_query = query_ptr->as())) { if (exists_query->temporary) result = context.isExternalTableExist(exists_query->table); else result = context.isTableExist(exists_query->database, exists_query->table); } - else if (exists_query = query_ptr->as(); exists_query) + else if ((exists_query = query_ptr->as())) { if (exists_query->temporary) throw Exception("Temporary dictionaries are not possible.", ErrorCodes::SYNTAX_ERROR); diff --git a/dbms/src/Interpreters/InterpreterSelectQuery.cpp b/dbms/src/Interpreters/InterpreterSelectQuery.cpp index e5d44cd3403..0ba5c9ecd6c 100644 --- a/dbms/src/Interpreters/InterpreterSelectQuery.cpp +++ b/dbms/src/Interpreters/InterpreterSelectQuery.cpp @@ -2656,30 +2656,31 @@ void InterpreterSelectQuery::executeLimitBy(QueryPipeline & pipeline) } -// TODO: move to anonymous namespace -bool hasWithTotalsInAnySubqueryInFromClause(const ASTSelectQuery & query) +namespace { - if (query.group_by_with_totals) - return true; + bool hasWithTotalsInAnySubqueryInFromClause(const ASTSelectQuery & query) + { + if (query.group_by_with_totals) + return true; - /** NOTE You can also check that the table in the subquery is distributed, and that it only looks at one shard. + /** NOTE You can also check that the table in the subquery is distributed, and that it only looks at one shard. * In other cases, totals will be computed on the initiating server of the query, and it is not necessary to read the data to the end. */ - if (auto query_table = extractTableExpression(query, 0)) - { - if (const auto * ast_union = query_table->as()) + if (auto query_table = extractTableExpression(query, 0)) { - for (const auto & elem : ast_union->list_of_selects->children) - if (hasWithTotalsInAnySubqueryInFromClause(elem->as())) - return true; + if (const auto * ast_union = query_table->as()) + { + for (const auto & elem : ast_union->list_of_selects->children) + if (hasWithTotalsInAnySubqueryInFromClause(elem->as())) + return true; + } } + + return false; } - - return false; } - void InterpreterSelectQuery::executeLimit(Pipeline & pipeline) { auto & query = getSelectQuery(); diff --git a/dbms/src/Interpreters/InterpreterShowCreateQuery.cpp b/dbms/src/Interpreters/InterpreterShowCreateQuery.cpp index 1bc253c8aaf..95ebd8cc959 100644 --- a/dbms/src/Interpreters/InterpreterShowCreateQuery.cpp +++ b/dbms/src/Interpreters/InterpreterShowCreateQuery.cpp @@ -44,27 +44,27 @@ BlockInputStreamPtr InterpreterShowCreateQuery::executeImpl() { ASTPtr create_query; ASTQueryWithTableAndOutput * show_query; - if (show_query = query_ptr->as(); show_query) + if ((show_query = query_ptr->as())) { if (show_query->temporary) create_query = context.getCreateExternalTableQuery(show_query->table); else create_query = context.getCreateTableQuery(show_query->database, show_query->table); } - else if (show_query = query_ptr->as(); show_query) + else if ((show_query = query_ptr->as())) { if (show_query->temporary) throw Exception("Temporary databases are not possible.", ErrorCodes::SYNTAX_ERROR); create_query = context.getCreateDatabaseQuery(show_query->database); } - else if (show_query = query_ptr->as(); show_query) + else if ((show_query = query_ptr->as())) { if (show_query->temporary) throw Exception("Temporary dictionaries are not possible.", ErrorCodes::SYNTAX_ERROR); create_query = context.getCreateDictionaryQuery(show_query->database, show_query->table); } - if (!create_query && show_query->temporary) + if (!create_query && show_query && show_query->temporary) throw Exception("Unable to show the create query of " + show_query->table + ". Maybe it was created by the system.", ErrorCodes::THERE_IS_NO_QUERY); std::stringstream stream; diff --git a/dbms/src/Interpreters/getTableExpressions.cpp b/dbms/src/Interpreters/getTableExpressions.cpp index e579bf86c38..d5403969336 100644 --- a/dbms/src/Interpreters/getTableExpressions.cpp +++ b/dbms/src/Interpreters/getTableExpressions.cpp @@ -31,7 +31,7 @@ std::vector getTableExpressions(const ASTSelectQuery { const auto * tables_element = child->as(); - if (tables_element->table_expression) + if (tables_element && tables_element->table_expression) tables_expression.emplace_back(tables_element->table_expression->as()); } diff --git a/dbms/src/Interpreters/tests/hash_map_lookup.cpp b/dbms/src/Interpreters/tests/hash_map_lookup.cpp index 9ec191840e2..387cc26edd5 100644 --- a/dbms/src/Interpreters/tests/hash_map_lookup.cpp +++ b/dbms/src/Interpreters/tests/hash_map_lookup.cpp @@ -63,7 +63,9 @@ void NO_INLINE bench(const std::vector & data, const char * name) for (size_t i = 0, size = data.size(); i < size; ++i) { auto it = map.find(data[i]); - ++it->getMapped(); + auto curr = ++it; + if (curr) + curr->getMapped(); } watch.stop(); std::cerr << std::fixed << std::setprecision(2) << "HashMap (" << name << "). Size: " << map.size() diff --git a/dbms/src/Interpreters/tests/in_join_subqueries_preprocessor.cpp b/dbms/src/Interpreters/tests/in_join_subqueries_preprocessor.cpp index 43624bf16b8..8369234416b 100644 --- a/dbms/src/Interpreters/tests/in_join_subqueries_preprocessor.cpp +++ b/dbms/src/Interpreters/tests/in_join_subqueries_preprocessor.cpp @@ -1131,7 +1131,7 @@ TestEntries entries = }; -bool run() +static bool run() { unsigned int count = 0; unsigned int i = 1; diff --git a/dbms/src/Interpreters/tests/internal_iotop.cpp b/dbms/src/Interpreters/tests/internal_iotop.cpp index 75086796c42..b3cc720bc8e 100644 --- a/dbms/src/Interpreters/tests/internal_iotop.cpp +++ b/dbms/src/Interpreters/tests/internal_iotop.cpp @@ -15,7 +15,7 @@ std::mutex mutex; -std::ostream & operator << (std::ostream & stream, const ::taskstats & stat) +static std::ostream & operator << (std::ostream & stream, const ::taskstats & stat) { #define PRINT(field) (stream << #field << " " << stat.field) @@ -44,7 +44,7 @@ std::ostream & operator << (std::ostream & stream, const ::taskstats & stat) using namespace DB; -void do_io(size_t id) +static void do_io(size_t id) { ::taskstats stat; int tid = TaskStatsInfoGetter::getCurrentTID(); @@ -99,7 +99,7 @@ void do_io(size_t id) Poco::File(path_dst).remove(false); } -void test_perf() +static void test_perf() { ::taskstats stat; diff --git a/dbms/src/Parsers/ASTInsertQuery.cpp b/dbms/src/Parsers/ASTInsertQuery.cpp index 89158fa0649..1bd3f98751a 100644 --- a/dbms/src/Parsers/ASTInsertQuery.cpp +++ b/dbms/src/Parsers/ASTInsertQuery.cpp @@ -59,7 +59,7 @@ void ASTInsertQuery::formatImpl(const FormatSettings & settings, FormatState & s } -void tryFindInputFunctionImpl(const ASTPtr & ast, ASTPtr & input_function) +static void tryFindInputFunctionImpl(const ASTPtr & ast, ASTPtr & input_function) { if (!ast) return; diff --git a/dbms/src/Parsers/tests/gtest_dictionary_parser.cpp b/dbms/src/Parsers/tests/gtest_dictionary_parser.cpp index 934eb10f9a6..3e7f268a53e 100644 --- a/dbms/src/Parsers/tests/gtest_dictionary_parser.cpp +++ b/dbms/src/Parsers/tests/gtest_dictionary_parser.cpp @@ -17,7 +17,9 @@ using namespace DB; -String astToString(IAST * ast) +#pragma GCC diagnostic ignored "-Wunused-function" + +static String astToString(IAST * ast) { std::ostringstream oss; dumpAST(*ast, oss); diff --git a/dbms/src/Processors/Formats/Impl/CSVRowInputFormat.cpp b/dbms/src/Processors/Formats/Impl/CSVRowInputFormat.cpp index e10d819d8a3..3dc373109be 100644 --- a/dbms/src/Processors/Formats/Impl/CSVRowInputFormat.cpp +++ b/dbms/src/Processors/Formats/Impl/CSVRowInputFormat.cpp @@ -430,7 +430,7 @@ void registerInputFormatProcessorCSV(FormatFactory & factory) } } -bool fileSegmentationEngineCSVImpl(ReadBuffer & in, DB::Memory<> & memory, size_t min_chunk_size) +static bool fileSegmentationEngineCSVImpl(ReadBuffer & in, DB::Memory<> & memory, size_t min_chunk_size) { char * pos = in.position(); bool quotes = false; diff --git a/dbms/src/Processors/Formats/Impl/JSONEachRowRowInputFormat.cpp b/dbms/src/Processors/Formats/Impl/JSONEachRowRowInputFormat.cpp index 7bd91dc170d..1ffe50d87e6 100644 --- a/dbms/src/Processors/Formats/Impl/JSONEachRowRowInputFormat.cpp +++ b/dbms/src/Processors/Formats/Impl/JSONEachRowRowInputFormat.cpp @@ -279,7 +279,7 @@ void registerInputFormatProcessorJSONEachRow(FormatFactory & factory) }); } -bool fileSegmentationEngineJSONEachRowImpl(ReadBuffer & in, DB::Memory<> & memory, size_t min_chunk_size) +static bool fileSegmentationEngineJSONEachRowImpl(ReadBuffer & in, DB::Memory<> & memory, size_t min_chunk_size) { skipWhitespaceIfAny(in); diff --git a/dbms/src/Processors/Formats/Impl/TabSeparatedRowInputFormat.cpp b/dbms/src/Processors/Formats/Impl/TabSeparatedRowInputFormat.cpp index d3a7b910c05..b578a2c07ce 100644 --- a/dbms/src/Processors/Formats/Impl/TabSeparatedRowInputFormat.cpp +++ b/dbms/src/Processors/Formats/Impl/TabSeparatedRowInputFormat.cpp @@ -391,7 +391,7 @@ void registerInputFormatProcessorTabSeparated(FormatFactory & factory) } } -bool fileSegmentationEngineTabSeparatedImpl(ReadBuffer & in, DB::Memory<> & memory, size_t min_chunk_size) +static bool fileSegmentationEngineTabSeparatedImpl(ReadBuffer & in, DB::Memory<> & memory, size_t min_chunk_size) { bool need_more_data = true; char * pos = in.position(); diff --git a/dbms/src/Processors/tests/processors_test_aggregation.cpp b/dbms/src/Processors/tests/processors_test_aggregation.cpp index ed868d08762..ccf31d953ac 100644 --- a/dbms/src/Processors/tests/processors_test_aggregation.cpp +++ b/dbms/src/Processors/tests/processors_test_aggregation.cpp @@ -141,7 +141,7 @@ private: values[column_num] = chunk.getColumns()[column_num]->getUInt(row_num); } - if (3 * values[0] != values[1]) + if (values.size() >= 2 && 3 * values[0] != values[1]) throw Exception("Check Failed. Got (" + toString(values[0]) + ", " + toString(values[1]) + ") in result," + "but " + toString(values[0]) + " * 3 != " + toString(values[1]), ErrorCodes::LOGICAL_ERROR); diff --git a/dbms/src/Storages/MergeTree/IMergedBlockOutputStream.cpp b/dbms/src/Storages/MergeTree/IMergedBlockOutputStream.cpp index 71e55015d77..29e0ddbdaeb 100644 --- a/dbms/src/Storages/MergeTree/IMergedBlockOutputStream.cpp +++ b/dbms/src/Storages/MergeTree/IMergedBlockOutputStream.cpp @@ -98,7 +98,7 @@ IDataType::OutputStreamGetter IMergedBlockOutputStream::createStreamGetter( }; } -void fillIndexGranularityImpl( +static void fillIndexGranularityImpl( const Block & block, size_t index_granularity_bytes, size_t fixed_index_granularity_rows, diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp b/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp index 39e8c3fe1cd..841be3e11d2 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp @@ -129,7 +129,7 @@ size_t MergeTreeDataSelectExecutor::getApproximateTotalRowsToRead( using RelativeSize = boost::rational; -std::string toString(const RelativeSize & x) +static std::string toString(const RelativeSize & x) { return ASTSampleRatio::toString(x.numerator()) + "/" + ASTSampleRatio::toString(x.denominator()); } diff --git a/dbms/src/Storages/MergeTree/MergeTreeIndices.cpp b/dbms/src/Storages/MergeTree/MergeTreeIndices.cpp index b4062f84112..4e5a7c0c243 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeIndices.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeIndices.cpp @@ -55,28 +55,6 @@ std::unique_ptr MergeTreeIndexFactory::get( return it->second(columns, node, context); } - -std::unique_ptr minmaxIndexCreator( - const NamesAndTypesList & columns, - std::shared_ptr node, - const Context & context); - -std::unique_ptr setIndexCreator( - const NamesAndTypesList & columns, - std::shared_ptr node, - const Context & context); - -std::unique_ptr bloomFilterIndexCreator( - const NamesAndTypesList & columns, - std::shared_ptr node, - const Context & context); - -std::unique_ptr bloomFilterIndexCreatorNew( - const NamesAndTypesList & columns, - std::shared_ptr node, - const Context & context); - - MergeTreeIndexFactory::MergeTreeIndexFactory() { registerIndex("minmax", minmaxIndexCreator); diff --git a/dbms/src/Storages/MergeTree/MergeTreeIndices.h b/dbms/src/Storages/MergeTree/MergeTreeIndices.h index 1174b5c293c..007851f2912 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeIndices.h +++ b/dbms/src/Storages/MergeTree/MergeTreeIndices.h @@ -156,4 +156,24 @@ private: Indexes indexes; }; +std::unique_ptr minmaxIndexCreator( + const NamesAndTypesList & columns, + std::shared_ptr node, + const Context & context); + +std::unique_ptr setIndexCreator( + const NamesAndTypesList & columns, + std::shared_ptr node, + const Context & context); + +std::unique_ptr bloomFilterIndexCreator( + const NamesAndTypesList & columns, + std::shared_ptr node, + const Context & context); + +std::unique_ptr bloomFilterIndexCreatorNew( + const NamesAndTypesList & columns, + std::shared_ptr node, + const Context & context); + } diff --git a/dbms/src/Storages/StorageFactory.h b/dbms/src/Storages/StorageFactory.h index ca19c55522d..013ce4e82e2 100644 --- a/dbms/src/Storages/StorageFactory.h +++ b/dbms/src/Storages/StorageFactory.h @@ -5,6 +5,7 @@ #include #include #include +#include #include diff --git a/dbms/src/Storages/StorageMySQL.cpp b/dbms/src/Storages/StorageMySQL.cpp index ca5313e6ba8..388c38f118c 100644 --- a/dbms/src/Storages/StorageMySQL.cpp +++ b/dbms/src/Storages/StorageMySQL.cpp @@ -26,7 +26,7 @@ namespace ErrorCodes extern const int BAD_ARGUMENTS; } -String backQuoteMySQL(const String & x) +static String backQuoteMySQL(const String & x) { String res(x.size(), '\0'); { diff --git a/dbms/src/Storages/VirtualColumnUtils.cpp b/dbms/src/Storages/VirtualColumnUtils.cpp index 77069d97c10..70042361563 100644 --- a/dbms/src/Storages/VirtualColumnUtils.cpp +++ b/dbms/src/Storages/VirtualColumnUtils.cpp @@ -69,18 +69,6 @@ ASTPtr buildWhereExpression(const ASTs & functions) namespace VirtualColumnUtils { -void rewriteEntityInAst(ASTPtr ast, const String & column_name, const Field & value) -{ - auto & select = ast->as(); - if (!select.with()) - select.setExpression(ASTSelectQuery::Expression::WITH, std::make_shared()); - - auto literal = std::make_shared(value); - literal->alias = column_name; - literal->prefer_alias_to_column_name = true; - select.with()->children.push_back(literal); -} - void rewriteEntityInAst(ASTPtr ast, const String & column_name, const Field & value, const String & func) { auto & select = ast->as(); diff --git a/dbms/src/Storages/registerStorages.cpp b/dbms/src/Storages/registerStorages.cpp index 17283ef4218..0d0ed080d8f 100644 --- a/dbms/src/Storages/registerStorages.cpp +++ b/dbms/src/Storages/registerStorages.cpp @@ -8,47 +8,6 @@ namespace DB { -void registerStorageLog(StorageFactory & factory); -void registerStorageTinyLog(StorageFactory & factory); -void registerStorageStripeLog(StorageFactory & factory); -void registerStorageMergeTree(StorageFactory & factory); -void registerStorageNull(StorageFactory & factory); -void registerStorageMerge(StorageFactory & factory); -void registerStorageBuffer(StorageFactory & factory); -void registerStorageDistributed(StorageFactory & factory); -void registerStorageMemory(StorageFactory & factory); -void registerStorageFile(StorageFactory & factory); -void registerStorageURL(StorageFactory & factory); -void registerStorageDictionary(StorageFactory & factory); -void registerStorageSet(StorageFactory & factory); -void registerStorageJoin(StorageFactory & factory); -void registerStorageView(StorageFactory & factory); -void registerStorageMaterializedView(StorageFactory & factory); -void registerStorageLiveView(StorageFactory & factory); - -#if USE_AWS_S3 -void registerStorageS3(StorageFactory & factory); -#endif - -#if USE_HDFS -void registerStorageHDFS(StorageFactory & factory); -#endif - -#if USE_POCO_SQLODBC || USE_POCO_DATAODBC -void registerStorageODBC(StorageFactory & factory); -#endif - -void registerStorageJDBC(StorageFactory & factory); - -#if USE_MYSQL -void registerStorageMySQL(StorageFactory & factory); -#endif - -#if USE_RDKAFKA -void registerStorageKafka(StorageFactory & factory); -#endif - - void registerStorages() { auto & factory = StorageFactory::instance(); diff --git a/dbms/src/Storages/registerStorages.h b/dbms/src/Storages/registerStorages.h index b92bdd0c525..522289b2715 100644 --- a/dbms/src/Storages/registerStorages.h +++ b/dbms/src/Storages/registerStorages.h @@ -1,7 +1,49 @@ #pragma once +#include namespace DB { +class StorageFactory; + +void registerStorageLog(StorageFactory & factory); +void registerStorageTinyLog(StorageFactory & factory); +void registerStorageStripeLog(StorageFactory & factory); +void registerStorageMergeTree(StorageFactory & factory); +void registerStorageNull(StorageFactory & factory); +void registerStorageMerge(StorageFactory & factory); +void registerStorageBuffer(StorageFactory & factory); +void registerStorageDistributed(StorageFactory & factory); +void registerStorageMemory(StorageFactory & factory); +void registerStorageFile(StorageFactory & factory); +void registerStorageURL(StorageFactory & factory); +void registerStorageDictionary(StorageFactory & factory); +void registerStorageSet(StorageFactory & factory); +void registerStorageJoin(StorageFactory & factory); +void registerStorageView(StorageFactory & factory); +void registerStorageMaterializedView(StorageFactory & factory); +void registerStorageLiveView(StorageFactory & factory); + +#if USE_AWS_S3 +void registerStorageS3(StorageFactory & factory); +#endif + +#if USE_HDFS +void registerStorageHDFS(StorageFactory & factory); +#endif + +#if USE_POCO_SQLODBC || USE_POCO_DATAODBC +void registerStorageODBC(StorageFactory & factory); +#endif + +void registerStorageJDBC(StorageFactory & factory); + +#if USE_MYSQL +void registerStorageMySQL(StorageFactory & factory); +#endif + +#if USE_RDKAFKA +void registerStorageKafka(StorageFactory & factory); +#endif void registerStorages(); diff --git a/dbms/src/Storages/tests/gtest_aux_funcs_for_adaptive_granularity.cpp b/dbms/src/Storages/tests/gtest_aux_funcs_for_adaptive_granularity.cpp index 95c56c74132..42544c192ae 100644 --- a/dbms/src/Storages/tests/gtest_aux_funcs_for_adaptive_granularity.cpp +++ b/dbms/src/Storages/tests/gtest_aux_funcs_for_adaptive_granularity.cpp @@ -6,7 +6,7 @@ #include using namespace DB; -Block getBlockWithSize(size_t required_size_in_bytes, size_t size_of_row_in_bytes) +static Block getBlockWithSize(size_t required_size_in_bytes, size_t size_of_row_in_bytes) { ColumnsWithTypeAndName cols; diff --git a/dbms/src/Storages/tests/gtest_transform_query_for_external_database.cpp b/dbms/src/Storages/tests/gtest_transform_query_for_external_database.cpp index d615d1fb8ad..b346bdbb033 100644 --- a/dbms/src/Storages/tests/gtest_transform_query_for_external_database.cpp +++ b/dbms/src/Storages/tests/gtest_transform_query_for_external_database.cpp @@ -37,14 +37,14 @@ struct State } }; -State & state() +static State & state() { static State res; return res; } -void check(const std::string & query, const std::string & expected, const Context & context, const NamesAndTypesList & columns) +static void check(const std::string & query, const std::string & expected, const Context & context, const NamesAndTypesList & columns) { ParserSelectQuery parser; ASTPtr ast = parseQuery(parser, query, 1000); diff --git a/dbms/src/TableFunctions/ITableFunctionXDBC.cpp b/dbms/src/TableFunctions/ITableFunctionXDBC.cpp index c90ed0f34fb..af483886445 100644 --- a/dbms/src/TableFunctions/ITableFunctionXDBC.cpp +++ b/dbms/src/TableFunctions/ITableFunctionXDBC.cpp @@ -17,7 +17,7 @@ #include #include #include - +#include "registerTableFunctions.h" namespace DB { diff --git a/dbms/src/TableFunctions/TableFunctionFile.cpp b/dbms/src/TableFunctions/TableFunctionFile.cpp index 1adea8d60ff..80a01f760c0 100644 --- a/dbms/src/TableFunctions/TableFunctionFile.cpp +++ b/dbms/src/TableFunctions/TableFunctionFile.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "registerTableFunctions.h" namespace DB { diff --git a/dbms/src/TableFunctions/TableFunctionHDFS.cpp b/dbms/src/TableFunctions/TableFunctionHDFS.cpp index 3e8a3d6b954..ae4a220fbbe 100644 --- a/dbms/src/TableFunctions/TableFunctionHDFS.cpp +++ b/dbms/src/TableFunctions/TableFunctionHDFS.cpp @@ -1,4 +1,5 @@ #include +#include "registerTableFunctions.h" #if USE_HDFS #include @@ -21,9 +22,11 @@ StoragePtr TableFunctionHDFS::getStorage( compression_method); } +#if USE_HDFS void registerTableFunctionHDFS(TableFunctionFactory & factory) { factory.registerFunction(); } +#endif } #endif diff --git a/dbms/src/TableFunctions/TableFunctionInput.cpp b/dbms/src/TableFunctions/TableFunctionInput.cpp index d6d16c3c907..f73b54be554 100644 --- a/dbms/src/TableFunctions/TableFunctionInput.cpp +++ b/dbms/src/TableFunctions/TableFunctionInput.cpp @@ -11,6 +11,7 @@ #include #include #include +#include "registerTableFunctions.h" namespace DB diff --git a/dbms/src/TableFunctions/TableFunctionMerge.cpp b/dbms/src/TableFunctions/TableFunctionMerge.cpp index 0cae1cda987..ad18cd8676c 100644 --- a/dbms/src/TableFunctions/TableFunctionMerge.cpp +++ b/dbms/src/TableFunctions/TableFunctionMerge.cpp @@ -1,16 +1,14 @@ #include #include - #include -#include #include #include #include #include #include -#include #include #include +#include "registerTableFunctions.h" namespace DB diff --git a/dbms/src/TableFunctions/TableFunctionMySQL.cpp b/dbms/src/TableFunctions/TableFunctionMySQL.cpp index 820a55c3a2c..833d0afc90d 100644 --- a/dbms/src/TableFunctions/TableFunctionMySQL.cpp +++ b/dbms/src/TableFunctions/TableFunctionMySQL.cpp @@ -2,11 +2,7 @@ #if USE_MYSQL #include -#include -#include -#include #include -#include #include #include #include @@ -19,9 +15,9 @@ #include #include #include -#include #include #include +#include "registerTableFunctions.h" #include diff --git a/dbms/src/TableFunctions/TableFunctionNumbers.cpp b/dbms/src/TableFunctions/TableFunctionNumbers.cpp index 14947a40812..24f937fc043 100644 --- a/dbms/src/TableFunctions/TableFunctionNumbers.cpp +++ b/dbms/src/TableFunctions/TableFunctionNumbers.cpp @@ -6,6 +6,7 @@ #include #include #include +#include "registerTableFunctions.h" namespace DB diff --git a/dbms/src/TableFunctions/TableFunctionRemote.cpp b/dbms/src/TableFunctions/TableFunctionRemote.cpp index 3eeacce7397..87c8989cbe2 100644 --- a/dbms/src/TableFunctions/TableFunctionRemote.cpp +++ b/dbms/src/TableFunctions/TableFunctionRemote.cpp @@ -14,6 +14,7 @@ #include #include #include +#include "registerTableFunctions.h" namespace DB diff --git a/dbms/src/TableFunctions/TableFunctionS3.cpp b/dbms/src/TableFunctions/TableFunctionS3.cpp index 3b7055d570c..c739af30a68 100644 --- a/dbms/src/TableFunctions/TableFunctionS3.cpp +++ b/dbms/src/TableFunctions/TableFunctionS3.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "registerTableFunctions.h" namespace DB { diff --git a/dbms/src/TableFunctions/TableFunctionURL.cpp b/dbms/src/TableFunctions/TableFunctionURL.cpp index adb930efa8c..a338aad3839 100644 --- a/dbms/src/TableFunctions/TableFunctionURL.cpp +++ b/dbms/src/TableFunctions/TableFunctionURL.cpp @@ -3,6 +3,7 @@ #include #include #include +#include "registerTableFunctions.h" namespace DB diff --git a/dbms/src/TableFunctions/TableFunctionValues.cpp b/dbms/src/TableFunctions/TableFunctionValues.cpp index d4ca0ff4211..40237d6c3f3 100644 --- a/dbms/src/TableFunctions/TableFunctionValues.cpp +++ b/dbms/src/TableFunctions/TableFunctionValues.cpp @@ -16,6 +16,7 @@ #include #include +#include "registerTableFunctions.h" namespace DB diff --git a/dbms/src/TableFunctions/registerTableFunctions.cpp b/dbms/src/TableFunctions/registerTableFunctions.cpp index 23cc6213e2f..d6987a331e0 100644 --- a/dbms/src/TableFunctions/registerTableFunctions.cpp +++ b/dbms/src/TableFunctions/registerTableFunctions.cpp @@ -1,39 +1,9 @@ -#include -#include "config_core.h" -#include +#include "registerTableFunctions.h" #include namespace DB { - -void registerTableFunctionMerge(TableFunctionFactory & factory); -void registerTableFunctionRemote(TableFunctionFactory & factory); -void registerTableFunctionNumbers(TableFunctionFactory & factory); -void registerTableFunctionFile(TableFunctionFactory & factory); -void registerTableFunctionURL(TableFunctionFactory & factory); -void registerTableFunctionValues(TableFunctionFactory & factory); -void registerTableFunctionInput(TableFunctionFactory & factory); - -#if USE_AWS_S3 -void registerTableFunctionS3(TableFunctionFactory & factory); -#endif - -#if USE_HDFS -void registerTableFunctionHDFS(TableFunctionFactory & factory); -#endif - -#if USE_POCO_SQLODBC || USE_POCO_DATAODBC -void registerTableFunctionODBC(TableFunctionFactory & factory); -#endif - -void registerTableFunctionJDBC(TableFunctionFactory & factory); - -#if USE_MYSQL -void registerTableFunctionMySQL(TableFunctionFactory & factory); -#endif - - void registerTableFunctions() { auto & factory = TableFunctionFactory::instance(); diff --git a/dbms/src/TableFunctions/registerTableFunctions.h b/dbms/src/TableFunctions/registerTableFunctions.h index 17bb6fabfd3..78b6a6917db 100644 --- a/dbms/src/TableFunctions/registerTableFunctions.h +++ b/dbms/src/TableFunctions/registerTableFunctions.h @@ -1,7 +1,36 @@ #pragma once +#include +#include "config_core.h" namespace DB { +class TableFunctionFactory; +void registerTableFunctionMerge(TableFunctionFactory & factory); +void registerTableFunctionRemote(TableFunctionFactory & factory); +void registerTableFunctionNumbers(TableFunctionFactory & factory); +void registerTableFunctionFile(TableFunctionFactory & factory); +void registerTableFunctionURL(TableFunctionFactory & factory); +void registerTableFunctionValues(TableFunctionFactory & factory); +void registerTableFunctionInput(TableFunctionFactory & factory); + +#if USE_AWS_S3 +void registerTableFunctionS3(TableFunctionFactory & factory); +#endif + +#if USE_HDFS +void registerTableFunctionHDFS(TableFunctionFactory & factory); +#endif + +#if USE_POCO_SQLODBC || USE_POCO_DATAODBC +void registerTableFunctionODBC(TableFunctionFactory & factory); +#endif + +void registerTableFunctionJDBC(TableFunctionFactory & factory); + +#if USE_MYSQL +void registerTableFunctionMySQL(TableFunctionFactory & factory); +#endif + void registerTableFunctions(); diff --git a/libs/libwidechar_width/widechar_width.h b/libs/libwidechar_width/widechar_width.h index 39cf0ded05b..3007a112886 100644 --- a/libs/libwidechar_width/widechar_width.h +++ b/libs/libwidechar_width/widechar_width.h @@ -500,7 +500,7 @@ bool widechar_in_table(const Collection &arr, int32_t c) { } /* Return the width of character c, or a special negative value. */ -int widechar_wcwidth(wchar_t c) { +inline int widechar_wcwidth(wchar_t c) { if (widechar_in_table(widechar_private_table, c)) return widechar_private_use; if (widechar_in_table(widechar_nonprint_table, c))