mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Returned back support for floating point argument in function quantileTiming
This commit is contained in:
parent
a1cfdf2a60
commit
e8b6ac3fad
@ -82,14 +82,6 @@ public:
|
||||
{
|
||||
if (!returns_many && levels.size() > 1)
|
||||
throw Exception("Aggregate function " + getName() + " require one parameter or less", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
|
||||
if constexpr (std::is_same_v<Data, QuantileTiming<Value>>)
|
||||
{
|
||||
/// QuantileTiming only supports integers (it works only for unsigned integers but signed are also accepted for convenience).
|
||||
if (!isInteger(argument_type))
|
||||
throw Exception("Argument for function " + std::string(Name::name) + " must be integer, but it has type "
|
||||
+ argument_type->getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
}
|
||||
|
||||
String getName() const override { return Name::name; }
|
||||
@ -111,16 +103,21 @@ public:
|
||||
|
||||
void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena *) const override
|
||||
{
|
||||
/// Out of range conversion may occur. This is Ok.
|
||||
auto value = static_cast<const ColVecType &>(*columns[0]).getData()[row_num];
|
||||
|
||||
const auto & column = static_cast<const ColVecType &>(*columns[0]);
|
||||
if constexpr (std::is_same_v<Data, QuantileTiming<Value>>)
|
||||
{
|
||||
/// QuantileTiming only supports integers.
|
||||
if (isNaN(value) || value > std::numeric_limits<Value>::max() || value < std::numeric_limits<Value>::min())
|
||||
return;
|
||||
}
|
||||
|
||||
if constexpr (has_second_arg)
|
||||
this->data(place).add(
|
||||
column.getData()[row_num],
|
||||
value,
|
||||
columns[1]->getUInt(row_num));
|
||||
else
|
||||
this->data(place).add(column.getData()[row_num]);
|
||||
this->data(place).add(value);
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr place, ConstAggregateDataPtr rhs, Arena *) const override
|
||||
|
@ -6,6 +6,10 @@
|
||||
['2016-06-15 23:00:00']
|
||||
2016-06-15 23:00:00
|
||||
['2016-06-15 23:00:00']
|
||||
30000
|
||||
[30000]
|
||||
30000
|
||||
[30000]
|
||||
2016-06-15 23:01:04
|
||||
['2016-06-15 23:01:04']
|
||||
2016-06-15 23:01:04
|
||||
|
@ -15,11 +15,11 @@ SELECT quantilesExact(0.2)(d) FROM datetime;
|
||||
SELECT quantileExactWeighted(0.2)(d, 1) FROM datetime;
|
||||
SELECT quantilesExactWeighted(0.2)(d, 1) FROM datetime;
|
||||
|
||||
SELECT quantileTiming(0.2)(d) FROM datetime; -- { serverError 43 }
|
||||
SELECT quantilesTiming(0.2)(d) FROM datetime; -- { serverError 43 }
|
||||
SELECT quantileTiming(0.2)(d) FROM datetime;
|
||||
SELECT quantilesTiming(0.2)(d) FROM datetime;
|
||||
|
||||
SELECT quantileTimingWeighted(0.2)(d, 1) FROM datetime; -- { serverError 43 }
|
||||
SELECT quantilesTimingWeighted(0.2)(d, 1) FROM datetime; -- { serverError 43 }
|
||||
SELECT quantileTimingWeighted(0.2)(d, 1) FROM datetime;
|
||||
SELECT quantilesTimingWeighted(0.2)(d, 1) FROM datetime;
|
||||
|
||||
SELECT quantileTDigest(0.2)(d) FROM datetime;
|
||||
SELECT quantilesTDigest(0.2)(d) FROM datetime;
|
||||
|
@ -1 +1,2 @@
|
||||
5
|
||||
2
|
||||
|
@ -1,2 +1,2 @@
|
||||
SELECT quantileTiming(0.5)(number) FROM numbers(10);
|
||||
SELECT quantileTiming(0.5)(number / 2) FROM numbers(10); -- { serverError 43 }
|
||||
SELECT quantileTiming(0.5)(number / 2) FROM numbers(10);
|
||||
|
Loading…
Reference in New Issue
Block a user