ClickHouse/src/AggregateFunctions/AggregateFunctionCount.cpp

35 lines
974 B
C++
Raw Normal View History

#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionCount.h>
#include <AggregateFunctions/FactoryHelpers.h>
2019-12-15 06:34:43 +00:00
#include "registerAggregateFunctions.h"
2015-09-24 12:40:36 +00:00
namespace DB
{
2020-06-14 07:44:02 +00:00
AggregateFunctionPtr AggregateFunctionCount::getOwnNullAdapter(
const AggregateFunctionPtr &, const DataTypes & types, const Array & params) const
{
return std::make_shared<AggregateFunctionCountNotNullUnary>(types[0], params);
}
2015-09-24 12:40:36 +00:00
namespace
{
2019-02-11 19:26:32 +00:00
AggregateFunctionPtr createAggregateFunctionCount(const std::string & name, const DataTypes & argument_types, const Array & parameters)
2015-09-24 12:40:36 +00:00
{
assertNoParameters(name, parameters);
2019-10-12 15:15:16 +00:00
assertArityAtMost<1>(name, argument_types);
2019-02-11 19:26:32 +00:00
return std::make_shared<AggregateFunctionCount>(argument_types);
2015-09-24 12:40:36 +00:00
}
}
void registerAggregateFunctionCount(AggregateFunctionFactory & factory)
{
2020-06-14 07:44:02 +00:00
factory.registerFunction("count", {createAggregateFunctionCount, {true}}, AggregateFunctionFactory::CaseInsensitive);
2015-09-24 12:40:36 +00:00
}
}