Files
Zou Wei b8c50d00aa feat: sqlness test for interval type (#2265)
* feat: add integration-test for interval type.

* chore: add two cases.

* chore: cr

* chore: Field to Column
2023-09-04 14:30:48 +08:00

114 lines
2.5 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