Automated function registration

Automated register all functions with below naming convention by
iterating through the symbols:
void DB::registerXXX(DB::FunctionFactory &)
This commit is contained in:
Li Yin 2022-07-04 15:01:39 +08:00
parent c5837dd6f5
commit 4088c0a7f3
581 changed files with 667 additions and 2150 deletions

View File

@ -144,8 +144,8 @@ endif ()
list (APPEND clickhouse_common_io_sources ${CONFIG_BUILD}) list (APPEND clickhouse_common_io_sources ${CONFIG_BUILD})
list (APPEND clickhouse_common_io_headers ${CONFIG_VERSION} ${CONFIG_COMMON}) list (APPEND clickhouse_common_io_headers ${CONFIG_VERSION} ${CONFIG_COMMON})
list (APPEND dbms_sources Functions/IFunction.cpp Functions/FunctionFactory.cpp Functions/FunctionHelpers.cpp Functions/extractTimeZoneFromFunctionArguments.cpp Functions/replicate.cpp Functions/FunctionsLogical.cpp) list (APPEND dbms_sources Functions/IFunction.cpp Functions/FunctionFactory.cpp Functions/FunctionHelpers.cpp Functions/extractTimeZoneFromFunctionArguments.cpp Functions/FunctionsLogical.cpp)
list (APPEND dbms_headers Functions/IFunction.h Functions/FunctionFactory.h Functions/FunctionHelpers.h Functions/extractTimeZoneFromFunctionArguments.h Functions/replicate.h Functions/FunctionsLogical.h) list (APPEND dbms_headers Functions/IFunction.h Functions/FunctionFactory.h Functions/FunctionHelpers.h Functions/extractTimeZoneFromFunctionArguments.h Functions/FunctionsLogical.h)
list (APPEND dbms_sources list (APPEND dbms_sources
AggregateFunctions/IAggregateFunction.cpp AggregateFunctions/IAggregateFunction.cpp

View File

@ -0,0 +1,12 @@
#include <Common/register_objects.h>
namespace DB
{
FunctionRegisterMap & FunctionRegisterMap::instance()
{
static FunctionRegisterMap map;
return map;
}
}

View File

@ -0,0 +1,33 @@
#pragma once
#include <string_view>
#include <unordered_map>
namespace DB
{
class FunctionFactory;
using FunctionRegisterFunctionPtr = void (*)(::DB::FunctionFactory &);
struct FunctionRegisterMap : public std::unordered_map<std::string_view, FunctionRegisterFunctionPtr>
{
static FunctionRegisterMap & instance();
};
struct FunctionRegister
{
FunctionRegister(std::string_view name, FunctionRegisterFunctionPtr func_ptr)
{
FunctionRegisterMap::instance().emplace(std::move(name), func_ptr);
}
};
}
#define REGISTER_FUNCTION_IMPL(fn, func_name, register_name) \
void func_name(::DB::FunctionFactory & factory); \
static ::DB::FunctionRegister register_name(#fn, func_name); \
void func_name(::DB::FunctionFactory & factory)
#define REGISTER_FUNCTION(fn) REGISTER_FUNCTION_IMPL(fn, registerFunction##fn, REGISTER_FUNCTION_##fn)

View File

@ -6,13 +6,14 @@ add_subdirectory(divide)
include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake") include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake")
add_headers_and_sources(clickhouse_functions .) add_headers_and_sources(clickhouse_functions .)
list(REMOVE_ITEM clickhouse_functions_sources IFunction.cpp FunctionFactory.cpp FunctionHelpers.cpp) list(REMOVE_ITEM clickhouse_functions_sources IFunction.cpp FunctionFactory.cpp FunctionHelpers.cpp extractTimeZoneFromFunctionArguments.cpp FunctionsLogical.cpp)
list(REMOVE_ITEM clickhouse_functions_headers IFunction.h FunctionFactory.h FunctionHelpers.h) list(REMOVE_ITEM clickhouse_functions_headers IFunction.h FunctionFactory.h FunctionHelpers.h extractTimeZoneFromFunctionArguments.h FunctionsLogical.h)
add_library(clickhouse_functions ${clickhouse_functions_sources}) add_library(clickhouse_functions_obj OBJECT ${clickhouse_functions_sources})
target_link_libraries(clickhouse_functions list (APPEND OBJECT_LIBS $<TARGET_OBJECTS:clickhouse_functions_obj>)
PUBLIC
list (APPEND PUBLIC_LIBS
ch_contrib::wyhash ch_contrib::wyhash
ch_contrib::cityhash ch_contrib::cityhash
ch_contrib::farmhash ch_contrib::farmhash
@ -24,27 +25,28 @@ target_link_libraries(clickhouse_functions
ch_contrib::metrohash ch_contrib::metrohash
ch_contrib::murmurhash ch_contrib::murmurhash
ch_contrib::hashidsxx ch_contrib::hashidsxx
)
PRIVATE list (APPEND PRIVATE_LIBS
ch_contrib::zlib ch_contrib::zlib
boost::filesystem boost::filesystem
divide_impl divide_impl
) )
if (TARGET OpenSSL::Crypto) if (TARGET OpenSSL::Crypto)
target_link_libraries(clickhouse_functions PUBLIC OpenSSL::Crypto) list (APPEND PUBLIC_LIBS OpenSSL::Crypto)
endif() endif()
if (OMIT_HEAVY_DEBUG_SYMBOLS) if (OMIT_HEAVY_DEBUG_SYMBOLS)
target_compile_options(clickhouse_functions PRIVATE "-g0") target_compile_options(clickhouse_functions_obj PRIVATE "-g0")
endif() endif()
if (TARGET ch_contrib::icu) if (TARGET ch_contrib::icu)
target_link_libraries (clickhouse_functions PRIVATE ch_contrib::icu) list (APPEND PRIVATE_LIBS ch_contrib::icu)
endif () endif ()
if (TARGET ch_contrib::fastops) if (TARGET ch_contrib::fastops)
target_link_libraries (clickhouse_functions PRIVATE ch_contrib::fastops) list (APPEND PRIVATE_LIBS ch_contrib::fastops)
endif () endif ()
if (ENABLE_EXAMPLES) if (ENABLE_EXAMPLES)
@ -52,45 +54,46 @@ if (ENABLE_EXAMPLES)
endif () endif ()
if (TARGET ch_contrib::llvm) if (TARGET ch_contrib::llvm)
target_link_libraries(clickhouse_functions PRIVATE ch_contrib::llvm) list (APPEND PRIVATE_LIBS ch_contrib::llvm)
endif () endif ()
if (TARGET ch_contrib::base64) if (TARGET ch_contrib::base64)
target_link_libraries(clickhouse_functions PRIVATE ch_contrib::base64) list (APPEND PRIVATE_LIBS ch_contrib::base64)
endif() endif()
target_link_libraries(clickhouse_functions PRIVATE ch_contrib::lz4) list (APPEND PRIVATE_LIBS ch_contrib::lz4)
if (ENABLE_NLP) if (ENABLE_NLP)
target_link_libraries(clickhouse_functions PRIVATE ch_contrib::cld2) list (APPEND PRIVATE_LIBS ch_contrib::cld2)
endif() endif()
if (TARGET ch_contrib::h3) if (TARGET ch_contrib::h3)
target_link_libraries (clickhouse_functions PRIVATE ch_contrib::h3) list (APPEND PRIVATE_LIBS ch_contrib::h3)
endif() endif()
if (TARGET ch_contrib::vectorscan) if (TARGET ch_contrib::vectorscan)
target_link_libraries(clickhouse_functions PRIVATE ch_contrib::vectorscan) list (APPEND PRIVATE_LIBS ch_contrib::vectorscan)
endif() endif()
if (TARGET ch_contrib::simdjson) if (TARGET ch_contrib::simdjson)
target_link_libraries(clickhouse_functions PRIVATE ch_contrib::simdjson) list (APPEND PRIVATE_LIBS ch_contrib::simdjson)
endif() endif()
if (TARGET ch_contrib::rapidjson) if (TARGET ch_contrib::rapidjson)
target_link_libraries(clickhouse_functions PRIVATE ch_contrib::rapidjson) list (APPEND PRIVATE_LIBS ch_contrib::rapidjson)
endif() endif()
add_subdirectory(GatherUtils) add_subdirectory(GatherUtils)
target_link_libraries(clickhouse_functions PRIVATE clickhouse_functions_gatherutils) list (APPEND PRIVATE_LIBS clickhouse_functions_gatherutils)
add_subdirectory(URL) add_subdirectory(URL)
target_link_libraries(clickhouse_functions PRIVATE clickhouse_functions_url) list (APPEND OBJECT_LIBS $<TARGET_OBJECTS:clickhouse_functions_url>)
add_subdirectory(array) add_subdirectory(array)
target_link_libraries(clickhouse_functions PRIVATE clickhouse_functions_array) list (APPEND OBJECT_LIBS $<TARGET_OBJECTS:clickhouse_functions_array>)
add_subdirectory(JSONPath) add_subdirectory(JSONPath)
list (APPEND PRIVATE_LIBS clickhouse_functions_jsonpath)
# Signed integer overflow on user-provided data inside boost::geometry - ignore. # Signed integer overflow on user-provided data inside boost::geometry - ignore.
set_source_files_properties("pointInPolygon.cpp" PROPERTIES COMPILE_FLAGS -fno-sanitize=signed-integer-overflow) set_source_files_properties("pointInPolygon.cpp" PROPERTIES COMPILE_FLAGS -fno-sanitize=signed-integer-overflow)
@ -98,3 +101,15 @@ set_source_files_properties("pointInPolygon.cpp" PROPERTIES COMPILE_FLAGS -fno-s
if (ENABLE_FUZZING) if (ENABLE_FUZZING)
add_compile_definitions(FUZZING_MODE=1) add_compile_definitions(FUZZING_MODE=1)
endif () endif ()
target_link_libraries(clickhouse_functions_obj PUBLIC ${PUBLIC_LIBS} PRIVATE ${PRIVATE_LIBS})
if (USE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
# Used to forward the linking information to the final binaries such as clickhouse / unit_tests_dbms,
# since such information are lost after we convert to OBJECT target
add_library(clickhouse_functions INTERFACE)
target_link_libraries(clickhouse_functions INTERFACE ${OBJECT_LIBS} ${PUBLIC_LIBS} ${PRIVATE_LIBS})
else()
add_library(clickhouse_functions SHARED ${OBJECT_LIBS})
target_link_libraries(clickhouse_functions PUBLIC ${PUBLIC_LIBS} PRIVATE ${PRIVATE_LIBS})
endif ()

View File

@ -143,7 +143,7 @@ void registerFunctionCRCImpl(FunctionFactory & factory)
factory.registerFunction<T>(T::name, FunctionFactory::CaseInsensitive); factory.registerFunction<T>(T::name, FunctionFactory::CaseInsensitive);
} }
void registerFunctionCRC(FunctionFactory & factory) REGISTER_FUNCTION(CRC)
{ {
registerFunctionCRCImpl<FunctionCRC32ZLIB>(factory); registerFunctionCRCImpl<FunctionCRC32ZLIB>(factory);
registerFunctionCRCImpl<FunctionCRC32IEEE>(factory); registerFunctionCRCImpl<FunctionCRC32IEEE>(factory);

View File

@ -5,7 +5,7 @@
namespace DB namespace DB
{ {
void registerCastOverloadResolvers(FunctionFactory & factory) REGISTER_FUNCTION(CastOverloadResolvers)
{ {
factory.registerFunction<CastInternalOverloadResolver<CastType::nonAccurate>>(FunctionFactory::CaseInsensitive); factory.registerFunction<CastInternalOverloadResolver<CastType::nonAccurate>>(FunctionFactory::CaseInsensitive);
factory.registerFunction<CastInternalOverloadResolver<CastType::accurate>>(); factory.registerFunction<CastInternalOverloadResolver<CastType::accurate>>();

View File

@ -113,7 +113,7 @@ private:
} }
}; };
void registerFunctionChar(FunctionFactory & factory) REGISTER_FUNCTION(Char)
{ {
factory.registerFunction<FunctionChar>(FunctionFactory::CaseInsensitive); factory.registerFunction<FunctionChar>(FunctionFactory::CaseInsensitive);
} }

View File

@ -44,7 +44,7 @@ public:
}; };
void registerFunctionFQDN(FunctionFactory & factory) REGISTER_FUNCTION(FQDN)
{ {
factory.registerFunction<FunctionFQDN>(FunctionFactory::CaseInsensitive); factory.registerFunction<FunctionFQDN>(FunctionFactory::CaseInsensitive);
factory.registerFunction<FunctionFQDN>("fullHostName"); factory.registerFunction<FunctionFQDN>("fullHostName");

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <Interpreters/Context_fwd.h> #include <Interpreters/Context_fwd.h>
#include <Common/register_objects.h>
#include <Common/IFactoryWithAliases.h> #include <Common/IFactoryWithAliases.h>
#include <Functions/IFunction.h> #include <Functions/IFunction.h>
#include <Functions/IFunctionAdaptors.h> #include <Functions/IFunctionAdaptors.h>

View File

@ -94,7 +94,7 @@ public:
}; };
void registerFunctionFile(FunctionFactory & factory) REGISTER_FUNCTION(File)
{ {
factory.registerFunction<FunctionFile>(); factory.registerFunction<FunctionFile>();
} }

View File

@ -4,7 +4,7 @@
namespace DB namespace DB
{ {
void registerFunctionHashID(FunctionFactory & factory) REGISTER_FUNCTION(HashID)
{ {
factory.registerFunction<FunctionHashID>(); factory.registerFunction<FunctionHashID>();
} }

View File

@ -96,7 +96,7 @@ FunctionBasePtr JoinGetOverloadResolver<or_null>::buildImpl(const ColumnsWithTyp
return std::make_unique<FunctionJoinGet<or_null>>(getContext(), table_lock, storage_join, attr_name, argument_types, return_type); return std::make_unique<FunctionJoinGet<or_null>>(getContext(), table_lock, storage_join, attr_name, argument_types, return_type);
} }
void registerFunctionJoinGet(FunctionFactory & factory) REGISTER_FUNCTION(JoinGet)
{ {
// joinGet // joinGet
factory.registerFunction<JoinGetOverloadResolver<false>>(); factory.registerFunction<JoinGetOverloadResolver<false>>();

View File

@ -5,7 +5,7 @@
namespace DB namespace DB
{ {
void registerFunctionsSQLJSON(FunctionFactory & factory) REGISTER_FUNCTION(SQLJSON)
{ {
factory.registerFunction<FunctionSQLJSON<NameJSONExists, JSONExistsImpl>>(); factory.registerFunction<FunctionSQLJSON<NameJSONExists, JSONExistsImpl>>();
factory.registerFunction<FunctionSQLJSON<NameJSONQuery, JSONQueryImpl>>(); factory.registerFunction<FunctionSQLJSON<NameJSONQuery, JSONQueryImpl>>();

View File

@ -4,7 +4,7 @@
namespace DB namespace DB
{ {
void registerFunctionShowCertificate(FunctionFactory & factory) REGISTER_FUNCTION(ShowCertificate)
{ {
factory.registerFunction<FunctionShowCertificate>(); factory.registerFunction<FunctionShowCertificate>();
} }

View File

@ -3,12 +3,12 @@
namespace DB namespace DB
{ {
void registerFunctionBase58Encode(FunctionFactory & factory) REGISTER_FUNCTION(Base58Encode)
{ {
factory.registerFunction<FunctionBase58Conversion<Base58Encode>>(); factory.registerFunction<FunctionBase58Conversion<Base58Encode>>();
} }
void registerFunctionBase58Decode(FunctionFactory & factory) REGISTER_FUNCTION(Base58Decode)
{ {
factory.registerFunction<FunctionBase58Conversion<Base58Decode>>(); factory.registerFunction<FunctionBase58Conversion<Base58Decode>>();
} }

View File

@ -621,7 +621,7 @@ public:
} }
}; };
void registerFunctionsBinaryRepr(FunctionFactory & factory) REGISTER_FUNCTION(BinaryRepr)
{ {
factory.registerFunction<EncodeToBinaryRepresentation<HexImpl>>(FunctionFactory::CaseInsensitive); factory.registerFunction<EncodeToBinaryRepresentation<HexImpl>>(FunctionFactory::CaseInsensitive);
factory.registerFunction<DecodeFromBinaryRepresentation<UnhexImpl>>(FunctionFactory::CaseInsensitive); factory.registerFunction<DecodeFromBinaryRepresentation<UnhexImpl>>(FunctionFactory::CaseInsensitive);

View File

@ -329,7 +329,7 @@ public:
} }
void registerFunctionsBitToArray(FunctionFactory & factory) REGISTER_FUNCTION(BitToArray)
{ {
factory.registerFunction<FunctionBitPositionsToArray>(); factory.registerFunction<FunctionBitPositionsToArray>();
factory.registerFunction<FunctionBitmaskToArray>(); factory.registerFunction<FunctionBitmaskToArray>();

View File

@ -7,7 +7,7 @@
namespace DB namespace DB
{ {
void registerFunctionsBitmap(FunctionFactory & factory) REGISTER_FUNCTION(Bitmap)
{ {
factory.registerFunction<FunctionBitmapBuild>(); factory.registerFunction<FunctionBitmapBuild>();
factory.registerFunction<FunctionBitmapToArray>(); factory.registerFunction<FunctionBitmapToArray>();

View File

@ -143,7 +143,7 @@ struct NameDetectLanguageUnknown
using FunctionDetectCharset = FunctionTextClassificationString<CharsetClassificationImpl<false>, NameDetectCharset>; using FunctionDetectCharset = FunctionTextClassificationString<CharsetClassificationImpl<false>, NameDetectCharset>;
using FunctionDetectLanguageUnknown = FunctionTextClassificationString<CharsetClassificationImpl<true>, NameDetectLanguageUnknown>; using FunctionDetectLanguageUnknown = FunctionTextClassificationString<CharsetClassificationImpl<true>, NameDetectLanguageUnknown>;
void registerFunctionDetectCharset(FunctionFactory & factory) REGISTER_FUNCTION(DetectCharset)
{ {
factory.registerFunction<FunctionDetectCharset>(); factory.registerFunction<FunctionDetectCharset>();
factory.registerFunction<FunctionDetectLanguageUnknown>(); factory.registerFunction<FunctionDetectLanguageUnknown>();

View File

@ -1128,7 +1128,7 @@ public:
struct NameFunctionIPv4NumToString { static constexpr auto name = "IPv4NumToString"; }; struct NameFunctionIPv4NumToString { static constexpr auto name = "IPv4NumToString"; };
struct NameFunctionIPv4NumToStringClassC { static constexpr auto name = "IPv4NumToStringClassC"; }; struct NameFunctionIPv4NumToStringClassC { static constexpr auto name = "IPv4NumToStringClassC"; };
void registerFunctionsCoding(FunctionFactory & factory) REGISTER_FUNCTION(Coding)
{ {
factory.registerFunction<FunctionCutIPv6>(); factory.registerFunction<FunctionCutIPv6>();
factory.registerFunction<FunctionIPv4ToIPv6>(); factory.registerFunction<FunctionIPv4ToIPv6>();

View File

@ -229,7 +229,7 @@ public:
} }
}; };
void registerFunctionsCodingUUID(FunctionFactory & factory) REGISTER_FUNCTION(CodingUUID)
{ {
factory.registerFunction<FunctionUUIDNumToString>(); factory.registerFunction<FunctionUUIDNumToString>();
factory.registerFunction<FunctionUUIDStringToNum>(); factory.registerFunction<FunctionUUIDStringToNum>();

View File

@ -5,11 +5,7 @@
namespace DB namespace DB
{ {
void registerFunctionFixedString(FunctionFactory & factory); REGISTER_FUNCTION(Conversion)
void registerCastOverloadResolvers(FunctionFactory & factory);
void registerFunctionsConversion(FunctionFactory & factory)
{ {
factory.registerFunction<FunctionToUInt8>(); factory.registerFunction<FunctionToUInt8>();
factory.registerFunction<FunctionToUInt16>(); factory.registerFunction<FunctionToUInt16>();
@ -41,12 +37,8 @@ void registerFunctionsConversion(FunctionFactory & factory)
factory.registerFunction<FunctionToUUID>(); factory.registerFunction<FunctionToUUID>();
factory.registerFunction<FunctionToString>(); factory.registerFunction<FunctionToString>();
registerFunctionFixedString(factory);
factory.registerFunction<FunctionToUnixTimestamp>(); factory.registerFunction<FunctionToUnixTimestamp>();
registerCastOverloadResolvers(factory);
factory.registerFunction<FunctionToUInt8OrZero>(); factory.registerFunction<FunctionToUInt8OrZero>();
factory.registerFunction<FunctionToUInt16OrZero>(); factory.registerFunction<FunctionToUInt16OrZero>();
factory.registerFunction<FunctionToUInt32OrZero>(); factory.registerFunction<FunctionToUInt32OrZero>();

View File

@ -5,7 +5,7 @@
namespace DB namespace DB
{ {
void registerFunctionsEmbeddedDictionaries(FunctionFactory & factory) REGISTER_FUNCTION(EmbeddedDictionaries)
{ {
factory.registerFunction<FunctionRegionToCity>(); factory.registerFunction<FunctionRegionToCity>();
factory.registerFunction<FunctionRegionToArea>(); factory.registerFunction<FunctionRegionToArea>();

View File

@ -5,7 +5,7 @@
namespace DB namespace DB
{ {
void registerFunctionsExternalDictionaries(FunctionFactory & factory) REGISTER_FUNCTION(ExternalDictionaries)
{ {
factory.registerFunction<FunctionDictHas>(); factory.registerFunction<FunctionDictHas>();
factory.registerFunction<FunctionDictGetUInt8>(); factory.registerFunction<FunctionDictGetUInt8>();

View File

@ -6,7 +6,7 @@
namespace DB namespace DB
{ {
void registerFunctionsHashing(FunctionFactory & factory) REGISTER_FUNCTION(Hashing)
{ {
#if USE_SSL #if USE_SSL
factory.registerFunction<FunctionMD4>(); factory.registerFunction<FunctionMD4>();

View File

@ -1443,7 +1443,7 @@ public:
} }
}; };
void registerFunctionsJSON(FunctionFactory & factory) REGISTER_FUNCTION(JSON)
{ {
factory.registerFunction<JSONOverloadResolver<NameJSONHas, JSONHasImpl>>(); factory.registerFunction<JSONOverloadResolver<NameJSONHas, JSONHasImpl>>();
factory.registerFunction<JSONOverloadResolver<NameIsValidJSON, IsValidJSONImpl>>(); factory.registerFunction<JSONOverloadResolver<NameIsValidJSON, IsValidJSONImpl>>();

View File

@ -221,7 +221,7 @@ struct NameDetectLanguage
using FunctionDetectLanguage = FunctionTextClassificationString<FunctionDetectLanguageImpl, NameDetectLanguage>; using FunctionDetectLanguage = FunctionTextClassificationString<FunctionDetectLanguageImpl, NameDetectLanguage>;
void registerFunctionsDetectLanguage(FunctionFactory & factory) REGISTER_FUNCTION(DetectLanguage)
{ {
factory.registerFunction<FunctionDetectLanguage>(); factory.registerFunction<FunctionDetectLanguage>();
factory.registerFunction<FunctionDetectLanguageMixed>(); factory.registerFunction<FunctionDetectLanguageMixed>();

View File

@ -22,7 +22,7 @@
namespace DB namespace DB
{ {
void registerFunctionsLogical(FunctionFactory & factory) REGISTER_FUNCTION(Logical)
{ {
factory.registerFunction<FunctionAnd>(); factory.registerFunction<FunctionAnd>();
factory.registerFunction<FunctionOr>(); factory.registerFunction<FunctionOr>();

View File

@ -112,7 +112,7 @@ struct NameDetectProgrammingLanguage
using FunctionDetectProgrammingLanguage = FunctionTextClassificationString<FunctionDetectProgrammingLanguageImpl, NameDetectProgrammingLanguage>; using FunctionDetectProgrammingLanguage = FunctionTextClassificationString<FunctionDetectProgrammingLanguageImpl, NameDetectProgrammingLanguage>;
void registerFunctionDetectProgrammingLanguage(FunctionFactory & factory) REGISTER_FUNCTION(DetectProgrammingLanguage)
{ {
factory.registerFunction<FunctionDetectProgrammingLanguage>(); factory.registerFunction<FunctionDetectProgrammingLanguage>();
} }

View File

@ -5,7 +5,7 @@
namespace DB namespace DB
{ {
void registerFunctionsRound(FunctionFactory & factory) REGISTER_FUNCTION(Round)
{ {
factory.registerFunction<FunctionRound>("round", FunctionFactory::CaseInsensitive); factory.registerFunction<FunctionRound>("round", FunctionFactory::CaseInsensitive);
factory.registerFunction<FunctionRoundBankers>("roundBankers", FunctionFactory::CaseSensitive); factory.registerFunction<FunctionRoundBankers>("roundBankers", FunctionFactory::CaseSensitive);

View File

@ -27,7 +27,7 @@ DataTypePtr FunctionArrayStringConcat::getReturnTypeImpl(const DataTypes & argum
return std::make_shared<DataTypeString>(); return std::make_shared<DataTypeString>();
} }
void registerFunctionsStringArray(FunctionFactory & factory) REGISTER_FUNCTION(StringArray)
{ {
factory.registerFunction<FunctionExtractAll>(); factory.registerFunction<FunctionExtractAll>();
factory.registerFunction<FunctionAlphaTokens>(); factory.registerFunction<FunctionAlphaTokens>();

View File

@ -743,7 +743,7 @@ using FunctionWordShingleMinHashArgUTF8
using FunctionWordShingleMinHashArgCaseInsensitiveUTF8 using FunctionWordShingleMinHashArgCaseInsensitiveUTF8
= FunctionsStringHash<MinHashImpl<true, false, true>, NameWordShingleMinHashArgCaseInsensitiveUTF8, false, true>; = FunctionsStringHash<MinHashImpl<true, false, true>, NameWordShingleMinHashArgCaseInsensitiveUTF8, false, true>;
void registerFunctionsStringHash(FunctionFactory & factory) REGISTER_FUNCTION(StringHash)
{ {
factory.registerFunction<FunctionNgramSimHash>(); factory.registerFunction<FunctionNgramSimHash>();
factory.registerFunction<FunctionNgramSimHashCaseInsensitive>(); factory.registerFunction<FunctionNgramSimHashCaseInsensitive>();

View File

@ -530,7 +530,7 @@ using FunctionNgramSearchUTF8 = FunctionsStringSimilarity<NgramDistanceImpl<3, U
using FunctionNgramSearchCaseInsensitiveUTF8 = FunctionsStringSimilarity<NgramDistanceImpl<3, UInt32, true, true, false>, NameNgramSearchUTF8CaseInsensitive>; using FunctionNgramSearchCaseInsensitiveUTF8 = FunctionsStringSimilarity<NgramDistanceImpl<3, UInt32, true, true, false>, NameNgramSearchUTF8CaseInsensitive>;
void registerFunctionsStringSimilarity(FunctionFactory & factory) REGISTER_FUNCTION(StringSimilarity)
{ {
factory.registerFunction<FunctionNgramDistance>(); factory.registerFunction<FunctionNgramDistance>();
factory.registerFunction<FunctionNgramDistanceCaseInsensitive>(); factory.registerFunction<FunctionNgramDistanceCaseInsensitive>();

View File

@ -684,7 +684,7 @@ ColumnPtr FunctionTimeWindow<type>::executeImpl(const ColumnsWithTypeAndName & a
return TimeWindowImpl<type>::dispatchForColumns(arguments, name); return TimeWindowImpl<type>::dispatchForColumns(arguments, name);
} }
void registerFunctionsTimeWindow(FunctionFactory& factory) REGISTER_FUNCTION(TimeWindow)
{ {
factory.registerFunction<FunctionTumble>(); factory.registerFunction<FunctionTumble>();
factory.registerFunction<FunctionHop>(); factory.registerFunction<FunctionHop>();

View File

@ -81,7 +81,7 @@ struct NameDetectTonality
using FunctionDetectTonality = FunctionTextClassificationFloat<FunctionDetectTonalityImpl, NameDetectTonality>; using FunctionDetectTonality = FunctionTextClassificationFloat<FunctionDetectTonalityImpl, NameDetectTonality>;
void registerFunctionDetectTonality(FunctionFactory & factory) REGISTER_FUNCTION(DetectTonality)
{ {
factory.registerFunction<FunctionDetectTonality>(); factory.registerFunction<FunctionDetectTonality>();
} }

View File

@ -61,7 +61,7 @@ public:
} }
void registerFunctionsTransactionCounters(FunctionFactory & factory) REGISTER_FUNCTION(TransactionCounters)
{ {
factory.registerFunction<FunctionTransactionID>(); factory.registerFunction<FunctionTransactionID>();
factory.registerFunction<FunctionTransactionLatestSnapshot>(); factory.registerFunction<FunctionTransactionLatestSnapshot>();

View File

@ -6,7 +6,6 @@ add_library(clickhouse_functions_jsonpath ${clickhouse_functions_jsonpath_source
target_link_libraries(clickhouse_functions_jsonpath PRIVATE dbms) target_link_libraries(clickhouse_functions_jsonpath PRIVATE dbms)
target_link_libraries(clickhouse_functions_jsonpath PRIVATE clickhouse_parsers) target_link_libraries(clickhouse_functions_jsonpath PRIVATE clickhouse_parsers)
target_link_libraries(clickhouse_functions PRIVATE clickhouse_functions_jsonpath)
if (OMIT_HEAVY_DEBUG_SYMBOLS) if (OMIT_HEAVY_DEBUG_SYMBOLS)
target_compile_options(clickhouse_functions_jsonpath PRIVATE "-g0") target_compile_options(clickhouse_functions_jsonpath PRIVATE "-g0")

View File

@ -6,19 +6,19 @@ namespace DB
{ {
using FunctionSubtractNanoseconds = FunctionDateOrDateTimeAddInterval<SubtractNanosecondsImpl>; using FunctionSubtractNanoseconds = FunctionDateOrDateTimeAddInterval<SubtractNanosecondsImpl>;
void registerFunctionSubtractNanoseconds(FunctionFactory & factory) REGISTER_FUNCTION(SubtractNanoseconds)
{ {
factory.registerFunction<FunctionSubtractNanoseconds>(); factory.registerFunction<FunctionSubtractNanoseconds>();
} }
using FunctionSubtractMicroseconds = FunctionDateOrDateTimeAddInterval<SubtractMicrosecondsImpl>; using FunctionSubtractMicroseconds = FunctionDateOrDateTimeAddInterval<SubtractMicrosecondsImpl>;
void registerFunctionSubtractMicroseconds(FunctionFactory & factory) REGISTER_FUNCTION(SubtractMicroseconds)
{ {
factory.registerFunction<FunctionSubtractMicroseconds>(); factory.registerFunction<FunctionSubtractMicroseconds>();
} }
using FunctionSubtractMilliseconds = FunctionDateOrDateTimeAddInterval<SubtractMillisecondsImpl>; using FunctionSubtractMilliseconds = FunctionDateOrDateTimeAddInterval<SubtractMillisecondsImpl>;
void registerFunctionSubtractMilliseconds(FunctionFactory & factory) REGISTER_FUNCTION(SubtractMilliseconds)
{ {
factory.registerFunction<FunctionSubtractMilliseconds>(); factory.registerFunction<FunctionSubtractMilliseconds>();
} }

View File

@ -1,6 +1,6 @@
include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake") include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake")
add_headers_and_sources(clickhouse_functions_url .) add_headers_and_sources(clickhouse_functions_url .)
add_library(clickhouse_functions_url ${clickhouse_functions_url_sources} ${clickhouse_functions_url_headers}) add_library(clickhouse_functions_url OBJECT ${clickhouse_functions_url_sources} ${clickhouse_functions_url_headers})
target_link_libraries(clickhouse_functions_url PRIVATE dbms) target_link_libraries(clickhouse_functions_url PRIVATE dbms)
if (OMIT_HEAVY_DEBUG_SYMBOLS) if (OMIT_HEAVY_DEBUG_SYMBOLS)
@ -10,6 +10,7 @@ endif()
# TODO: move Functions/Regexps.h to some lib and use here # TODO: move Functions/Regexps.h to some lib and use here
if (TARGET ch_contrib::vectorscan) if (TARGET ch_contrib::vectorscan)
target_link_libraries(clickhouse_functions_url PRIVATE ch_contrib::vectorscan) target_link_libraries(clickhouse_functions_url PRIVATE ch_contrib::vectorscan)
list (APPEND PRIVATE_LIBS ch_contrib::vectorscan PARENT_SCOPE)
endif() endif()
if (USE_GPERF) if (USE_GPERF)

View File

@ -104,7 +104,7 @@ public:
struct NameURLPathHierarchy { static constexpr auto name = "URLPathHierarchy"; }; struct NameURLPathHierarchy { static constexpr auto name = "URLPathHierarchy"; };
using FunctionURLPathHierarchy = FunctionTokens<URLPathHierarchyImpl>; using FunctionURLPathHierarchy = FunctionTokens<URLPathHierarchyImpl>;
void registerFunctionURLPathHierarchy(FunctionFactory & factory) REGISTER_FUNCTION(URLPathHierarchy)
{ {
factory.registerFunction<FunctionURLPathHierarchy>(); factory.registerFunction<FunctionURLPathHierarchy>();
} }

View File

@ -106,7 +106,7 @@ public:
struct NameURLHierarchy { static constexpr auto name = "URLHierarchy"; }; struct NameURLHierarchy { static constexpr auto name = "URLHierarchy"; };
using FunctionURLHierarchy = FunctionTokens<URLHierarchyImpl>; using FunctionURLHierarchy = FunctionTokens<URLHierarchyImpl>;
void registerFunctionURLHierarchy(FunctionFactory & factory) REGISTER_FUNCTION(URLHierarchy)
{ {
factory.registerFunction<FunctionURLHierarchy>(); factory.registerFunction<FunctionURLHierarchy>();
} }

View File

@ -34,7 +34,7 @@ struct ExtractBasename
struct NameBasename { static constexpr auto name = "basename"; }; struct NameBasename { static constexpr auto name = "basename"; };
using FunctionBasename = FunctionStringToString<ExtractSubstringImpl<ExtractBasename>, NameBasename>; using FunctionBasename = FunctionStringToString<ExtractSubstringImpl<ExtractBasename>, NameBasename>;
void registerFunctionBasename(FunctionFactory & factory) REGISTER_FUNCTION(Basename)
{ {
factory.registerFunction<FunctionBasename>(); factory.registerFunction<FunctionBasename>();
} }

View File

@ -8,7 +8,7 @@ namespace DB
struct NameCutFragment { static constexpr auto name = "cutFragment"; }; struct NameCutFragment { static constexpr auto name = "cutFragment"; };
using FunctionCutFragment = FunctionStringToString<CutSubstringImpl<ExtractFragment<false>>, NameCutFragment>; using FunctionCutFragment = FunctionStringToString<CutSubstringImpl<ExtractFragment<false>>, NameCutFragment>;
void registerFunctionCutFragment(FunctionFactory & factory) REGISTER_FUNCTION(CutFragment)
{ {
factory.registerFunction<FunctionCutFragment>(); factory.registerFunction<FunctionCutFragment>();
} }

View File

@ -8,7 +8,7 @@ namespace DB
struct NameCutQueryString { static constexpr auto name = "cutQueryString"; }; struct NameCutQueryString { static constexpr auto name = "cutQueryString"; };
using FunctionCutQueryString = FunctionStringToString<CutSubstringImpl<ExtractQueryString<false>>, NameCutQueryString>; using FunctionCutQueryString = FunctionStringToString<CutSubstringImpl<ExtractQueryString<false>>, NameCutQueryString>;
void registerFunctionCutQueryString(FunctionFactory & factory) REGISTER_FUNCTION(CutQueryString)
{ {
factory.registerFunction<FunctionCutQueryString>(); factory.registerFunction<FunctionCutQueryString>();
} }

View File

@ -8,7 +8,7 @@ namespace DB
struct NameCutQueryStringAndFragment { static constexpr auto name = "cutQueryStringAndFragment"; }; struct NameCutQueryStringAndFragment { static constexpr auto name = "cutQueryStringAndFragment"; };
using FunctionCutQueryStringAndFragment = FunctionStringToString<CutSubstringImpl<ExtractQueryStringAndFragment<false>>, NameCutQueryStringAndFragment>; using FunctionCutQueryStringAndFragment = FunctionStringToString<CutSubstringImpl<ExtractQueryStringAndFragment<false>>, NameCutQueryStringAndFragment>;
void registerFunctionCutQueryStringAndFragment(FunctionFactory & factory) REGISTER_FUNCTION(CutQueryStringAndFragment)
{ {
factory.registerFunction<FunctionCutQueryStringAndFragment>(); factory.registerFunction<FunctionCutQueryStringAndFragment>();
} }

View File

@ -35,7 +35,7 @@ using FunctionCutToFirstSignificantSubdomain = FunctionStringToString<ExtractSub
struct NameCutToFirstSignificantSubdomainWithWWW { static constexpr auto name = "cutToFirstSignificantSubdomainWithWWW"; }; struct NameCutToFirstSignificantSubdomainWithWWW { static constexpr auto name = "cutToFirstSignificantSubdomainWithWWW"; };
using FunctionCutToFirstSignificantSubdomainWithWWW = FunctionStringToString<ExtractSubstringImpl<CutToFirstSignificantSubdomain<false>>, NameCutToFirstSignificantSubdomainWithWWW>; using FunctionCutToFirstSignificantSubdomainWithWWW = FunctionStringToString<ExtractSubstringImpl<CutToFirstSignificantSubdomain<false>>, NameCutToFirstSignificantSubdomainWithWWW>;
void registerFunctionCutToFirstSignificantSubdomain(FunctionFactory & factory) REGISTER_FUNCTION(CutToFirstSignificantSubdomain)
{ {
factory.registerFunction<FunctionCutToFirstSignificantSubdomain>(); factory.registerFunction<FunctionCutToFirstSignificantSubdomain>();
factory.registerFunction<FunctionCutToFirstSignificantSubdomainWithWWW>(); factory.registerFunction<FunctionCutToFirstSignificantSubdomainWithWWW>();

View File

@ -34,7 +34,7 @@ using FunctionCutToFirstSignificantSubdomainCustom = FunctionCutToFirstSignifica
struct NameCutToFirstSignificantSubdomainCustomWithWWW { static constexpr auto name = "cutToFirstSignificantSubdomainCustomWithWWW"; }; struct NameCutToFirstSignificantSubdomainCustomWithWWW { static constexpr auto name = "cutToFirstSignificantSubdomainCustomWithWWW"; };
using FunctionCutToFirstSignificantSubdomainCustomWithWWW = FunctionCutToFirstSignificantSubdomainCustomImpl<CutToFirstSignificantSubdomainCustom<false>, NameCutToFirstSignificantSubdomainCustomWithWWW>; using FunctionCutToFirstSignificantSubdomainCustomWithWWW = FunctionCutToFirstSignificantSubdomainCustomImpl<CutToFirstSignificantSubdomainCustom<false>, NameCutToFirstSignificantSubdomainCustomWithWWW>;
void registerFunctionCutToFirstSignificantSubdomainCustom(FunctionFactory & factory) REGISTER_FUNCTION(CutToFirstSignificantSubdomainCustom)
{ {
factory.registerFunction<FunctionCutToFirstSignificantSubdomainCustom>(); factory.registerFunction<FunctionCutToFirstSignificantSubdomainCustom>();
factory.registerFunction<FunctionCutToFirstSignificantSubdomainCustomWithWWW>(); factory.registerFunction<FunctionCutToFirstSignificantSubdomainCustomWithWWW>();

View File

@ -77,7 +77,7 @@ struct CutURLParameterImpl
struct NameCutURLParameter { static constexpr auto name = "cutURLParameter"; }; struct NameCutURLParameter { static constexpr auto name = "cutURLParameter"; };
using FunctionCutURLParameter = FunctionsStringSearchToString<CutURLParameterImpl, NameCutURLParameter>; using FunctionCutURLParameter = FunctionsStringSearchToString<CutURLParameterImpl, NameCutURLParameter>;
void registerFunctionCutURLParameter(FunctionFactory & factory) REGISTER_FUNCTION(CutURLParameter)
{ {
factory.registerFunction<FunctionCutURLParameter>(); factory.registerFunction<FunctionCutURLParameter>();
} }

View File

@ -54,7 +54,7 @@ struct ExtractWWW
struct NameCutWWW { static constexpr auto name = "cutWWW"; }; struct NameCutWWW { static constexpr auto name = "cutWWW"; };
using FunctionCutWWW = FunctionStringToString<CutSubstringImpl<ExtractWWW>, NameCutWWW>; using FunctionCutWWW = FunctionStringToString<CutSubstringImpl<ExtractWWW>, NameCutWWW>;
void registerFunctionCutWWW(FunctionFactory & factory) REGISTER_FUNCTION(CutWWW)
{ {
factory.registerFunction<FunctionCutWWW>(); factory.registerFunction<FunctionCutWWW>();
} }

View File

@ -172,7 +172,7 @@ using FunctionEncodeURLComponent = FunctionStringToString<CodeURLComponentImpl<e
using FunctionDecodeURLFormComponent = FunctionStringToString<CodeURLComponentImpl<decode, true>, NameDecodeURLFormComponent>; using FunctionDecodeURLFormComponent = FunctionStringToString<CodeURLComponentImpl<decode, true>, NameDecodeURLFormComponent>;
using FunctionEncodeURLFormComponent = FunctionStringToString<CodeURLComponentImpl<encode, true>, NameEncodeURLFormComponent>; using FunctionEncodeURLFormComponent = FunctionStringToString<CodeURLComponentImpl<encode, true>, NameEncodeURLFormComponent>;
void registerFunctionEncodeAndDecodeURLComponent(FunctionFactory & factory) REGISTER_FUNCTION(EncodeAndDecodeURLComponent)
{ {
factory.registerFunction<FunctionDecodeURLComponent>(); factory.registerFunction<FunctionDecodeURLComponent>();
factory.registerFunction<FunctionEncodeURLComponent>(); factory.registerFunction<FunctionEncodeURLComponent>();

View File

@ -10,7 +10,7 @@ struct NameDomain { static constexpr auto name = "domain"; };
using FunctionDomain = FunctionStringToString<ExtractSubstringImpl<ExtractDomain<false>>, NameDomain>; using FunctionDomain = FunctionStringToString<ExtractSubstringImpl<ExtractDomain<false>>, NameDomain>;
void registerFunctionDomain(FunctionFactory & factory) REGISTER_FUNCTION(Domain)
{ {
factory.registerFunction<FunctionDomain>(); factory.registerFunction<FunctionDomain>();
} }

View File

@ -9,7 +9,7 @@ struct NameDomainWithoutWWW { static constexpr auto name = "domainWithoutWWW"; }
using FunctionDomainWithoutWWW = FunctionStringToString<ExtractSubstringImpl<ExtractDomain<true>>, NameDomainWithoutWWW>; using FunctionDomainWithoutWWW = FunctionStringToString<ExtractSubstringImpl<ExtractDomain<true>>, NameDomainWithoutWWW>;
void registerFunctionDomainWithoutWWW(FunctionFactory & factory) REGISTER_FUNCTION(DomainWithoutWWW)
{ {
factory.registerFunction<FunctionDomainWithoutWWW>(); factory.registerFunction<FunctionDomainWithoutWWW>();
} }

View File

@ -92,7 +92,7 @@ struct ExtractURLParameterImpl
struct NameExtractURLParameter { static constexpr auto name = "extractURLParameter"; }; struct NameExtractURLParameter { static constexpr auto name = "extractURLParameter"; };
using FunctionExtractURLParameter = FunctionsStringSearchToString<ExtractURLParameterImpl, NameExtractURLParameter>; using FunctionExtractURLParameter = FunctionsStringSearchToString<ExtractURLParameterImpl, NameExtractURLParameter>;
void registerFunctionExtractURLParameter(FunctionFactory & factory) REGISTER_FUNCTION(ExtractURLParameter)
{ {
factory.registerFunction<FunctionExtractURLParameter>(); factory.registerFunction<FunctionExtractURLParameter>();
} }

View File

@ -89,7 +89,7 @@ public:
struct NameExtractURLParameterNames { static constexpr auto name = "extractURLParameterNames"; }; struct NameExtractURLParameterNames { static constexpr auto name = "extractURLParameterNames"; };
using FunctionExtractURLParameterNames = FunctionTokens<ExtractURLParameterNamesImpl>; using FunctionExtractURLParameterNames = FunctionTokens<ExtractURLParameterNamesImpl>;
void registerFunctionExtractURLParameterNames(FunctionFactory & factory) REGISTER_FUNCTION(ExtractURLParameterNames)
{ {
factory.registerFunction<FunctionExtractURLParameterNames>(); factory.registerFunction<FunctionExtractURLParameterNames>();
} }

View File

@ -97,7 +97,7 @@ public:
struct NameExtractURLParameters { static constexpr auto name = "extractURLParameters"; }; struct NameExtractURLParameters { static constexpr auto name = "extractURLParameters"; };
using FunctionExtractURLParameters = FunctionTokens<ExtractURLParametersImpl>; using FunctionExtractURLParameters = FunctionTokens<ExtractURLParametersImpl>;
void registerFunctionExtractURLParameters(FunctionFactory & factory) REGISTER_FUNCTION(ExtractURLParameters)
{ {
factory.registerFunction<FunctionExtractURLParameters>(); factory.registerFunction<FunctionExtractURLParameters>();
} }

View File

@ -10,7 +10,7 @@ struct NameFirstSignificantSubdomain { static constexpr auto name = "firstSignif
using FunctionFirstSignificantSubdomain = FunctionStringToString<ExtractSubstringImpl<ExtractFirstSignificantSubdomain<true>>, NameFirstSignificantSubdomain>; using FunctionFirstSignificantSubdomain = FunctionStringToString<ExtractSubstringImpl<ExtractFirstSignificantSubdomain<true>>, NameFirstSignificantSubdomain>;
void registerFunctionFirstSignificantSubdomain(FunctionFactory & factory) REGISTER_FUNCTION(FirstSignificantSubdomain)
{ {
factory.registerFunction<FunctionFirstSignificantSubdomain>(); factory.registerFunction<FunctionFirstSignificantSubdomain>();
} }

View File

@ -10,7 +10,7 @@ struct NameFirstSignificantSubdomainCustom { static constexpr auto name = "first
using FunctionFirstSignificantSubdomainCustom = FunctionCutToFirstSignificantSubdomainCustomImpl<ExtractFirstSignificantSubdomain<true>, NameFirstSignificantSubdomainCustom>; using FunctionFirstSignificantSubdomainCustom = FunctionCutToFirstSignificantSubdomainCustomImpl<ExtractFirstSignificantSubdomain<true>, NameFirstSignificantSubdomainCustom>;
void registerFunctionFirstSignificantSubdomainCustom(FunctionFactory & factory) REGISTER_FUNCTION(FirstSignificantSubdomainCustom)
{ {
factory.registerFunction<FunctionFirstSignificantSubdomainCustom>(); factory.registerFunction<FunctionFirstSignificantSubdomainCustom>();
} }

View File

@ -8,7 +8,7 @@ namespace DB
struct NameFragment { static constexpr auto name = "fragment"; }; struct NameFragment { static constexpr auto name = "fragment"; };
using FunctionFragment = FunctionStringToString<ExtractSubstringImpl<ExtractFragment<true>>, NameFragment>; using FunctionFragment = FunctionStringToString<ExtractSubstringImpl<ExtractFragment<true>>, NameFragment>;
void registerFunctionFragment(FunctionFactory & factory) REGISTER_FUNCTION(Fragment)
{ {
factory.registerFunction<FunctionFragment>(); factory.registerFunction<FunctionFragment>();
} }

View File

@ -132,7 +132,7 @@ struct ExtractNetloc
struct NameNetloc { static constexpr auto name = "netloc"; }; struct NameNetloc { static constexpr auto name = "netloc"; };
using FunctionNetloc = FunctionStringToString<ExtractSubstringImpl<ExtractNetloc>, NameNetloc>; using FunctionNetloc = FunctionStringToString<ExtractSubstringImpl<ExtractNetloc>, NameNetloc>;
void registerFunctionNetloc(FunctionFactory & factory) REGISTER_FUNCTION(Netloc)
{ {
factory.registerFunction<FunctionNetloc>(); factory.registerFunction<FunctionNetloc>();
} }

View File

@ -11,7 +11,7 @@ namespace DB
struct NamePath { static constexpr auto name = "path"; }; struct NamePath { static constexpr auto name = "path"; };
using FunctionPath = FunctionStringToString<ExtractSubstringImpl<ExtractPath<false>>, NamePath>; using FunctionPath = FunctionStringToString<ExtractSubstringImpl<ExtractPath<false>>, NamePath>;
void registerFunctionPath(FunctionFactory & factory) REGISTER_FUNCTION(Path)
{ {
factory.registerFunction<FunctionPath>(); factory.registerFunction<FunctionPath>();
} }

View File

@ -10,7 +10,7 @@ namespace DB
struct NamePathFull { static constexpr auto name = "pathFull"; }; struct NamePathFull { static constexpr auto name = "pathFull"; };
using FunctionPathFull = FunctionStringToString<ExtractSubstringImpl<ExtractPath<true>>, NamePathFull>; using FunctionPathFull = FunctionStringToString<ExtractSubstringImpl<ExtractPath<true>>, NamePathFull>;
void registerFunctionPathFull(FunctionFactory & factory) REGISTER_FUNCTION(PathFull)
{ {
factory.registerFunction<FunctionPathFull>(); factory.registerFunction<FunctionPathFull>();
} }

View File

@ -121,7 +121,7 @@ private:
} }
}; };
void registerFunctionPort(FunctionFactory & factory) REGISTER_FUNCTION(Port)
{ {
factory.registerFunction<FunctionPort>(); factory.registerFunction<FunctionPort>();
} }

View File

@ -9,7 +9,7 @@ namespace DB
struct NameProtocol { static constexpr auto name = "protocol"; }; struct NameProtocol { static constexpr auto name = "protocol"; };
using FunctionProtocol = FunctionStringToString<ExtractSubstringImpl<ExtractProtocol>, NameProtocol>; using FunctionProtocol = FunctionStringToString<ExtractSubstringImpl<ExtractProtocol>, NameProtocol>;
void registerFunctionProtocol(FunctionFactory & factory) REGISTER_FUNCTION(Protocol)
{ {
factory.registerFunction<FunctionProtocol>(); factory.registerFunction<FunctionProtocol>();
} }

View File

@ -8,7 +8,7 @@ namespace DB
struct NameQueryString { static constexpr auto name = "queryString"; }; struct NameQueryString { static constexpr auto name = "queryString"; };
using FunctionQueryString = FunctionStringToString<ExtractSubstringImpl<ExtractQueryString<true>>, NameQueryString>; using FunctionQueryString = FunctionStringToString<ExtractSubstringImpl<ExtractQueryString<true>>, NameQueryString>;
void registerFunctionQueryString(FunctionFactory & factory) REGISTER_FUNCTION(QueryString)
{ {
factory.registerFunction<FunctionQueryString>(); factory.registerFunction<FunctionQueryString>();
} }

View File

@ -8,7 +8,7 @@ namespace DB
struct NameQueryStringAndFragment { static constexpr auto name = "queryStringAndFragment"; }; struct NameQueryStringAndFragment { static constexpr auto name = "queryStringAndFragment"; };
using FunctionQueryStringAndFragment = FunctionStringToString<ExtractSubstringImpl<ExtractQueryStringAndFragment<true>>, NameQueryStringAndFragment>; using FunctionQueryStringAndFragment = FunctionStringToString<ExtractSubstringImpl<ExtractQueryStringAndFragment<true>>, NameQueryStringAndFragment>;
void registerFunctionQueryStringAndFragment(FunctionFactory & factory) REGISTER_FUNCTION(QueryStringAndFragment)
{ {
factory.registerFunction<FunctionQueryStringAndFragment>(); factory.registerFunction<FunctionQueryStringAndFragment>();
} }

View File

@ -1,64 +0,0 @@
namespace DB
{
class FunctionFactory;
void registerFunctionProtocol(FunctionFactory & factory);
void registerFunctionDomain(FunctionFactory & factory);
void registerFunctionDomainWithoutWWW(FunctionFactory & factory);
void registerFunctionFirstSignificantSubdomain(FunctionFactory & factory);
void registerFunctionFirstSignificantSubdomainCustom(FunctionFactory & factory);
void registerFunctionTopLevelDomain(FunctionFactory & factory);
void registerFunctionPort(FunctionFactory & factory);
void registerFunctionPath(FunctionFactory & factory);
void registerFunctionPathFull(FunctionFactory & factory);
void registerFunctionQueryString(FunctionFactory & factory);
void registerFunctionFragment(FunctionFactory & factory);
void registerFunctionQueryStringAndFragment(FunctionFactory & factory);
void registerFunctionExtractURLParameter(FunctionFactory & factory);
void registerFunctionExtractURLParameters(FunctionFactory & factory);
void registerFunctionExtractURLParameterNames(FunctionFactory & factory);
void registerFunctionURLHierarchy(FunctionFactory & factory);
void registerFunctionURLPathHierarchy(FunctionFactory & factory);
void registerFunctionCutToFirstSignificantSubdomain(FunctionFactory & factory);
void registerFunctionCutToFirstSignificantSubdomainCustom(FunctionFactory & factory);
void registerFunctionCutWWW(FunctionFactory & factory);
void registerFunctionCutQueryString(FunctionFactory & factory);
void registerFunctionCutFragment(FunctionFactory & factory);
void registerFunctionCutQueryStringAndFragment(FunctionFactory & factory);
void registerFunctionCutURLParameter(FunctionFactory & factory);
void registerFunctionEncodeAndDecodeURLComponent(FunctionFactory & factory);
void registerFunctionNetloc(FunctionFactory & factory);
void registerFunctionsURL(FunctionFactory & factory)
{
registerFunctionProtocol(factory);
registerFunctionDomain(factory);
registerFunctionDomainWithoutWWW(factory);
registerFunctionFirstSignificantSubdomain(factory);
registerFunctionFirstSignificantSubdomainCustom(factory);
registerFunctionTopLevelDomain(factory);
registerFunctionPort(factory);
registerFunctionPath(factory);
registerFunctionPathFull(factory);
registerFunctionQueryString(factory);
registerFunctionFragment(factory);
registerFunctionQueryStringAndFragment(factory);
registerFunctionExtractURLParameter(factory);
registerFunctionExtractURLParameters(factory);
registerFunctionExtractURLParameterNames(factory);
registerFunctionURLHierarchy(factory);
registerFunctionURLPathHierarchy(factory);
registerFunctionCutToFirstSignificantSubdomain(factory);
registerFunctionCutToFirstSignificantSubdomainCustom(factory);
registerFunctionCutWWW(factory);
registerFunctionCutQueryString(factory);
registerFunctionCutFragment(factory);
registerFunctionCutQueryStringAndFragment(factory);
registerFunctionCutURLParameter(factory);
registerFunctionEncodeAndDecodeURLComponent(factory);
registerFunctionNetloc(factory);
}
}

View File

@ -43,7 +43,7 @@ struct ExtractTopLevelDomain
struct NameTopLevelDomain { static constexpr auto name = "topLevelDomain"; }; struct NameTopLevelDomain { static constexpr auto name = "topLevelDomain"; };
using FunctionTopLevelDomain = FunctionStringToString<ExtractSubstringImpl<ExtractTopLevelDomain>, NameTopLevelDomain>; using FunctionTopLevelDomain = FunctionStringToString<ExtractSubstringImpl<ExtractTopLevelDomain>, NameTopLevelDomain>;
void registerFunctionTopLevelDomain(FunctionFactory & factory) REGISTER_FUNCTION(TopLevelDomain)
{ {
factory.registerFunction<FunctionTopLevelDomain>(); factory.registerFunction<FunctionTopLevelDomain>();
} }

View File

@ -50,7 +50,7 @@ template <> struct FunctionUnaryArithmeticMonotonicity<NameAbs>
} }
}; };
void registerFunctionAbs(FunctionFactory & factory) REGISTER_FUNCTION(Abs)
{ {
factory.registerFunction<FunctionAbs>(FunctionFactory::CaseInsensitive); factory.registerFunction<FunctionAbs>(FunctionFactory::CaseInsensitive);
} }

View File

@ -12,7 +12,7 @@ using FunctionAcos = FunctionMathUnary<UnaryFunctionVectorized<AcosName, acos>>;
} }
void registerFunctionAcos(FunctionFactory & factory) REGISTER_FUNCTION(Acos)
{ {
factory.registerFunction<FunctionAcos>(FunctionFactory::CaseInsensitive); factory.registerFunction<FunctionAcos>(FunctionFactory::CaseInsensitive);
} }

View File

@ -13,7 +13,7 @@ namespace
} }
void registerFunctionAcosh(FunctionFactory & factory) REGISTER_FUNCTION(Acosh)
{ {
factory.registerFunction<FunctionAcosh>(); factory.registerFunction<FunctionAcosh>();
} }

View File

@ -7,7 +7,7 @@ namespace DB
using FunctionAddDays = FunctionDateOrDateTimeAddInterval<AddDaysImpl>; using FunctionAddDays = FunctionDateOrDateTimeAddInterval<AddDaysImpl>;
void registerFunctionAddDays(FunctionFactory & factory) REGISTER_FUNCTION(AddDays)
{ {
factory.registerFunction<FunctionAddDays>(); factory.registerFunction<FunctionAddDays>();
} }

View File

@ -7,7 +7,7 @@ namespace DB
using FunctionAddHours = FunctionDateOrDateTimeAddInterval<AddHoursImpl>; using FunctionAddHours = FunctionDateOrDateTimeAddInterval<AddHoursImpl>;
void registerFunctionAddHours(FunctionFactory & factory) REGISTER_FUNCTION(AddHours)
{ {
factory.registerFunction<FunctionAddHours>(); factory.registerFunction<FunctionAddHours>();
} }

View File

@ -7,7 +7,7 @@ namespace DB
using FunctionAddMinutes = FunctionDateOrDateTimeAddInterval<AddMinutesImpl>; using FunctionAddMinutes = FunctionDateOrDateTimeAddInterval<AddMinutesImpl>;
void registerFunctionAddMinutes(FunctionFactory & factory) REGISTER_FUNCTION(AddMinutes)
{ {
factory.registerFunction<FunctionAddMinutes>(); factory.registerFunction<FunctionAddMinutes>();
} }

View File

@ -7,7 +7,7 @@ namespace DB
using FunctionAddMonths = FunctionDateOrDateTimeAddInterval<AddMonthsImpl>; using FunctionAddMonths = FunctionDateOrDateTimeAddInterval<AddMonthsImpl>;
void registerFunctionAddMonths(FunctionFactory & factory) REGISTER_FUNCTION(AddMonths)
{ {
factory.registerFunction<FunctionAddMonths>(); factory.registerFunction<FunctionAddMonths>();
} }

View File

@ -7,7 +7,7 @@ namespace DB
using FunctionAddQuarters = FunctionDateOrDateTimeAddInterval<AddQuartersImpl>; using FunctionAddQuarters = FunctionDateOrDateTimeAddInterval<AddQuartersImpl>;
void registerFunctionAddQuarters(FunctionFactory & factory) REGISTER_FUNCTION(AddQuarters)
{ {
factory.registerFunction<FunctionAddQuarters>(); factory.registerFunction<FunctionAddQuarters>();
} }

View File

@ -7,7 +7,7 @@ namespace DB
using FunctionAddSeconds = FunctionDateOrDateTimeAddInterval<AddSecondsImpl>; using FunctionAddSeconds = FunctionDateOrDateTimeAddInterval<AddSecondsImpl>;
void registerFunctionAddSeconds(FunctionFactory & factory) REGISTER_FUNCTION(AddSeconds)
{ {
factory.registerFunction<FunctionAddSeconds>(); factory.registerFunction<FunctionAddSeconds>();
} }

View File

@ -6,19 +6,19 @@ namespace DB
{ {
using FunctionAddNanoseconds = FunctionDateOrDateTimeAddInterval<AddNanosecondsImpl>; using FunctionAddNanoseconds = FunctionDateOrDateTimeAddInterval<AddNanosecondsImpl>;
void registerFunctionAddNanoseconds(FunctionFactory & factory) REGISTER_FUNCTION(AddNanoseconds)
{ {
factory.registerFunction<FunctionAddNanoseconds>(); factory.registerFunction<FunctionAddNanoseconds>();
} }
using FunctionAddMicroseconds = FunctionDateOrDateTimeAddInterval<AddMicrosecondsImpl>; using FunctionAddMicroseconds = FunctionDateOrDateTimeAddInterval<AddMicrosecondsImpl>;
void registerFunctionAddMicroseconds(FunctionFactory & factory) REGISTER_FUNCTION(AddMicroseconds)
{ {
factory.registerFunction<FunctionAddMicroseconds>(); factory.registerFunction<FunctionAddMicroseconds>();
} }
using FunctionAddMilliseconds = FunctionDateOrDateTimeAddInterval<AddMillisecondsImpl>; using FunctionAddMilliseconds = FunctionDateOrDateTimeAddInterval<AddMillisecondsImpl>;
void registerFunctionAddMilliseconds(FunctionFactory & factory) REGISTER_FUNCTION(AddMilliseconds)
{ {
factory.registerFunction<FunctionAddMilliseconds>(); factory.registerFunction<FunctionAddMilliseconds>();
} }

View File

@ -7,7 +7,7 @@ namespace DB
using FunctionAddWeeks = FunctionDateOrDateTimeAddInterval<AddWeeksImpl>; using FunctionAddWeeks = FunctionDateOrDateTimeAddInterval<AddWeeksImpl>;
void registerFunctionAddWeeks(FunctionFactory & factory) REGISTER_FUNCTION(AddWeeks)
{ {
factory.registerFunction<FunctionAddWeeks>(); factory.registerFunction<FunctionAddWeeks>();
} }

View File

@ -7,7 +7,7 @@ namespace DB
using FunctionAddYears = FunctionDateOrDateTimeAddInterval<AddYearsImpl>; using FunctionAddYears = FunctionDateOrDateTimeAddInterval<AddYearsImpl>;
void registerFunctionAddYears(FunctionFactory & factory) REGISTER_FUNCTION(AddYears)
{ {
factory.registerFunction<FunctionAddYears>(); factory.registerFunction<FunctionAddYears>();
} }

View File

@ -58,7 +58,7 @@ protected:
} }
void registerFunctionAddressToLine(FunctionFactory & factory) REGISTER_FUNCTION(AddressToLine)
{ {
factory.registerFunction<FunctionAddressToLine>(); factory.registerFunction<FunctionAddressToLine>();
} }

View File

@ -89,7 +89,7 @@ private:
} }
void registerFunctionAddressToLineWithInlines(FunctionFactory & factory) REGISTER_FUNCTION(AddressToLineWithInlines)
{ {
factory.registerFunction<FunctionAddressToLineWithInlines>(); factory.registerFunction<FunctionAddressToLineWithInlines>();
} }

View File

@ -94,7 +94,7 @@ public:
} }
void registerFunctionAddressToSymbol(FunctionFactory & factory) REGISTER_FUNCTION(AddressToSymbol)
{ {
factory.registerFunction<FunctionAddressToSymbol>(); factory.registerFunction<FunctionAddressToSymbol>();
} }

View File

@ -19,7 +19,7 @@ struct DecryptMySQLModeImpl
namespace DB namespace DB
{ {
void registerFunctionAESDecryptMysql(FunctionFactory & factory) REGISTER_FUNCTION(AESDecryptMysql)
{ {
factory.registerFunction<FunctionDecrypt<DecryptMySQLModeImpl>>(); factory.registerFunction<FunctionDecrypt<DecryptMySQLModeImpl>>();
} }

View File

@ -19,7 +19,7 @@ struct EncryptMySQLModeImpl
namespace DB namespace DB
{ {
void registerFunctionAESEncryptMysql(FunctionFactory & factory) REGISTER_FUNCTION(AESEncryptMysql)
{ {
factory.registerFunction<FunctionEncrypt<EncryptMySQLModeImpl>>(); factory.registerFunction<FunctionEncrypt<EncryptMySQLModeImpl>>();
} }

View File

@ -115,7 +115,7 @@ private:
} }
void registerFunctionAppendTrailingCharIfAbsent(FunctionFactory & factory) REGISTER_FUNCTION(AppendTrailingCharIfAbsent)
{ {
factory.registerFunction<FunctionAppendTrailingCharIfAbsent>(); factory.registerFunction<FunctionAppendTrailingCharIfAbsent>();
} }

View File

@ -1,6 +1,6 @@
include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake") include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake")
add_headers_and_sources(clickhouse_functions_array .) add_headers_and_sources(clickhouse_functions_array .)
add_library(clickhouse_functions_array ${clickhouse_functions_array_sources} ${clickhouse_functions_array_headers}) add_library(clickhouse_functions_array OBJECT ${clickhouse_functions_array_sources} ${clickhouse_functions_array_headers})
target_link_libraries(clickhouse_functions_array PRIVATE dbms clickhouse_functions_gatherutils) target_link_libraries(clickhouse_functions_array PRIVATE dbms clickhouse_functions_gatherutils)
if (OMIT_HEAVY_DEBUG_SYMBOLS) if (OMIT_HEAVY_DEBUG_SYMBOLS)

View File

@ -100,7 +100,7 @@ private:
}; };
void registerFunctionArray(FunctionFactory & factory) REGISTER_FUNCTION(Array)
{ {
factory.registerFunction<FunctionArray>(); factory.registerFunction<FunctionArray>();
} }

View File

@ -140,7 +140,7 @@ public:
/// auc(array_score, array_label) - Calculate AUC with array of score and label /// auc(array_score, array_label) - Calculate AUC with array of score and label
using FunctionArrayAUC = FunctionArrayScalarProduct<ArrayAUCImpl, NameArrayAUC>; using FunctionArrayAUC = FunctionArrayScalarProduct<ArrayAUCImpl, NameArrayAUC>;
void registerFunctionArrayAUC(FunctionFactory & factory) REGISTER_FUNCTION(ArrayAUC)
{ {
factory.registerFunction<FunctionArrayAUC>(); factory.registerFunction<FunctionArrayAUC>();
} }

View File

@ -387,7 +387,7 @@ using FunctionArrayAverage = FunctionArrayMapped<ArrayAggregateImpl<AggregateOpe
struct NameArrayProduct { static constexpr auto name = "arrayProduct"; }; struct NameArrayProduct { static constexpr auto name = "arrayProduct"; };
using FunctionArrayProduct = FunctionArrayMapped<ArrayAggregateImpl<AggregateOperation::product>, NameArrayProduct>; using FunctionArrayProduct = FunctionArrayMapped<ArrayAggregateImpl<AggregateOperation::product>, NameArrayProduct>;
void registerFunctionArrayAggregation(FunctionFactory & factory) REGISTER_FUNCTION(ArrayAggregation)
{ {
factory.registerFunction<FunctionArrayMin>(); factory.registerFunction<FunctionArrayMin>();
factory.registerFunction<FunctionArrayMax>(); factory.registerFunction<FunctionArrayMax>();

View File

@ -86,7 +86,7 @@ struct ArrayAllImpl
struct NameArrayAll { static constexpr auto name = "arrayAll"; }; struct NameArrayAll { static constexpr auto name = "arrayAll"; };
using FunctionArrayAll = FunctionArrayMapped<ArrayAllImpl, NameArrayAll>; using FunctionArrayAll = FunctionArrayMapped<ArrayAllImpl, NameArrayAll>;
void registerFunctionArrayAll(FunctionFactory & factory) REGISTER_FUNCTION(ArrayAll)
{ {
factory.registerFunction<FunctionArrayAll>(); factory.registerFunction<FunctionArrayAll>();
} }

View File

@ -162,7 +162,7 @@ struct ArrayCompactImpl
struct NameArrayCompact { static constexpr auto name = "arrayCompact"; }; struct NameArrayCompact { static constexpr auto name = "arrayCompact"; };
using FunctionArrayCompact = FunctionArrayMapped<ArrayCompactImpl, NameArrayCompact>; using FunctionArrayCompact = FunctionArrayMapped<ArrayCompactImpl, NameArrayCompact>;
void registerFunctionArrayCompact(FunctionFactory & factory) REGISTER_FUNCTION(ArrayCompact)
{ {
factory.registerFunction<FunctionArrayCompact>(); factory.registerFunction<FunctionArrayCompact>();
} }

View File

@ -98,7 +98,7 @@ public:
}; };
void registerFunctionArrayConcat(FunctionFactory & factory) REGISTER_FUNCTION(ArrayConcat)
{ {
factory.registerFunction<FunctionArrayConcat>(); factory.registerFunction<FunctionArrayConcat>();
} }

View File

@ -83,7 +83,7 @@ struct ArrayCountImpl
struct NameArrayCount { static constexpr auto name = "arrayCount"; }; struct NameArrayCount { static constexpr auto name = "arrayCount"; };
using FunctionArrayCount = FunctionArrayMapped<ArrayCountImpl, NameArrayCount>; using FunctionArrayCount = FunctionArrayMapped<ArrayCountImpl, NameArrayCount>;
void registerFunctionArrayCount(FunctionFactory & factory) REGISTER_FUNCTION(ArrayCount)
{ {
factory.registerFunction<FunctionArrayCount>(); factory.registerFunction<FunctionArrayCount>();
} }

View File

@ -162,7 +162,7 @@ struct ArrayCumSumImpl
struct NameArrayCumSum { static constexpr auto name = "arrayCumSum"; }; struct NameArrayCumSum { static constexpr auto name = "arrayCumSum"; };
using FunctionArrayCumSum = FunctionArrayMapped<ArrayCumSumImpl, NameArrayCumSum>; using FunctionArrayCumSum = FunctionArrayMapped<ArrayCumSumImpl, NameArrayCumSum>;
void registerFunctionArrayCumSum(FunctionFactory & factory) REGISTER_FUNCTION(ArrayCumSum)
{ {
factory.registerFunction<FunctionArrayCumSum>(); factory.registerFunction<FunctionArrayCumSum>();
} }

View File

@ -126,7 +126,7 @@ struct ArrayCumSumNonNegativeImpl
struct NameArrayCumSumNonNegative { static constexpr auto name = "arrayCumSumNonNegative"; }; struct NameArrayCumSumNonNegative { static constexpr auto name = "arrayCumSumNonNegative"; };
using FunctionArrayCumSumNonNegative = FunctionArrayMapped<ArrayCumSumNonNegativeImpl, NameArrayCumSumNonNegative>; using FunctionArrayCumSumNonNegative = FunctionArrayMapped<ArrayCumSumNonNegativeImpl, NameArrayCumSumNonNegative>;
void registerFunctionArrayCumSumNonNegative(FunctionFactory & factory) REGISTER_FUNCTION(ArrayCumSumNonNegative)
{ {
factory.registerFunction<FunctionArrayCumSumNonNegative>(); factory.registerFunction<FunctionArrayCumSumNonNegative>();
} }

View File

@ -155,7 +155,7 @@ struct ArrayDifferenceImpl
struct NameArrayDifference { static constexpr auto name = "arrayDifference"; }; struct NameArrayDifference { static constexpr auto name = "arrayDifference"; };
using FunctionArrayDifference = FunctionArrayMapped<ArrayDifferenceImpl, NameArrayDifference>; using FunctionArrayDifference = FunctionArrayMapped<ArrayDifferenceImpl, NameArrayDifference>;
void registerFunctionArrayDifference(FunctionFactory & factory) REGISTER_FUNCTION(ArrayDifference)
{ {
factory.registerFunction<FunctionArrayDifference>(); factory.registerFunction<FunctionArrayDifference>();
} }

View File

@ -289,7 +289,7 @@ void FunctionArrayDistinct::executeHashed(
} }
void registerFunctionArrayDistinct(FunctionFactory & factory) REGISTER_FUNCTION(ArrayDistinct)
{ {
factory.registerFunction<FunctionArrayDistinct>(); factory.registerFunction<FunctionArrayDistinct>();
} }

View File

@ -1203,7 +1203,7 @@ ColumnPtr FunctionArrayElement::perform(const ColumnsWithTypeAndName & arguments
} }
void registerFunctionArrayElement(FunctionFactory & factory) REGISTER_FUNCTION(ArrayElement)
{ {
factory.registerFunction<FunctionArrayElement>(); factory.registerFunction<FunctionArrayElement>();
} }

View File

@ -76,7 +76,7 @@ public:
}; };
void registerFunctionArrayEnumerate(FunctionFactory & factory) REGISTER_FUNCTION(ArrayEnumerate)
{ {
factory.registerFunction<FunctionArrayEnumerate>(); factory.registerFunction<FunctionArrayEnumerate>();
} }

View File

@ -14,7 +14,7 @@ public:
using Base::create; using Base::create;
}; };
void registerFunctionArrayEnumerateDense(FunctionFactory & factory) REGISTER_FUNCTION(ArrayEnumerateDense)
{ {
factory.registerFunction<FunctionArrayEnumerateDense>(); factory.registerFunction<FunctionArrayEnumerateDense>();
} }

Some files were not shown because too many files have changed in this diff Show More