ClickHouse/tests/queries/0_stateless/01440_to_date_monotonicity.sql

19 lines
947 B
MySQL
Raw Normal View History

2020-08-07 17:38:42 +00:00
DROP TABLE IF EXISTS tdm;
2020-08-09 02:53:58 +00:00
DROP TABLE IF EXISTS tdm2;
2020-11-24 09:48:39 +00:00
CREATE TABLE tdm (x DateTime('Europe/Moscow')) ENGINE = MergeTree ORDER BY x SETTINGS write_final_mark = 0;
2020-08-07 17:38:42 +00:00
INSERT INTO tdm VALUES (now());
2021-07-26 03:27:39 +00:00
SELECT count(x) FROM tdm WHERE toDate(x) < toDate(now(), 'Europe/Moscow') SETTINGS max_rows_to_read = 1;
2020-08-07 17:38:42 +00:00
2021-07-24 22:58:31 +00:00
SELECT toDate(-1), toDate(10000000000000, 'Europe/Moscow'), toDate(100), toDate(65536, 'UTC'), toDate(65535, 'Europe/Moscow');
2020-11-24 09:48:39 +00:00
SELECT toDateTime(-1, 'Europe/Moscow'), toDateTime(10000000000000, 'Europe/Moscow'), toDateTime(1000, 'Europe/Moscow');
2020-08-07 17:38:42 +00:00
2020-08-09 02:53:58 +00:00
CREATE TABLE tdm2 (timestamp UInt32) ENGINE = MergeTree ORDER BY timestamp SETTINGS index_granularity = 1;
2021-07-27 03:55:59 +00:00
INSERT INTO tdm2 VALUES (toUnixTimestamp('2000-01-01 13:12:12')), (toUnixTimestamp('2000-01-01 14:12:12')), (toUnixTimestamp('2000-01-01 15:12:12'));
2020-08-09 02:53:58 +00:00
SET max_rows_to_read = 1;
2021-07-27 03:55:59 +00:00
SELECT toDateTime(timestamp) FROM tdm2 WHERE toHour(toDateTime(timestamp)) = 13;
2020-08-09 02:53:58 +00:00
2020-08-07 17:38:42 +00:00
DROP TABLE tdm;
2020-08-09 02:53:58 +00:00
DROP TABLE tdm2;