ClickHouse/src/AggregateFunctions/AggregateFunctionRetention.cpp

39 lines
1.1 KiB
C++
Raw Normal View History

2018-08-16 03:11:35 +00:00
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionRetention.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
2019-12-15 06:34:43 +00:00
#include "registerAggregateFunctions.h"
2018-08-16 03:11:35 +00:00
namespace DB
{
2020-02-25 18:10:48 +00:00
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
}
2018-08-16 03:11:35 +00:00
namespace
{
AggregateFunctionPtr createAggregateFunctionRetention(const std::string & name, const DataTypes & arguments, const Array & params)
{
assertNoParameters(name, params);
2018-08-23 00:49:18 +00:00
if (arguments.size() < 2)
throw Exception("Not enough event arguments for aggregate function " + name, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
if (arguments.size() > AggregateFunctionRetentionData::max_events)
2018-08-16 03:11:35 +00:00
throw Exception("Too many event arguments for aggregate function " + name, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
return std::make_shared<AggregateFunctionRetention>(arguments);
}
}
void registerAggregateFunctionRetention(AggregateFunctionFactory & factory)
{
factory.registerFunction("retention", createAggregateFunctionRetention);
2018-08-16 03:11:35 +00:00
}
}