mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 02:12:21 +00:00
4088c0a7f3
Automated register all functions with below naming convention by iterating through the symbols: void DB::registerXXX(DB::FunctionFactory &)
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#include <DataTypes/DataTypesNumber.h>
|
|
#include <Functions/FunctionFactory.h>
|
|
#include <Functions/FunctionHelpers.h>
|
|
#include <Functions/IFunction.h>
|
|
|
|
#include <base/getThreadId.h>
|
|
|
|
namespace DB
|
|
{
|
|
namespace
|
|
{
|
|
class FunctionTid : public IFunction
|
|
{
|
|
public:
|
|
static constexpr auto name = "tid";
|
|
static FunctionPtr create(ContextPtr) { return std::make_shared<FunctionTid>(); }
|
|
|
|
String getName() const override { return name; }
|
|
|
|
size_t getNumberOfArguments() const override { return 0; }
|
|
|
|
DataTypePtr getReturnTypeImpl(const DataTypes &) const override { return std::make_shared<DataTypeUInt64>(); }
|
|
|
|
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return false; }
|
|
|
|
ColumnPtr executeImpl(const ColumnsWithTypeAndName &, const DataTypePtr &, size_t input_rows_count) const override
|
|
{
|
|
auto current_tid = getThreadId();
|
|
return DataTypeUInt64().createColumnConst(input_rows_count, current_tid);
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
REGISTER_FUNCTION(Tid)
|
|
{
|
|
factory.registerFunction<FunctionTid>();
|
|
}
|
|
|
|
}
|