mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fixed fuzz test in UBSan
This commit is contained in:
parent
c832124e6b
commit
f02a834615
@ -33,6 +33,8 @@ namespace ErrorCodes
|
||||
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
||||
}
|
||||
|
||||
template <typename> class QuantileTiming;
|
||||
|
||||
|
||||
/** Generic aggregate function for calculation of quantiles.
|
||||
* It depends on quantile calculation data structure. Look at Quantile*.h for various implementations.
|
||||
@ -82,6 +84,14 @@ 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 unsigned integers.
|
||||
if (!isUnsignedInteger(argument_type))
|
||||
throw Exception("Argument for function " + std::string(Name::name) + " must be unsigned integer, but it has type "
|
||||
+ argument_type->getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
}
|
||||
|
||||
String getName() const override { return Name::name; }
|
||||
|
@ -0,0 +1 @@
|
||||
5
|
@ -0,0 +1,2 @@
|
||||
SELECT quantileTiming(0.5)(number) FROM numbers(10);
|
||||
SELECT quantileTiming(0.5)(number / 2) FROM numbers(10); -- { serverError 43 }
|
Loading…
Reference in New Issue
Block a user