mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-05 05:52:05 +00:00
Apply suggestions from code review
Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>
This commit is contained in:
parent
fb758e48b0
commit
1deaaf5466
@ -50,7 +50,7 @@ void SerializationDateTime64::deserializeText(IColumn & column, ReadBuffer & ist
|
||||
bool SerializationDateTime64::tryDeserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings &, bool whole) const
|
||||
{
|
||||
DateTime64 result = 0;
|
||||
if (tryReadDateTime64Text(result, scale, istr, time_zone) || (whole && istr.eof()))
|
||||
if (!tryReadDateTime64Text(result, scale, istr, time_zone) || (whole && !istr.eof()))
|
||||
return false;
|
||||
|
||||
assert_cast<ColumnType &>(column).getData().push_back(result);
|
||||
@ -151,7 +151,7 @@ bool SerializationDateTime64::tryDeserializeTextQuoted(IColumn & column, ReadBuf
|
||||
DateTime64 x = 0;
|
||||
if (checkChar('\'', istr)) /// Cases: '2017-08-31 18:36:48' or '1504193808'
|
||||
{
|
||||
if (tryReadText(x, scale, istr, settings, time_zone, utc_time_zone) || !checkChar('\'', istr))
|
||||
if (!tryReadText(x, scale, istr, settings, time_zone, utc_time_zone) || !checkChar('\'', istr))
|
||||
return false;
|
||||
}
|
||||
else /// Just 1504193808 or 01504193808
|
||||
@ -265,7 +265,7 @@ bool SerializationDateTime64::tryDeserializeTextCSV(IColumn & column, ReadBuffer
|
||||
{
|
||||
if (settings.csv.delimiter != ',' || settings.date_time_input_format == FormatSettings::DateTimeInputFormat::Basic)
|
||||
{
|
||||
if (tryReadText(x, scale, istr, settings, time_zone, utc_time_zone))
|
||||
if (!tryReadText(x, scale, istr, settings, time_zone, utc_time_zone))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
@ -60,10 +60,7 @@ public:
|
||||
|
||||
bool tryReadValue(ReadBuffer & istr, FieldType & x) const
|
||||
{
|
||||
if (!tryReadText(x, istr) || !ref_enum_values.hasValue(x))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return tryReadText(x, istr) && ref_enum_values.hasValue(x);
|
||||
}
|
||||
|
||||
std::optional<EnumValues<Type>> own_enum_values;
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <DataTypes/Serializations/SerializationNamed.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
@ -212,10 +212,7 @@ ReturnType SerializationTuple::deserializeTextImpl(IColumn & column, ReadBuffer
|
||||
return ReturnType(true);
|
||||
};
|
||||
|
||||
if constexpr (throw_exception)
|
||||
addElementSafe<ReturnType>(elems.size(), column, impl);
|
||||
else
|
||||
return addElementSafe<ReturnType>(elems.size(), column, impl);
|
||||
return addElementSafe<ReturnType>(elems.size(), column, impl);
|
||||
}
|
||||
|
||||
void SerializationTuple::deserializeText(DB::IColumn & column, DB::ReadBuffer & istr, const DB::FormatSettings & settings, bool whole) const
|
||||
@ -457,10 +454,7 @@ ReturnType SerializationTuple::deserializeTextJSONImpl(IColumn & column, ReadBuf
|
||||
return ReturnType(true);
|
||||
};
|
||||
|
||||
if constexpr (throw_exception)
|
||||
addElementSafe<ReturnType>(elems.size(), column, impl);
|
||||
else
|
||||
return addElementSafe<ReturnType>(elems.size(), column, impl);
|
||||
return addElementSafe<ReturnType>(elems.size(), column, impl);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -502,10 +496,7 @@ ReturnType SerializationTuple::deserializeTextJSONImpl(IColumn & column, ReadBuf
|
||||
return ReturnType(true);
|
||||
};
|
||||
|
||||
if constexpr (throw_exception)
|
||||
addElementSafe<ReturnType>(elems.size(), column, impl);
|
||||
else
|
||||
return addElementSafe<ReturnType>(elems.size(), column, impl);
|
||||
return addElementSafe<ReturnType>(elems.size(), column, impl);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user