1#pragma once
2
3#include <DataTypes/DataTypesNumber.h>
4#include <Columns/ColumnsNumber.h>
5#include <Functions/IFunctionImpl.h>
6
7
8namespace DB
9{
10
11template <typename Impl>
12class FunctionMathConstFloat64 : public IFunction
13{
14public:
15 static constexpr auto name = Impl::name;
16 static FunctionPtr create(const Context &) { return std::make_shared<FunctionMathConstFloat64>(); }
17
18private:
19 String getName() const override { return name; }
20
21 size_t getNumberOfArguments() const override { return 0; }
22
23 DataTypePtr getReturnTypeImpl(const DataTypes & /*arguments*/) const override
24 {
25 return std::make_shared<DataTypeFloat64>();
26 }
27
28 void executeImpl(Block & block, const ColumnNumbers &, size_t result, size_t input_rows_count) override
29 {
30 block.getByPosition(result).column = block.getByPosition(result).type->createColumnConst(input_rows_count, Impl::value);
31 }
32};
33
34}
35