mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
fix parseDateTimeBestEffortOrNull with empty string
This commit is contained in:
parent
19794bee07
commit
f428675b6e
@ -533,6 +533,10 @@ ReturnType parseDateTimeBestEffortImpl(
|
||||
}
|
||||
}
|
||||
|
||||
/// If neigher Date nor Time is parsed successfully, it should fail
|
||||
if (!year && !month && !day_of_month && !has_time)
|
||||
return on_error("Cannot read DateTime: neither Date nor Time was parsed successfully", ErrorCodes::CANNOT_PARSE_DATETIME);
|
||||
|
||||
if (!year)
|
||||
year = 2000;
|
||||
if (!month)
|
||||
|
@ -0,0 +1,8 @@
|
||||
2010-01-01 00:00:00
|
||||
2010-01-01 01:01:01
|
||||
2000-01-01 01:01:01
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
@ -0,0 +1,8 @@
|
||||
SELECT parseDateTimeBestEffortOrNull('2010-01-01');
|
||||
SELECT parseDateTimeBestEffortOrNull('2010-01-01 01:01:01');
|
||||
SELECT parseDateTimeBestEffortOrNull('01:01:01');
|
||||
SELECT parseDateTimeBestEffortOrNull('20100');
|
||||
SELECT parseDateTimeBestEffortOrNull('0100:0100:0000');
|
||||
SELECT parseDateTimeBestEffortOrNull('x');
|
||||
SELECT parseDateTimeBestEffortOrNull('');
|
||||
SELECT parseDateTimeBestEffortOrNull(' ');
|
Loading…
Reference in New Issue
Block a user