ClickHouse/src/Functions/blockSize.cpp
Robert Schulze 4abc36774e
Some cleanup of isDeterministic(InScopeOfQuery)()
In cases where the implementation simply repeates the implementation
inherited from the base class, it can be omitted.
2022-12-07 14:34:31 +00:00

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>();
}
}