fix: doc and test

This commit is contained in:
jasine 2021-08-16 18:52:10 +08:00
parent c414a3aebf
commit 1f21131db6
2 changed files with 14 additions and 12 deletions

View File

@ -1436,16 +1436,17 @@ dateTimeToSnowflake(value)
Query:
``` sql
SELECT dateTimeToSnowflake(CAST('2021-08-15 18:57:56', 'DateTime'));
WITH toDateTime('2021-08-15 18:57:56', 'Asia/Shanghai') AS dt
SELECT dateTimeToSnowflake(dt);
```
Result:
``` text
┌─dateTimeToSnowflake(CAST('2021-08-15 18:57:56', 'DateTime'))─┐
┌─dateTimeToSnowflake(dt)─┐
│ 1426860702823350272 │
└──────────────────────────────────────────────────────────────
└─────────────────────────┘
```
@ -1473,13 +1474,14 @@ dateTime64ToSnowflake(value)
Query:
``` sql
SELECT dateTime64ToSnowflake(CAST('2021-08-15 18:57:56.073', 'DateTime64'));
WITH toDateTime64('2021-08-15 18:57:56.492', 3, 'Asia/Shanghai') AS dt64
SELECT dateTime64ToSnowflake(dt64);
```
Result:
``` text
┌─dateTime64ToSnowflake(CAST('2021-08-15 18:57:56.073', 'DateTime64'))─┐
1426860703129534464
└──────────────────────────────────────────────────────────────────────
┌─dateTime64ToSnowflake(dt64)─┐
1426860704886947840
└─────────────────────────────┘
```

View File

@ -9,15 +9,15 @@ SELECT dateTimeToSnowflake('abc', 123); -- {serverError 42}
SELECT dateTime64ToSnowflake('abc', 123); -- {serverError 42}
SELECT 'const column';
WITH toDateTime('2021-08-15 18:57:56') AS dt
WITH toDateTime('2021-08-15 18:57:56', 'Asia/Shanghai') AS dt
SELECT dt, dateTimeToSnowflake(dt);
WITH toDateTime64('2021-08-15 18:57:56.492', 3) AS dt64
WITH toDateTime64('2021-08-15 18:57:56.492', 3, 'Asia/Shanghai') AS dt64
SELECT dt64, dateTime64ToSnowflake(dt64);
SELECT 'non-const column';
WITH toDateTime('2021-08-15 18:57:56') AS x
WITH toDateTime('2021-08-15 18:57:56', 'Asia/Shanghai') AS x
SELECT materialize(x) as dt, dateTimeToSnowflake(dt);;
WITH toDateTime64('2021-08-15 18:57:56.492', 3) AS x
WITH toDateTime64('2021-08-15 18:57:56.492', 3, 'Asia/Shanghai') AS x
SELECT materialize(x) as dt64, dateTime64ToSnowflake(dt64);