mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
Return NULL or zero when value is not parsed completely in parseDateTimeBestEffortOr* functions
This commit is contained in:
parent
f53da4d36b
commit
fae12d5e42
@ -722,10 +722,10 @@ struct ConvertThroughParsing
|
||||
parsed = ToDataType::tryReadText(vec_to[i], read_buffer, ToDataType::maxPrecision(), vec_to.getScale());
|
||||
else
|
||||
parsed = tryParseImpl<ToDataType>(vec_to[i], read_buffer, local_time_zone);
|
||||
|
||||
parsed = parsed && isAllRead(read_buffer);
|
||||
}
|
||||
|
||||
parsed = parsed && isAllRead(read_buffer);
|
||||
|
||||
if (!parsed)
|
||||
vec_to[i] = 0;
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
\N
|
||||
0000-00-00 00:00:00
|
||||
\N
|
||||
0000-00-00 00:00:00.000
|
||||
\N
|
||||
0000-00-00 00:00:00
|
@ -0,0 +1,12 @@
|
||||
SELECT parseDateTimeBestEffort('<Empty>'); -- { serverError 6 }
|
||||
SELECT parseDateTimeBestEffortOrNull('<Empty>');
|
||||
SELECT parseDateTimeBestEffortOrZero('<Empty>');
|
||||
|
||||
SELECT parseDateTime64BestEffort('<Empty>'); -- { serverError 6 }
|
||||
SELECT parseDateTime64BestEffortOrNull('<Empty>');
|
||||
SELECT parseDateTime64BestEffortOrZero('<Empty>');
|
||||
|
||||
SET date_time_input_format = 'best_effort';
|
||||
SELECT toDateTime('<Empty>'); -- { serverError 41 }
|
||||
SELECT toDateTimeOrNull('<Empty>');
|
||||
SELECT toDateTimeOrZero('<Empty>');
|
Loading…
Reference in New Issue
Block a user