1#include <AggregateFunctions/AggregateFunctionFactory.h>
2#include <AggregateFunctions/AggregateFunctionBoundingRatio.h>
3#include <AggregateFunctions/FactoryHelpers.h>
4#include "registerAggregateFunctions.h"
5
6
7namespace DB
8{
9
10namespace ErrorCodes
11{
12 extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
13}
14
15namespace
16{
17
18AggregateFunctionPtr createAggregateFunctionRate(const std::string & name, const DataTypes & argument_types, const Array & parameters)
19{
20 assertNoParameters(name, parameters);
21 assertBinary(name, argument_types);
22
23 if (argument_types.size() < 2)
24 throw Exception("Aggregate function " + name + " requires at least two arguments",
25 ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
26
27 return std::make_shared<AggregateFunctionBoundingRatio>(argument_types);
28}
29
30}
31
32void registerAggregateFunctionRate(AggregateFunctionFactory & factory)
33{
34 factory.registerFunction("boundingRatio", createAggregateFunctionRate, AggregateFunctionFactory::CaseInsensitive);
35}
36
37}
38