2018-05-12 15:49:17 +00:00
# include <AggregateFunctions/AggregateFunctionFactory.h>
# include <AggregateFunctions/AggregateFunctionWindowFunnel.h>
# include <AggregateFunctions/Helpers.h>
# include <AggregateFunctions/FactoryHelpers.h>
namespace DB
{
namespace
{
AggregateFunctionPtr createAggregateFunctionWindowFunnel ( const std : : string & name , const DataTypes & arguments , const Array & params )
{
2018-05-13 10:05:34 +00:00
if ( params . size ( ) ! = 1 )
throw Exception { " Aggregate function " + name + " requires exactly one parameter. " , ErrorCodes : : NUMBER_OF_ARGUMENTS_DOESNT_MATCH } ;
if ( arguments . size ( ) < 2 )
throw Exception ( " Aggregate function " + name + " requires one timestamp argument and at least one event condition. " , ErrorCodes : : NUMBER_OF_ARGUMENTS_DOESNT_MATCH ) ;
if ( arguments . size ( ) > AggregateFunctionWindowFunnelData : : max_events + 1 )
throw Exception ( " Too many event arguments for aggregate function " + name , ErrorCodes : : NUMBER_OF_ARGUMENTS_DOESNT_MATCH ) ;
2018-05-12 15:49:17 +00:00
return std : : make_shared < AggregateFunctionWindowFunnel > ( arguments , params ) ;
}
}
void registerAggregateFunctionWindowFunnel ( AggregateFunctionFactory & factory )
{
factory . registerFunction ( " windowFunnel " , createAggregateFunctionWindowFunnel , AggregateFunctionFactory : : CaseInsensitive ) ;
}
}