ClickHouse/tests/queries/0_stateless/01942_dateTimeToSnowflake.sql

24 lines
872 B
MySQL
Raw Normal View History

2021-08-16 09:24:51 +00:00
-- Error cases
SELECT dateTimeToSnowflake(); -- {serverError 42}
SELECT dateTime64ToSnowflake(); -- {serverError 42}
SELECT dateTimeToSnowflake('abc'); -- {serverError 43}
SELECT dateTime64ToSnowflake('abc'); -- {serverError 43}
SELECT dateTimeToSnowflake('abc', 123); -- {serverError 42}
SELECT dateTime64ToSnowflake('abc', 123); -- {serverError 42}
SELECT 'const column';
2021-08-16 10:52:10 +00:00
WITH toDateTime('2021-08-15 18:57:56', 'Asia/Shanghai') AS dt
2021-08-16 09:24:51 +00:00
SELECT dt, dateTimeToSnowflake(dt);
2021-08-16 10:52:10 +00:00
WITH toDateTime64('2021-08-15 18:57:56.492', 3, 'Asia/Shanghai') AS dt64
2021-08-16 09:24:51 +00:00
SELECT dt64, dateTime64ToSnowflake(dt64);
SELECT 'non-const column';
2021-08-16 10:52:10 +00:00
WITH toDateTime('2021-08-15 18:57:56', 'Asia/Shanghai') AS x
2021-08-16 09:24:51 +00:00
SELECT materialize(x) as dt, dateTimeToSnowflake(dt);;
2021-08-16 10:52:10 +00:00
WITH toDateTime64('2021-08-15 18:57:56.492', 3, 'Asia/Shanghai') AS x
2021-08-16 09:24:51 +00:00
SELECT materialize(x) as dt64, dateTime64ToSnowflake(dt64);