Skip to content

Commit

Permalink
Throw exception for invalid inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
rschu1ze committed May 17, 2024
1 parent 6a14502 commit 20a0e73
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Core/Field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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))
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 20a0e73

Please sign in to comment.