-
Notifications
You must be signed in to change notification settings - Fork 8.3k
DateTime64 inconsistent parsing from String #51753
Copy link
Copy link
Closed
Labels
potential bugTo be reviewed by developers and confirmed/rejected.To be reviewed by developers and confirmed/rejected.
Description
DateTime64 parsing goes wrong for string representing a number smaller than 10000:
select toDateTime64('9999', 3) -- returns 1970-01-01 00:00:00.000, but CANNOT_PARSE_DATETIME expected
select toDateTime64('10000', 3) -- returns 1970-01-01 02:46:40.000 (expected)
However, DateTime doesn't have this:
select toDateTime('9999'); -- { serverError CANNOT_PARSE_DATETIME } (expected)
select toDateTime('10000') -- returns 1970-01-01 02:46:40 (expected)
See fiddle.
Does it reproduce on recent release?
Yes, on 23.6.1
Also happens on older versions, e.g. 22.6.7
Expected behavior
DateTime64 shall not silently produce wrong result. It shall throw exception like DateTime does.
Related to these two comments.
Parts:
- fix parsing of decimal string numbers with short whole part (e.g.
'123.12') -- definitely no ambiguity here - allow negative numbers in short strings for DT64 -- also no ambiguity
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
potential bugTo be reviewed by developers and confirmed/rejected.To be reviewed by developers and confirmed/rejected.