mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
4abc36774e
In cases where the implementation simply repeates the implementation inherited from the base class, it can be omitted.
68 lines
1.4 KiB
C++
68 lines
1.4 KiB
C++
#include <Functions/IFunction.h>
|
|
#include <Functions/FunctionFactory.h>
|
|
#include <DataTypes/DataTypesNumber.h>
|
|
#include <Columns/ColumnsNumber.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
namespace
|
|
{
|
|
|
|
/** columnsSize() - get the columns size in number of rows.
|
|
*/
|
|
class FunctionBlockSize : public IFunction
|
|
{
|
|
public:
|
|
static constexpr auto name = "blockSize";
|
|
static FunctionPtr create(ContextPtr)
|
|
{
|
|
return std::make_shared<FunctionBlockSize>();
|
|
}
|
|
|
|
/// Get the function name.
|
|
String getName() const override
|
|
{
|
|
return name;
|
|
}
|
|
|
|
bool isDeterministic() const override
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool isDeterministicInScopeOfQuery() const override
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override
|
|
{
|
|
return false;
|
|
}
|
|
|
|
size_t getNumberOfArguments() const override
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
DataTypePtr getReturnTypeImpl(const DataTypes & /*arguments*/) const override
|
|
{
|
|
return std::make_shared<DataTypeUInt64>();
|
|
}
|
|
|
|
ColumnPtr executeImpl(const ColumnsWithTypeAndName &, const DataTypePtr &, size_t input_rows_count) const override
|
|
{
|
|
return ColumnUInt64::create(input_rows_count, input_rows_count);
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
REGISTER_FUNCTION(BlockSize)
|
|
{
|
|
factory.registerFunction<FunctionBlockSize>();
|
|
}
|
|
|
|
}
|