Skip to content

Different behavior of cast('0' as DateTime64(3)) and cast('0' as Nullable(DateTime64(3)))  #56285

@taiyang-li

Description

@taiyang-li

Describe what's wrong
Difference behavior of cast('0' as DateTime64(3)) and cast('0' as Nullable(DateTime64(3))). I believe it is a bug introduced in pr: #55146

ClickHouse Version: head

 :)  select cast('0', 'Nullable(DateTime64(3))'); 

SELECT CAST('0', 'Nullable(DateTime64(3))')

Query id: 89e0ddbc-dc6d-497e-88d3-912d2596e640

┌─CAST('0', 'Nullable(DateTime64(3))')─┐
│              1970-01-01 08:00:00.000 │
└──────────────────────────────────────┘

1 row in set. Elapsed: 0.049 sec. 


 :)  select cast('0', 'DateTime64(3)');

SELECT CAST('0', 'DateTime64(3)')

Query id: e505d9c8-6a81-43fb-87ce-f2b6f644a9cb


Elapsed: 0.101 sec. 

Received exception from server (version 23.10.1):
Code: 41. DB::Exception: Received from localhost:9001. DB::ParsingException. DB::ParsingException: Cannot parse DateTime: While processing CAST('0', 'DateTime64(3)'). (CANNOT_PARSE_DATETIME)

See https://fiddle.clickhouse.com/b16f32d2-d6da-4886-bb52-f4709476e0b9

Metadata

Metadata

Assignees

No one assigned

    Labels

    potential bugTo be reviewed by developers and confirmed/rejected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions