diff --git a/src/AggregateFunctions/AggregateFunctionRankCorr.cpp b/src/AggregateFunctions/AggregateFunctionRankCorr.cpp new file mode 100644 index 00000000000..d3e7ecccee2 --- /dev/null +++ b/src/AggregateFunctions/AggregateFunctionRankCorr.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include "registerAggregateFunctions.h" + +#include +#include + + +namespace ErrorCodes +{ +extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; +extern const int NOT_IMPLEMENTED; +} + +namespace DB +{ + +namespace +{ + +AggregateFunctionPtr createAggregateFunctionRankCorr(const std::string & name, + const DataTypes & argument_types, + const Array & parameters) +{ + assertBinary(name, argument_types); + assertNoParameters(name, parameters); + + AggregateFunctionPtr res; + + if (isDecimal(argument_types[0]) || isDecimal(argument_types[1])) + { + throw Exception("Aggregate function " + name + " only supports numerical types.", ErrorCodes::NOT_IMPLEMENTED); + } + + else + { + res.reset(createWithTwoNumericTypes(*argument_types[0], *argument_types[1], + argument_types)); + } + + + if (!res) + { + throw Exception("Aggregate function " + name + " only supports numerical types.", ErrorCodes::NOT_IMPLEMENTED); + } + + return res; +} + +} + + +void registerAggregateFunctionRankCorr(AggregateFunctionFactory & factory) +{ + factory.registerFunction("RankCorr", createAggregateFunctionRankCorr, AggregateFunctionFactory::CaseInsensitive); +} + +} \ No newline at end of file diff --git a/src/AggregateFunctions/AggregateFunctionRankCorr.h b/src/AggregateFunctions/AggregateFunctionRankCorr.h new file mode 100644 index 00000000000..4d59f3dea16 --- /dev/null +++ b/src/AggregateFunctions/AggregateFunctionRankCorr.h @@ -0,0 +1,290 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +#include +#include + +#include + +namespace ErrorCodes +{ +extern const int BAD_ARGUMENTS; +} + +namespace DB +{ + +template