mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Saturation for DateTime
This commit is contained in:
parent
31d7f10a94
commit
3f67f4f47b
@ -164,6 +164,8 @@ void PostgreSQLBlockInputStream::insertValue(IColumn & column, std::string_view
|
|||||||
ReadBufferFromString in(value);
|
ReadBufferFromString in(value);
|
||||||
time_t time = 0;
|
time_t time = 0;
|
||||||
readDateTimeText(time, in);
|
readDateTimeText(time, in);
|
||||||
|
if (time < 0)
|
||||||
|
time = 0;
|
||||||
assert_cast<ColumnUInt32 &>(column).insertValue(time);
|
assert_cast<ColumnUInt32 &>(column).insertValue(time);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,8 @@ void DataTypeDateTime::deserializeTextEscaped(IColumn & column, ReadBuffer & ist
|
|||||||
{
|
{
|
||||||
time_t x;
|
time_t x;
|
||||||
readTextHelper(x, istr, settings, time_zone, utc_time_zone);
|
readTextHelper(x, istr, settings, time_zone, utc_time_zone);
|
||||||
|
if (x < 0)
|
||||||
|
x = 0;
|
||||||
assert_cast<ColumnType &>(column).getData().push_back(x);
|
assert_cast<ColumnType &>(column).getData().push_back(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +117,8 @@ void DataTypeDateTime::deserializeTextQuoted(IColumn & column, ReadBuffer & istr
|
|||||||
{
|
{
|
||||||
readIntText(x, istr);
|
readIntText(x, istr);
|
||||||
}
|
}
|
||||||
|
if (x < 0)
|
||||||
|
x = 0;
|
||||||
assert_cast<ColumnType &>(column).getData().push_back(x); /// It's important to do this at the end - for exception safety.
|
assert_cast<ColumnType &>(column).getData().push_back(x); /// It's important to do this at the end - for exception safety.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +141,10 @@ void DataTypeDateTime::deserializeTextJSON(IColumn & column, ReadBuffer & istr,
|
|||||||
{
|
{
|
||||||
readIntText(x, istr);
|
readIntText(x, istr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (x < 0)
|
||||||
|
x = 0;
|
||||||
|
|
||||||
assert_cast<ColumnType &>(column).getData().push_back(x);
|
assert_cast<ColumnType &>(column).getData().push_back(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,6 +172,9 @@ void DataTypeDateTime::deserializeTextCSV(IColumn & column, ReadBuffer & istr, c
|
|||||||
if (maybe_quote == '\'' || maybe_quote == '\"')
|
if (maybe_quote == '\'' || maybe_quote == '\"')
|
||||||
assertChar(maybe_quote, istr);
|
assertChar(maybe_quote, istr);
|
||||||
|
|
||||||
|
if (x < 0)
|
||||||
|
x = 0;
|
||||||
|
|
||||||
assert_cast<ColumnType &>(column).getData().push_back(x);
|
assert_cast<ColumnType &>(column).getData().push_back(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +103,8 @@ namespace DB
|
|||||||
ReadBufferFromString in(string_value);
|
ReadBufferFromString in(string_value);
|
||||||
time_t time = 0;
|
time_t time = 0;
|
||||||
readDateTimeText(time, in);
|
readDateTimeText(time, in);
|
||||||
|
if (time < 0)
|
||||||
|
time = 0;
|
||||||
assert_cast<ColumnUInt32 &>(column).insertValue(time);
|
assert_cast<ColumnUInt32 &>(column).insertValue(time);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,8 @@ namespace
|
|||||||
ReadBufferFromString in(value);
|
ReadBufferFromString in(value);
|
||||||
time_t time = 0;
|
time_t time = 0;
|
||||||
readDateTimeText(time, in);
|
readDateTimeText(time, in);
|
||||||
|
if (time < 0)
|
||||||
|
time = 0;
|
||||||
assert_cast<ColumnUInt32 &>(column).insertValue(time);
|
assert_cast<ColumnUInt32 &>(column).insertValue(time);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1486,6 +1486,8 @@ namespace
|
|||||||
ReadBufferFromString buf{str};
|
ReadBufferFromString buf{str};
|
||||||
time_t tm = 0;
|
time_t tm = 0;
|
||||||
readDateTimeText(tm, buf);
|
readDateTimeText(tm, buf);
|
||||||
|
if (tm < 0)
|
||||||
|
tm = 0;
|
||||||
return tm;
|
return tm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -769,9 +769,11 @@ inline void parseImpl<DataTypeDate>(DataTypeDate::FieldType & x, ReadBuffer & rb
|
|||||||
template <>
|
template <>
|
||||||
inline void parseImpl<DataTypeDateTime>(DataTypeDateTime::FieldType & x, ReadBuffer & rb, const DateLUTImpl * time_zone)
|
inline void parseImpl<DataTypeDateTime>(DataTypeDateTime::FieldType & x, ReadBuffer & rb, const DateLUTImpl * time_zone)
|
||||||
{
|
{
|
||||||
time_t tmp = 0;
|
time_t time = 0;
|
||||||
readDateTimeText(tmp, rb, *time_zone);
|
readDateTimeText(time, rb, *time_zone);
|
||||||
x = tmp;
|
if (time < 0)
|
||||||
|
time = 0;
|
||||||
|
x = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user