mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 01:41:59 +00:00
4088c0a7f3
Automated register all functions with below naming convention by iterating through the symbols: void DB::registerXXX(DB::FunctionFactory &)
34 lines
614 B
C++
34 lines
614 B
C++
#include <Functions/FunctionMathUnary.h>
|
|
#include <Functions/FunctionFactory.h>
|
|
|
|
#if defined(OS_DARWIN)
|
|
extern "C"
|
|
{
|
|
double lgamma_r(double x, int * signgamp);
|
|
}
|
|
#endif
|
|
|
|
namespace DB
|
|
{
|
|
namespace
|
|
{
|
|
|
|
/// Use wrapper and use lgamma_r version because std::lgamma is not threadsafe.
|
|
Float64 lgamma_wrapper(Float64 arg)
|
|
{
|
|
int signp;
|
|
return lgamma_r(arg, &signp);
|
|
}
|
|
|
|
struct LGammaName { static constexpr auto name = "lgamma"; };
|
|
using FunctionLGamma = FunctionMathUnary<UnaryFunctionVectorized<LGammaName, lgamma_wrapper>>;
|
|
|
|
}
|
|
|
|
REGISTER_FUNCTION(LGamma)
|
|
{
|
|
factory.registerFunction<FunctionLGamma>();
|
|
}
|
|
|
|
}
|