Skip to content

toStartOf... functions do not work with datetime64 extended range #25284

@Misaka10091

Description

@Misaka10091

How to reproduce

  • ClickHouse server: 21.4.7.3
  • Queries
    WITH toDateTime64('1940-01-01 01:00:00', 0) AS dt64
    SELECT dt64,toStartOfDay(dt64)
    
  • Results
    ┌────────────────dt64─┬──toStartOfDay(dt64)─┐
    │ 1940-01-01 01:00:00 │ 2076-02-06 06:28:16 │
    └─────────────────────┴─────────────────────┘
    

Expected behavior
return date 1940-01-01 00:00:00 instead of 2076-02-06 06:28:16

Additional context
most date functions return unexpected value
this seems to overflowed by date before 1970

Metadata

Metadata

Labels

comp-datetimeDate/DateTime/TimeZone datatypes and date-time semantics.unexpected behaviourResult is unexpected, but not entirely wrong at the same time.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions