Throw exception for invalid inputs

This commit is contained in:
Robert Schulze 2024-05-17 10:18:52 +00:00
parent 6a14502cbe
commit 20a0e7338e
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A

View File

@ -20,6 +20,7 @@ namespace ErrorCodes
{
extern const int CANNOT_RESTORE_FROM_FIELD_DUMP;
extern const int DECIMAL_OVERFLOW;
extern const int INCORRECT_DATA;
}
template <is_decimal T>
@ -28,7 +29,7 @@ T DecimalField<T>::getScaleMultiplier() const
return DecimalUtils::scaleMultiplier<T>(scale);
}
inline Field getBinaryValue(UInt8 type, ReadBuffer & buf)
Field getBinaryValue(UInt8 type, ReadBuffer & buf)
{
switch (static_cast<Field::Types::Which>(type))
{
@ -146,7 +147,7 @@ inline Field getBinaryValue(UInt8 type, ReadBuffer & buf)
case Field::Types::CustomType:
return Field();
}
UNREACHABLE();
throw Exception(ErrorCodes::INCORRECT_DATA, "Unknown field type {}", std::to_string(type));
}
void readBinary(Array & x, ReadBuffer & buf)
@ -575,7 +576,7 @@ template bool decimalLessOrEqual<Decimal256>(Decimal256 x, Decimal256 y, UInt32
template bool decimalLessOrEqual<DateTime64>(DateTime64 x, DateTime64 y, UInt32 x_scale, UInt32 y_scale);
inline void writeText(const Null & x, WriteBuffer & buf)
void writeText(const Null & x, WriteBuffer & buf)
{
if (x.isNegativeInfinity())
writeText("-Inf", buf);