Files
greptimedb/tests/cases/standalone/common/select/dummy.result
JeremyHi c02ac36ce8 feat: avoid confusion in desc table (#2272)
feat: Field to Column to aviod confusion in DESC TABLE
2023-08-28 11:50:33 +00:00

138 lines
4.2 KiB
Plaintext

select 1;
+----------+
| Int64(1) |
+----------+
| 1 |
+----------+
select 2 + 3;
+---------------------+
| Int64(2) + Int64(3) |
+---------------------+
| 5 |
+---------------------+
select 4 + 0.5;
+-------------------------+
| Int64(4) + Float64(0.5) |
+-------------------------+
| 4.5 |
+-------------------------+
select "a";
Error: 3000(PlanQuery), No field named a.
select "A";
Error: 3000(PlanQuery), No field named "A".
select * where "a" = "A";
Error: 3000(PlanQuery), No field named a.
select TO_UNIXTIME('2023-03-01T06:35:02Z');
+-------------------------------------------+
| to_unixtime(Utf8("2023-03-01T06:35:02Z")) |
+-------------------------------------------+
| 1677652502 |
+-------------------------------------------+
select TO_UNIXTIME(' 2023-03-01T06:35:02Z ');
+---------------------------------------------------+
| to_unixtime(Utf8(" 2023-03-01T06:35:02Z ")) |
+---------------------------------------------------+
| 1677652502 |
+---------------------------------------------------+
select TO_UNIXTIME(2);
+-----------------------+
| to_unixtime(Int64(2)) |
+-----------------------+
| 2 |
+-----------------------+
create table test_unixtime(a int, b timestamp time index);
Affected Rows: 0
DESC TABLE test_unixtime;
+--------+----------------------+-----+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------+----------------------+-----+------+---------+---------------+
| a | Int32 | | YES | | FIELD |
| b | TimestampMillisecond | PRI | NO | | TIMESTAMP |
+--------+----------------------+-----+------+---------+---------------+
insert into test_unixtime values(27, 27);
Affected Rows: 1
select * from test_unixtime;
+----+-------------------------+
| a | b |
+----+-------------------------+
| 27 | 1970-01-01T00:00:00.027 |
+----+-------------------------+
select a from test_unixtime;
+----+
| a |
+----+
| 27 |
+----+
select b from test_unixtime;
+-------------------------+
| b |
+-------------------------+
| 1970-01-01T00:00:00.027 |
+-------------------------+
select TO_UNIXTIME(b) from test_unixtime;
+------------------------------+
| to_unixtime(test_unixtime.b) |
+------------------------------+
| 27 |
+------------------------------+
DROP TABLE test_unixtime;
Affected Rows: 1
select INTERVAL '1 year 2 months 3 days 4 hours 5 minutes 6 seconds 100 microseconds';
+---------------------------------------------------------+
| IntervalMonthDayNano("1109194275255040973236744059552") |
+---------------------------------------------------------+
| 0 years 14 mons 3 days 4 hours 5 mins 6.000100000 secs |
+---------------------------------------------------------+
select INTERVAL '1 year 2 months 3 days 4 hours' + INTERVAL '1 year';
+------------------------------------------------------------------------------------------------------------------+
| IntervalMonthDayNano("1109194275255040972930743959552") + IntervalMonthDayNano("950737950171172051122527404032") |
+------------------------------------------------------------------------------------------------------------------+
| 0 years 26 mons 3 days 4 hours 0 mins 0.000000000 secs |
+------------------------------------------------------------------------------------------------------------------+
select INTERVAL '1 year 2 months 3 days 4 hours' - INTERVAL '1 year';
+------------------------------------------------------------------------------------------------------------------+
| IntervalMonthDayNano("1109194275255040972930743959552") - IntervalMonthDayNano("950737950171172051122527404032") |
+------------------------------------------------------------------------------------------------------------------+
| 0 years 2 mons 3 days 4 hours 0 mins 0.000000000 secs |
+------------------------------------------------------------------------------------------------------------------+