Simplification of aggregate functions: development [#CLICKHOUSE-2].

This commit is contained in:
Alexey Milovidov 2017-12-21 00:43:54 +03:00 committed by alexey-milovidov
parent c7c868cb99
commit 025041937a
2 changed files with 12 additions and 7 deletions

View File

@ -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(); }

View File

@ -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>);