mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Simplification of aggregate functions: development [#CLICKHOUSE-2].
This commit is contained in:
parent
c7c868cb99
commit
025041937a
@ -7,6 +7,7 @@
|
||||
#include <Columns/ColumnString.h>
|
||||
#include <DataTypes/IDataType.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <common/StringRef.h>
|
||||
|
||||
#include <AggregateFunctions/IAggregateFunction.h>
|
||||
|
||||
@ -688,9 +689,13 @@ private:
|
||||
public:
|
||||
AggregateFunctionsSingleValue(const DataTypePtr & type) : type(type)
|
||||
{
|
||||
if (!type->isComparable())
|
||||
throw Exception("Illegal type " + type->getName() + " of argument of aggregate function " + getName()
|
||||
+ " because the values of that data type are not comparable", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
if (StringRef(Data::name()) == StringRef("min")
|
||||
|| StringRef(Data::name()) == StringRef("max"))
|
||||
{
|
||||
if (!type->isComparable())
|
||||
throw Exception("Illegal type " + type->getName() + " of argument of aggregate function " + getName()
|
||||
+ " because the values of that data type are not comparable", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
}
|
||||
|
||||
String getName() const override { return Data::name(); }
|
||||
|
@ -101,14 +101,14 @@ void registerAggregateFunctionsQuantile(AggregateFunctionFactory & factory)
|
||||
createAggregateFunctionQuantile<QuantileExactWeighted, NameQuantilesExactWeighted, true, false, true>);
|
||||
|
||||
factory.registerFunction(NameQuantileTiming::name,
|
||||
createAggregateFunctionQuantile<QuantileTiming, NameQuantileTiming, false, false, false>);
|
||||
createAggregateFunctionQuantile<QuantileTiming, NameQuantileTiming, false, true, false>);
|
||||
factory.registerFunction(NameQuantilesTiming::name,
|
||||
createAggregateFunctionQuantile<QuantileTiming, NameQuantilesTiming, false, false, true>);
|
||||
createAggregateFunctionQuantile<QuantileTiming, NameQuantilesTiming, false, true, true>);
|
||||
|
||||
factory.registerFunction(NameQuantileTimingWeighted::name,
|
||||
createAggregateFunctionQuantile<QuantileTiming, NameQuantileTimingWeighted, true, false, false>);
|
||||
createAggregateFunctionQuantile<QuantileTiming, NameQuantileTimingWeighted, true, true, false>);
|
||||
factory.registerFunction(NameQuantilesTimingWeighted::name,
|
||||
createAggregateFunctionQuantile<QuantileTiming, NameQuantilesTimingWeighted, true, false, true>);
|
||||
createAggregateFunctionQuantile<QuantileTiming, NameQuantilesTimingWeighted, true, true, true>);
|
||||
|
||||
factory.registerFunction(NameQuantileTDigest::name,
|
||||
createAggregateFunctionQuantile<QuantileTDigest, NameQuantileTDigest, false, true, false>);
|
||||
|
Loading…
Reference in New Issue
Block a user