#include #include #include namespace DB { namespace { AggregateFunctionPtr createAggregateFunctionQuantile(const std::string & name, const DataTypes & argument_types, const Array & parameters) { if (argument_types.size() != 1) throw Exception("Incorrect number of arguments for aggregate function " + name, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); const IDataType & argument_type = *argument_types[0]; if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else throw Exception("Illegal type " + argument_types[0]->getName() + " of argument for aggregate function " + name, ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); } AggregateFunctionPtr createAggregateFunctionQuantiles(const std::string & name, const DataTypes & argument_types, const Array & parameters) { if (argument_types.size() != 1) throw Exception("Incorrect number of arguments for aggregate function " + name, ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); const IDataType & argument_type = *argument_types[0]; if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else if (typeid_cast(&argument_type)) return std::make_shared>(); else throw Exception("Illegal type " + argument_types[0]->getName() + " of argument for aggregate function " + name, ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); } } void registerAggregateFunctionsQuantile(AggregateFunctionFactory & factory) { factory.registerFunction("quantile", createAggregateFunctionQuantile); factory.registerFunction("median", createAggregateFunctionQuantile); factory.registerFunction("quantiles", createAggregateFunctionQuantiles); } }