1#include "AggregateFunctionTimeSeriesGroupSum.h"
2#include "AggregateFunctionFactory.h"
3#include "FactoryHelpers.h"
4#include "Helpers.h"
5#include "registerAggregateFunctions.h"
6
7
8namespace DB
9{
10namespace
11{
12 template <bool rate>
13 AggregateFunctionPtr createAggregateFunctionTimeSeriesGroupSum(const std::string & name, const DataTypes & arguments, const Array & params)
14 {
15 assertNoParameters(name, params);
16
17 if (arguments.size() < 3)
18 throw Exception("Not enough event arguments for aggregate function " + name, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
19
20 return std::make_shared<AggregateFunctionTimeSeriesGroupSum<rate>>(arguments);
21 }
22
23}
24
25void registerAggregateFunctionTimeSeriesGroupSum(AggregateFunctionFactory & factory)
26{
27 factory.registerFunction("timeSeriesGroupSum", createAggregateFunctionTimeSeriesGroupSum<false>, AggregateFunctionFactory::CaseInsensitive);
28 factory.registerFunction("timeSeriesGroupRateSum", createAggregateFunctionTimeSeriesGroupSum<true>, AggregateFunctionFactory::CaseInsensitive);
29}
30
31}
32