1#include <AggregateFunctions/AggregateFunctionFactory.h>
2#include <AggregateFunctions/AggregateFunctionRetention.h>
3#include <AggregateFunctions/Helpers.h>
4#include <AggregateFunctions/FactoryHelpers.h>
5#include "registerAggregateFunctions.h"
6
7
8namespace DB
9{
10
11namespace
12{
13
14AggregateFunctionPtr createAggregateFunctionRetention(const std::string & name, const DataTypes & arguments, const Array & params)
15{
16 assertNoParameters(name, params);
17
18 if (arguments.size() < 2)
19 throw Exception("Not enough event arguments for aggregate function " + name, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
20
21 if (arguments.size() > AggregateFunctionRetentionData::max_events)
22 throw Exception("Too many event arguments for aggregate function " + name, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
23
24 return std::make_shared<AggregateFunctionRetention>(arguments);
25}
26
27}
28
29void registerAggregateFunctionRetention(AggregateFunctionFactory & factory)
30{
31 factory.registerFunction("retention", createAggregateFunctionRetention, AggregateFunctionFactory::CaseInsensitive);
32}
33
34}
35