Merge pull request #24524 from ClickHouse/revert-22762-create-aggregate-func-settings

Revert "Pass Settings to aggregate function creator"
This commit is contained in:
Vladimir 2021-05-26 14:46:53 +03:00 committed by GitHub
commit 9027e32990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
127 changed files with 76 additions and 257 deletions

View File

@ -11,7 +11,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -106,7 +105,7 @@ public:
void registerAggregateFunctionAggThrow(AggregateFunctionFactory & factory)
{
factory.registerFunction("aggThrow", [](const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
factory.registerFunction("aggThrow", [](const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
Float64 throw_probability = 1.0;
if (parameters.size() == 1)

View File

@ -1,27 +1,28 @@
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/HelpersMinMaxAny.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include "registerAggregateFunctions.h"
namespace DB
{
struct Settings;
namespace
{
AggregateFunctionPtr createAggregateFunctionAny(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
AggregateFunctionPtr createAggregateFunctionAny(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyData>(name, argument_types, parameters, settings));
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyData>(name, argument_types, parameters));
}
AggregateFunctionPtr createAggregateFunctionAnyLast(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
AggregateFunctionPtr createAggregateFunctionAnyLast(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyLastData>(name, argument_types, parameters, settings));
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyLastData>(name, argument_types, parameters));
}
AggregateFunctionPtr createAggregateFunctionAnyHeavy(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
AggregateFunctionPtr createAggregateFunctionAnyHeavy(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyHeavyData>(name, argument_types, parameters, settings));
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionAnyHeavyData>(name, argument_types, parameters));
}
}

View File

@ -8,7 +8,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -5,7 +5,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -9,7 +9,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -3,11 +3,10 @@
#include <AggregateFunctions/AggregateFunctionAvg.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include "registerAggregateFunctions.h"
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
@ -21,7 +20,7 @@ bool allowType(const DataTypePtr& type) noexcept
return t.isInt() || t.isUInt() || t.isFloat() || t.isDecimal();
}
AggregateFunctionPtr createAggregateFunctionAvg(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionAvg(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertUnary(name, argument_types);

View File

@ -12,7 +12,6 @@
namespace DB
{
struct Settings;
template <typename T>
using DecimalOrVectorCol = std::conditional_t<IsDecimalNumber<T>, ColumnDecimal<T>, ColumnVector<T>>;

View File

@ -4,11 +4,10 @@
#include <AggregateFunctions/AggregateFunctionAvgWeighted.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include "registerAggregateFunctions.h"
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
@ -61,8 +60,7 @@ static IAggregateFunction * create(const IDataType & first_type, const IDataType
#undef LINE
}
AggregateFunctionPtr
createAggregateFunctionAvgWeighted(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionAvgWeighted(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertBinary(name, argument_types);

View File

@ -5,8 +5,6 @@
namespace DB
{
struct Settings;
template <typename T>
using AvgWeightedFieldType = std::conditional_t<IsDecimalNumber<T>,
std::conditional_t<std::is_same_v<T, Decimal256>, Decimal256, Decimal128>,

View File

@ -7,8 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
@ -18,7 +16,7 @@ namespace
{
template <template <typename> class Data>
AggregateFunctionPtr createAggregateFunctionBitwise(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionBitwise(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertUnary(name, argument_types);

View File

@ -12,7 +12,6 @@
namespace DB
{
struct Settings;
template <typename T>

View File

@ -6,7 +6,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -16,7 +15,7 @@ namespace ErrorCodes
namespace
{
AggregateFunctionPtr createAggregateFunctionRate(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionRate(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertBinary(name, argument_types);

View File

@ -11,7 +11,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -8,7 +8,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -22,8 +21,8 @@ namespace
AggregateFunctionPtr createAggregateFunctionCategoricalIV(
const std::string & name,
const DataTypes & arguments,
const Array & params,
const Settings *)
const Array & params
)
{
assertNoParameters(name, params);

View File

@ -13,7 +13,6 @@
namespace DB
{
struct Settings;
template <typename T = UInt64>
class AggregateFunctionCategoricalIV final : public IAggregateFunctionHelper<AggregateFunctionCategoricalIV<T>>

View File

@ -5,7 +5,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -9,7 +9,6 @@
namespace DB
{
struct Settings;
/** Create aggregate function combinator by matching suffix in aggregate function name.
*/

View File

@ -6,7 +6,6 @@
namespace DB
{
struct Settings;
AggregateFunctionPtr AggregateFunctionCount::getOwnNullAdapter(
const AggregateFunctionPtr &, const DataTypes & types, const Array & params, const AggregateFunctionProperties & /*properties*/) const
@ -17,7 +16,7 @@ AggregateFunctionPtr AggregateFunctionCount::getOwnNullAdapter(
namespace
{
AggregateFunctionPtr createAggregateFunctionCount(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionCount(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertArityAtMost<1>(name, argument_types);

View File

@ -13,7 +13,6 @@
namespace DB
{
struct Settings;
struct AggregateFunctionCountData
{

View File

@ -7,7 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -21,8 +20,7 @@ namespace
AggregateFunctionPtr createAggregateFunctionDeltaSum(
const String & name,
const DataTypes & arguments,
const Array & params,
const Settings *)
const Array & params)
{
assertNoParameters(name, params);

View File

@ -15,7 +15,6 @@
namespace DB
{
struct Settings;
template <typename T>
struct AggregationFunctionDeltaSumData

View File

@ -20,8 +20,7 @@ namespace
AggregateFunctionPtr createAggregateFunctionDeltaSumTimestamp(
const String & name,
const DataTypes & arguments,
const Array & params,
const Settings *)
const Array & params)
{
assertNoParameters(name, params);

View File

@ -6,8 +6,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;

View File

@ -13,7 +13,6 @@
namespace DB
{
struct Settings;
template <typename T>

View File

@ -7,7 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -17,7 +16,7 @@ namespace ErrorCodes
namespace
{
AggregateFunctionPtr createAggregateFunctionEntropy(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionEntropy(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
if (argument_types.empty())

View File

@ -14,7 +14,6 @@
namespace DB
{
struct Settings;
/** Calculates Shannon Entropy, using HashMap and computing empirical distribution function.
* Entropy is measured in bits (base-2 logarithm is used).

View File

@ -23,7 +23,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -138,8 +137,7 @@ AggregateFunctionPtr AggregateFunctionFactory::getImpl(
if (!out_properties.returns_default_when_only_null && has_null_arguments)
return nullptr;
const Settings * settings = query_context ? &query_context->getSettingsRef() : nullptr;
return found.creator(name, argument_types, parameters, settings);
return found.creator(name, argument_types, parameters);
}
/// Combinators of aggregate functions.

View File

@ -14,7 +14,6 @@
namespace DB
{
struct Settings;
class Context;
class IDataType;
@ -27,7 +26,7 @@ using DataTypes = std::vector<DataTypePtr>;
* Parameters are for "parametric" aggregate functions.
* For example, in quantileWeighted(0.9)(x, weight), 0.9 is "parameter" and x, weight are "arguments".
*/
using AggregateFunctionCreator = std::function<AggregateFunctionPtr(const String &, const DataTypes &, const Array &, const Settings *)>;
using AggregateFunctionCreator = std::function<AggregateFunctionPtr(const String &, const DataTypes &, const Array &)>;
struct AggregateFunctionWithProperties
{

View File

@ -6,7 +6,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -13,7 +13,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -9,7 +9,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -50,7 +49,7 @@ inline AggregateFunctionPtr createAggregateFunctionGroupArrayImpl(const DataType
}
AggregateFunctionPtr createAggregateFunctionGroupArray(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionGroupArray(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertUnary(name, argument_types);
@ -84,7 +83,7 @@ AggregateFunctionPtr createAggregateFunctionGroupArray(const std::string & name,
return createAggregateFunctionGroupArrayImpl<GroupArrayTrait<true, Sampler::NONE>>(argument_types[0], max_elems);
}
AggregateFunctionPtr createAggregateFunctionGroupArraySample(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionGroupArraySample(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertUnary(name, argument_types);

View File

@ -26,8 +26,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int TOO_LARGE_ARRAY_SIZE;

View File

@ -7,8 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
@ -17,7 +15,7 @@ namespace ErrorCodes
namespace
{
AggregateFunctionPtr createAggregateFunctionGroupArrayInsertAt(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionGroupArrayInsertAt(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertBinary(name, argument_types);

View File

@ -20,7 +20,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -10,7 +10,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -58,7 +57,7 @@ inline AggregateFunctionPtr createAggregateFunctionMovingImpl(const std::string
}
template <template <typename, typename> class Function>
AggregateFunctionPtr createAggregateFunctionMoving(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionMoving(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertUnary(name, argument_types);

View File

@ -22,7 +22,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -9,8 +9,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
@ -35,7 +33,7 @@ namespace
}
template <template <typename> class Data>
AggregateFunctionPtr createAggregateFunctionBitmap(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionBitmap(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertUnary(name, argument_types);
@ -59,7 +57,7 @@ namespace
// Additional aggregate functions to manipulate bitmaps.
template <template <typename, typename> class AggregateFunctionTemplate>
AggregateFunctionPtr
createAggregateFunctionBitmapL2(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
createAggregateFunctionBitmapL2(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertUnary(name, argument_types);

View File

@ -11,7 +11,6 @@
namespace DB
{
struct Settings;
/// Counts bitmap operation on numbers.
template <typename T, typename Data>
class AggregateFunctionBitmap final : public IAggregateFunctionDataHelper<Data, AggregateFunctionBitmap<T, Data>>

View File

@ -16,7 +16,6 @@
namespace DB
{
struct Settings;
enum BitmapKind
{

View File

@ -9,7 +9,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -73,7 +72,7 @@ inline AggregateFunctionPtr createAggregateFunctionGroupUniqArrayImpl(const std:
}
AggregateFunctionPtr createAggregateFunctionGroupUniqArray(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionGroupUniqArray(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertUnary(name, argument_types);

View File

@ -23,7 +23,6 @@
namespace DB
{
struct Settings;
template <typename T>

View File

@ -8,7 +8,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -23,7 +22,7 @@ namespace ErrorCodes
namespace
{
AggregateFunctionPtr createAggregateFunctionHistogram(const std::string & name, const DataTypes & arguments, const Array & params, const Settings *)
AggregateFunctionPtr createAggregateFunctionHistogram(const std::string & name, const DataTypes & arguments, const Array & params)
{
if (params.size() != 1)
throw Exception("Function " + name + " requires single parameter: bins count", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);

View File

@ -26,7 +26,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -6,7 +6,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -8,7 +8,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -16,8 +16,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int BAD_ARGUMENTS;
@ -31,7 +29,7 @@ namespace
using FuncLogisticRegression = AggregateFunctionMLMethod<LinearModelData, NameLogisticRegression>;
template <class Method>
AggregateFunctionPtr
createAggregateFunctionMLMethod(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
createAggregateFunctionMLMethod(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
if (parameters.size() > 4)
throw Exception(

View File

@ -11,8 +11,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;

View File

@ -12,12 +12,11 @@ extern const int NOT_IMPLEMENTED;
namespace DB
{
struct Settings;
namespace
{
AggregateFunctionPtr createAggregateFunctionMannWhitneyUTest(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionMannWhitneyUTest(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertBinary(name, argument_types);

View File

@ -23,7 +23,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -6,19 +6,18 @@
namespace DB
{
struct Settings;
namespace
{
AggregateFunctionPtr createAggregateFunctionMax(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
AggregateFunctionPtr createAggregateFunctionMax(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionMaxData>(name, argument_types, parameters, settings));
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionMaxData>(name, argument_types, parameters));
}
AggregateFunctionPtr createAggregateFunctionArgMax(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
AggregateFunctionPtr createAggregateFunctionArgMax(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
return AggregateFunctionPtr(createAggregateFunctionArgMinMax<AggregateFunctionMaxData>(name, argument_types, parameters, settings));
return AggregateFunctionPtr(createAggregateFunctionArgMinMax<AggregateFunctionMaxData>(name, argument_types, parameters));
}
}

View File

@ -7,8 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
@ -34,17 +32,11 @@ namespace
void registerAggregateFunctionsMaxIntersections(AggregateFunctionFactory & factory)
{
factory.registerFunction("maxIntersections",
[](const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
{
return createAggregateFunctionMaxIntersections(AggregateFunctionIntersectionsKind::Count, name, argument_types, parameters);
});
factory.registerFunction("maxIntersections", [](const std::string & name, const DataTypes & argument_types, const Array & parameters)
{ return createAggregateFunctionMaxIntersections(AggregateFunctionIntersectionsKind::Count, name, argument_types, parameters); });
factory.registerFunction("maxIntersectionsPosition",
[](const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
{
return createAggregateFunctionMaxIntersections(AggregateFunctionIntersectionsKind::Position, name, argument_types, parameters);
});
factory.registerFunction("maxIntersectionsPosition", [](const std::string & name, const DataTypes & argument_types, const Array & parameters)
{ return createAggregateFunctionMaxIntersections(AggregateFunctionIntersectionsKind::Position, name, argument_types, parameters); });
}
}

View File

@ -19,7 +19,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -6,7 +6,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -9,8 +9,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;

View File

@ -6,19 +6,18 @@
namespace DB
{
struct Settings;
namespace
{
AggregateFunctionPtr createAggregateFunctionMin(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
AggregateFunctionPtr createAggregateFunctionMin(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionMinData>(name, argument_types, parameters, settings));
return AggregateFunctionPtr(createAggregateFunctionSingleValue<AggregateFunctionsSingleValue, AggregateFunctionMinData>(name, argument_types, parameters));
}
AggregateFunctionPtr createAggregateFunctionArgMin(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
AggregateFunctionPtr createAggregateFunctionArgMin(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
return AggregateFunctionPtr(createAggregateFunctionArgMinMax<AggregateFunctionMinData>(name, argument_types, parameters, settings));
return AggregateFunctionPtr(createAggregateFunctionArgMinMax<AggregateFunctionMinData>(name, argument_types, parameters));
}
}

View File

@ -15,8 +15,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;

View File

@ -8,7 +8,6 @@
namespace DB
{
struct Settings;
/** Aggregate function that takes arbitrary number of arbitrary arguments and does nothing.

View File

@ -9,7 +9,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -12,7 +12,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -6,7 +6,6 @@
namespace DB
{
struct Settings;
namespace
{

View File

@ -11,7 +11,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -8,7 +8,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -84,7 +83,7 @@ static constexpr bool supportBigInt()
}
template <template <typename, bool> class Function>
AggregateFunctionPtr createAggregateFunctionQuantile(const std::string & name, const DataTypes & argument_types, const Array & params, const Settings *)
AggregateFunctionPtr createAggregateFunctionQuantile(const std::string & name, const DataTypes & argument_types, const Array & params)
{
/// Second argument type check doesn't depend on the type of the first one.
Function<void, true>::assertSecondArg(argument_types);

View File

@ -29,7 +29,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -12,12 +12,11 @@ extern const int NOT_IMPLEMENTED;
namespace DB
{
struct Settings;
namespace
{
AggregateFunctionPtr createAggregateFunctionRankCorrelation(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionRankCorrelation(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertBinary(name, argument_types);
assertNoParameters(name, parameters);

View File

@ -18,7 +18,6 @@
namespace DB
{
struct Settings;
struct RankCorrelationData : public StatisticalSample<Float64, Float64>

View File

@ -6,7 +6,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -9,7 +9,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -7,8 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
@ -17,7 +15,7 @@ namespace ErrorCodes
namespace
{
AggregateFunctionPtr createAggregateFunctionRetention(const std::string & name, const DataTypes & arguments, const Array & params, const Settings *)
AggregateFunctionPtr createAggregateFunctionRetention(const std::string & name, const DataTypes & arguments, const Array & params)
{
assertNoParameters(name, params);

View File

@ -17,8 +17,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;

View File

@ -10,7 +10,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -24,7 +23,7 @@ namespace
{
template <template <typename, typename> class AggregateFunction, template <typename> class Data>
AggregateFunctionPtr createAggregateFunctionSequenceBase(const std::string & name, const DataTypes & argument_types, const Array & params, const Settings *)
AggregateFunctionPtr createAggregateFunctionSequenceBase(const std::string & name, const DataTypes & argument_types, const Array & params)
{
if (params.size() != 1)
throw Exception{"Aggregate function " + name + " requires exactly one parameter.",

View File

@ -15,7 +15,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -4,12 +4,10 @@
#include <AggregateFunctions/FactoryHelpers.h>
#include <Core/TypeListNumber.h>
#include "registerAggregateFunctions.h"
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
@ -21,8 +19,8 @@ namespace
AggregateFunctionPtr createAggregateFunctionSimpleLinearRegression(
const String & name,
const DataTypes & arguments,
const Array & params,
const Settings *)
const Array & params
)
{
assertNoParameters(name, params);
assertBinary(name, arguments);

View File

@ -13,7 +13,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -3,7 +3,6 @@
namespace DB
{
struct Settings;
namespace
{
class AggregateFunctionCombinatorSimpleState final : public IAggregateFunctionCombinator

View File

@ -7,7 +7,6 @@
namespace DB
{
struct Settings;
/** Not an aggregate function, but an adapter of aggregate functions.
* Aggregate functions with the `SimpleState` suffix is almost identical to the corresponding ones,

View File

@ -7,7 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -8,7 +8,6 @@
namespace DB
{
struct Settings;
/** Not an aggregate function, but an adapter of aggregate functions,

View File

@ -7,7 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -18,7 +17,7 @@ namespace
{
template <template <typename> class FunctionTemplate>
AggregateFunctionPtr createAggregateFunctionStatisticsUnary(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionStatisticsUnary(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertUnary(name, argument_types);
@ -32,7 +31,7 @@ AggregateFunctionPtr createAggregateFunctionStatisticsUnary(const std::string &
}
template <template <typename, typename> class FunctionTemplate>
AggregateFunctionPtr createAggregateFunctionStatisticsBinary(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionStatisticsBinary(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertBinary(name, argument_types);

View File

@ -12,7 +12,6 @@
namespace DB
{
struct Settings;
namespace detail
{

View File

@ -7,7 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -18,7 +17,7 @@ namespace
{
template <template <typename> class FunctionTemplate>
AggregateFunctionPtr createAggregateFunctionStatisticsUnary(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionStatisticsUnary(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertUnary(name, argument_types);
@ -37,7 +36,7 @@ AggregateFunctionPtr createAggregateFunctionStatisticsUnary(const std::string &
}
template <template <typename, typename> class FunctionTemplate>
AggregateFunctionPtr createAggregateFunctionStatisticsBinary(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionStatisticsBinary(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertBinary(name, argument_types);

View File

@ -30,7 +30,6 @@
namespace DB
{
struct Settings;
enum class StatisticsFunctionKind
{

View File

@ -14,7 +14,6 @@ namespace ErrorCodes
namespace DB
{
struct Settings;
namespace
{
@ -57,7 +56,7 @@ struct StudentTTestData : public TTestMoments<Float64>
}
};
AggregateFunctionPtr createAggregateFunctionStudentTTest(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionStudentTTest(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertBinary(name, argument_types);
assertNoParameters(name, parameters);

View File

@ -7,8 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
@ -52,7 +50,7 @@ template <typename T> using AggregateFunctionSumKahan =
template <template <typename> class Function>
AggregateFunctionPtr createAggregateFunctionSum(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionSum(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertUnary(name, argument_types);

View File

@ -15,7 +15,6 @@
namespace DB
{
struct Settings;
/// Uses addOverflow method (if available) to avoid UB for sumWithOverflow()
///

View File

@ -6,9 +6,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
@ -22,8 +19,7 @@ bool allowType(const DataTypePtr& type) noexcept
return t.isInt() || t.isUInt() || t.isFloat() || t.isDecimal();
}
AggregateFunctionPtr
createAggregateFunctionSumCount(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionSumCount(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertNoParameters(name, parameters);
assertUnary(name, argument_types);

View File

@ -9,8 +9,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
@ -77,7 +75,7 @@ auto parseArguments(const std::string & name, const DataTypes & arguments)
// function template that allows to choose the aggregate function variant that
// accepts either normal arguments or tuple argument.
template<template <bool tuple_argument> typename MappedFunction>
AggregateFunctionPtr createAggregateFunctionMap(const std::string & name, const DataTypes & arguments, const Array & params, const Settings *)
AggregateFunctionPtr createAggregateFunctionMap(const std::string & name, const DataTypes & arguments, const Array & params)
{
auto [keys_type, values_types, tuple_argument] = parseArguments(name, arguments);

View File

@ -21,7 +21,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -23,7 +23,6 @@ extern "C"
namespace DB
{
struct Settings;
class ReadBuffer;
class WriteBuffer;

View File

@ -12,7 +12,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -59,7 +58,7 @@ static IAggregateFunction * createWithExtraTypes(const DataTypePtr & argument_ty
template <bool is_weighted>
AggregateFunctionPtr createAggregateFunctionTopK(const std::string & name, const DataTypes & argument_types, const Array & params, const Settings *)
AggregateFunctionPtr createAggregateFunctionTopK(const std::string & name, const DataTypes & argument_types, const Array & params)
{
if (!is_weighted)
{

View File

@ -17,7 +17,6 @@
namespace DB
{
struct Settings;
template <typename T>

View File

@ -14,7 +14,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -30,7 +29,7 @@ namespace
* It differs, for example, in that it uses a trivial hash function, since `uniq` of many arguments first hashes them out itself.
*/
template <typename Data, typename DataForVariadic>
AggregateFunctionPtr createAggregateFunctionUniq(const std::string & name, const DataTypes & argument_types, const Array & params, const Settings *)
AggregateFunctionPtr createAggregateFunctionUniq(const std::string & name, const DataTypes & argument_types, const Array & params)
{
assertNoParameters(name, params);
@ -74,7 +73,7 @@ AggregateFunctionPtr createAggregateFunctionUniq(const std::string & name, const
}
template <bool is_exact, template <typename> class Data, typename DataForVariadic>
AggregateFunctionPtr createAggregateFunctionUniq(const std::string & name, const DataTypes & argument_types, const Array & params, const Settings *)
AggregateFunctionPtr createAggregateFunctionUniq(const std::string & name, const DataTypes & argument_types, const Array & params)
{
assertNoParameters(name, params);

View File

@ -28,7 +28,6 @@
namespace DB
{
struct Settings;
/// uniq

View File

@ -13,8 +13,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
@ -135,16 +133,8 @@ namespace
void registerAggregateFunctionUniqCombined(AggregateFunctionFactory & factory)
{
using namespace std::placeholders;
factory.registerFunction("uniqCombined",
[](const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
{
return createAggregateFunctionUniqCombined(false, name, argument_types, parameters);
});
factory.registerFunction("uniqCombined64",
[](const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
{
return createAggregateFunctionUniqCombined(true, name, argument_types, parameters);
});
factory.registerFunction("uniqCombined", std::bind(createAggregateFunctionUniqCombined, false, _1, _2, _3)); // NOLINT
factory.registerFunction("uniqCombined64", std::bind(createAggregateFunctionUniqCombined, true, _1, _2, _3)); // NOLINT
}
}

View File

@ -21,7 +21,6 @@
namespace DB
{
struct Settings;
namespace detail
{
/** Hash function for uniqCombined/uniqCombined64 (based on Ret).

View File

@ -10,7 +10,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
@ -25,7 +24,7 @@ namespace
constexpr UInt8 uniq_upto_max_threshold = 100;
AggregateFunctionPtr createAggregateFunctionUniqUpTo(const std::string & name, const DataTypes & argument_types, const Array & params, const Settings *)
AggregateFunctionPtr createAggregateFunctionUniqUpTo(const std::string & name, const DataTypes & argument_types, const Array & params)
{
UInt8 threshold = 5; /// default value

View File

@ -25,7 +25,6 @@
namespace DB
{
struct Settings;
/** Counts the number of unique values up to no more than specified in the parameter.

View File

@ -14,7 +14,6 @@ namespace ErrorCodes
namespace DB
{
struct Settings;
namespace
{
@ -54,7 +53,7 @@ struct WelchTTestData : public TTestMoments<Float64>
}
};
AggregateFunctionPtr createAggregateFunctionWelchTTest(const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
AggregateFunctionPtr createAggregateFunctionWelchTTest(const std::string & name, const DataTypes & argument_types, const Array & parameters)
{
assertBinary(name, argument_types);
assertNoParameters(name, parameters);

View File

@ -1,8 +1,7 @@
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionWindowFunnel.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Helpers.h>
#include <Core/Settings.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
@ -11,29 +10,18 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
extern const int UNKNOWN_AGGREGATE_FUNCTION;
}
namespace
{
template <template <typename> class Data>
AggregateFunctionPtr
createAggregateFunctionWindowFunnel(const std::string & name, const DataTypes & arguments, const Array & params, const Settings * settings)
AggregateFunctionPtr createAggregateFunctionWindowFunnel(const std::string & name, const DataTypes & arguments, const Array & params)
{
if (settings == nullptr || !settings->allow_experimental_funnel_functions)
{
throw Exception(
"Aggregate function " + name + " is experimental. Set `allow_experimental_funnel_functions` setting to enable it",
ErrorCodes::UNKNOWN_AGGREGATE_FUNCTION);
}
if (params.empty())
throw Exception{"Aggregate function " + name + " requires at least one parameter: <window>, [option, [option, ...]]", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH};

View File

@ -13,7 +13,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

View File

@ -7,7 +7,6 @@
namespace DB
{
struct Settings;
namespace ErrorCodes
{

Some files were not shown because too many files have changed in this diff Show More