-
Notifications
You must be signed in to change notification settings - Fork 8.3k
toStartOf...() incorrect result when out of normal range #22928
Copy link
Copy link
Closed
Labels
comp-datetimeDate/DateTime/TimeZone datatypes and date-time semantics.Date/DateTime/TimeZone datatypes and date-time semantics.unfinished code
Description
All toStartOf...() functions except toStartOfSecond() returns wrong result when out of normal range:
SELECT toStartOfDay(toDateTime64('1969-12-31 12:12:12', 0, 'UTC'))
┌─toStartOfDay(toDateTime64('1969-12-31 12:12:12', 0, 'UTC'))─┐
│ 2106-02-06 06:28:16 │
└─────────────────────────────────────────────────────────────┘
SELECT toStartOfISOYear(toDateTime64('1969-12-31 12:12:12', 0, 'UTC'))
┌─toStartOfISOYear(toDateTime64('1969-12-31 12:12:12', 0, 'UTC'))─┐
│ 2149-06-04 │
└─────────────────────────────────────────────────────────────────┘
A slightly different type of error is given by toStartOfSecond():
SELECT toStartOfSecond(toDateTime64('1928-12-31 12:12:12.123', 3, 'UTC'))
┌─toStartOfSecond(toDateTime64('1928-12-31 12:12:12.123', 3, 'UTC'))─┐
│ 1928-12-31 12:12:11.000 │
└────────────────────────────────────────────────────────────────────┘
ClickHouse version 21.5.1.6463
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
comp-datetimeDate/DateTime/TimeZone datatypes and date-time semantics.Date/DateTime/TimeZone datatypes and date-time semantics.unfinished code