added test

This commit is contained in:
zvonand 2022-06-03 01:30:17 +03:00
parent 8e28ba2583
commit a2b768ec10
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,4 @@
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1

View File

@ -0,0 +1,39 @@
-- Before UNIX epoch
WITH
toDateTime64('1959-09-16 19:20:12.999999998', 9, 'UTC') AS dt1,
toDateTime64('1959-09-16 19:20:12.999999999', 9, 'UTC') AS dt2
SELECT
dt1 < dt2,
(dt1 + INTERVAL 1 NANOSECOND) = dt2,
(dt1 + INTERVAL 2 NANOSECOND) > dt2,
(dt1 + INTERVAL 3 NANOSECOND) > dt2;
-- At UNIX epoch border
WITH
toDateTime64('1969-12-31 23:59:59.999999998', 9, 'UTC') AS dt1,
toDateTime64('1969-12-31 23:59:59.999999999', 9, 'UTC') AS dt2
SELECT
dt1 < dt2,
(dt1 + INTERVAL 1 NANOSECOND) = dt2,
(dt1 + INTERVAL 2 NANOSECOND) > dt2,
(dt1 + INTERVAL 3 NANOSECOND) > dt2;
-- After UNIX epoch
WITH
toDateTime64('2001-12-31 23:59:59.999999998', 9, 'UTC') AS dt1,
toDateTime64('2001-12-31 23:59:59.999999999', 9, 'UTC') AS dt2
SELECT
dt1 < dt2,
(dt1 + INTERVAL 1 NANOSECOND) = dt2,
(dt1 + INTERVAL 2 NANOSECOND) > dt2,
(dt1 + INTERVAL 3 NANOSECOND) > dt2;
-- At upper DT64 bound (DT64 precision is lower here by design)
WITH
toDateTime64('2282-12-31 23:59:59.999998', 6, 'UTC') AS dt1,
toDateTime64('2282-12-31 23:59:59.999999', 6, 'UTC') AS dt2
SELECT
dt1 < dt2,
(dt1 + INTERVAL 1 MICROSECOND) = dt2,
(dt1 + INTERVAL 2 MICROSECOND) > dt2,
(dt1 + INTERVAL 3 MICROSECOND) > dt2;