Files
greptimedb/tests/cases/standalone/common/select/dummy.result
Zou Wei 7727508485 feat: impl interval type (#1952)
* feat: impl interval type in common time

* feat: impl datatype, vectors, value for interval

    pick 0c1d9f297 feat: impl interval type in common time
    pick d528c647f feat: impl datatype, vectors, value for interval
    pick 1e12dd5c7 comments update
    pick 74103e36c add license header

* comments update

* add license header

* cargo clippy

* refactor interval type

* add unit test and case to dummy.sql

* cargo clippy

* chore: add doc comments

* chore: cargo fmt

* feat: add formats, refactor comparison

* add docs comments

* Apply suggestions from code review

Co-authored-by: Yingwen <realevenyag@gmail.com>

* chore: cr comment

---------

Co-authored-by: Yingwen <realevenyag@gmail.com>
2023-07-31 03:54:39 +00:00

130 lines
3.8 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(2);
+-----------------------+
| to_unixtime(Int64(2)) |
+-----------------------+
| 2 |
+-----------------------+
create table test_unixtime(a int, b timestamp time index);
Affected Rows: 0
DESC TABLE test_unixtime;
+-------+----------------------+------+---------+---------------+
| Field | Type | Null | Default | Semantic Type |
+-------+----------------------+------+---------+---------------+
| a | Int32 | YES | | FIELD |
| b | TimestampMillisecond | NO | | TIME INDEX |
+-------+----------------------+------+---------+---------------+
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 |
+------------------------------------------------------------------------------------------------------------------+