ClickHouse/src/Functions/identity.cpp
Alexander Kuzmenkov 3f57fc085b remove mutable context references from functions interface
Also remove it from some visitors.
2021-05-28 19:45:37 +03:00

42 lines
934 B
C++

#include <Functions/IFunction.h>
#include <Functions/FunctionFactory.h>
namespace DB
{
namespace
{
class FunctionIdentity : public IFunction
{
public:
static constexpr auto name = "identity";
static FunctionPtr create(ContextConstPtr)
{
return std::make_shared<FunctionIdentity>();
}
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 1; }
bool isSuitableForConstantFolding() const override { return false; }
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
{
return arguments.front();
}
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t /*input_rows_count*/) const override
{
return arguments.front().column;
}
};
}
void registerFunctionIdentity(FunctionFactory & factory)
{
factory.registerFunction<FunctionIdentity>();
}
}