Skip to content

Commit 68e2f88

Browse files
Merge pull request #11337 from ClickHouse/fix-quantile-arguments
Fix quantile arguments
2 parents 7c83679 + 86d072a commit 68e2f88

4 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/AggregateFunctions/AggregateFunctionQuantile.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,17 @@ AggregateFunctionPtr createAggregateFunctionQuantile(const std::string & name, c
7070
WhichDataType which(argument_type);
7171

7272
#define DISPATCH(TYPE) \
73-
if (which.idx == TypeIndex::TYPE) return std::make_shared<Function<TYPE, true>>(argument_type, params);
73+
if (which.idx == TypeIndex::TYPE) return std::make_shared<Function<TYPE, true>>(argument_types, params);
7474
FOR_NUMERIC_TYPES(DISPATCH)
7575
#undef DISPATCH
76-
if (which.idx == TypeIndex::Date) return std::make_shared<Function<DataTypeDate::FieldType, false>>(argument_type, params);
77-
if (which.idx == TypeIndex::DateTime) return std::make_shared<Function<DataTypeDateTime::FieldType, false>>(argument_type, params);
76+
if (which.idx == TypeIndex::Date) return std::make_shared<Function<DataTypeDate::FieldType, false>>(argument_types, params);
77+
if (which.idx == TypeIndex::DateTime) return std::make_shared<Function<DataTypeDateTime::FieldType, false>>(argument_types, params);
7878

7979
if constexpr (supportDecimal<Function>())
8080
{
81-
if (which.idx == TypeIndex::Decimal32) return std::make_shared<Function<Decimal32, false>>(argument_type, params);
82-
if (which.idx == TypeIndex::Decimal64) return std::make_shared<Function<Decimal64, false>>(argument_type, params);
83-
if (which.idx == TypeIndex::Decimal128) return std::make_shared<Function<Decimal128, false>>(argument_type, params);
81+
if (which.idx == TypeIndex::Decimal32) return std::make_shared<Function<Decimal32, false>>(argument_types, params);
82+
if (which.idx == TypeIndex::Decimal64) return std::make_shared<Function<Decimal64, false>>(argument_types, params);
83+
if (which.idx == TypeIndex::Decimal128) return std::make_shared<Function<Decimal128, false>>(argument_types, params);
8484
}
8585

8686
throw Exception("Illegal type " + argument_type->getName() + " of argument for aggregate function " + name,

src/AggregateFunctions/AggregateFunctionQuantile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class AggregateFunctionQuantile final : public IAggregateFunctionDataHelper<Data
7878
DataTypePtr & argument_type;
7979

8080
public:
81-
AggregateFunctionQuantile(const DataTypePtr & argument_type_, const Array & params)
82-
: IAggregateFunctionDataHelper<Data, AggregateFunctionQuantile<Value, Data, Name, has_second_arg, FloatReturnType, returns_many>>({argument_type_}, params)
81+
AggregateFunctionQuantile(const DataTypes & argument_types_, const Array & params)
82+
: IAggregateFunctionDataHelper<Data, AggregateFunctionQuantile<Value, Data, Name, has_second_arg, FloatReturnType, returns_many>>(argument_types_, params)
8383
, levels(params, returns_many), level(levels.levels[0]), argument_type(this->argument_types[0])
8484
{
8585
if (!returns_many && levels.size() > 1)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[7]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
select quantilesExactWeightedArray(0.5)(range(10), range(10))

0 commit comments

Comments
 (0)