mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 21:32:58 +00:00
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>
This commit is contained in:
@@ -103,3 +103,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 |
|
||||
+------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
@@ -29,3 +29,9 @@ select b from test_unixtime;
|
||||
select TO_UNIXTIME(b) from test_unixtime;
|
||||
|
||||
DROP TABLE test_unixtime;
|
||||
|
||||
select INTERVAL '1 year 2 months 3 days 4 hours 5 minutes 6 seconds 100 microseconds';
|
||||
|
||||
select INTERVAL '1 year 2 months 3 days 4 hours' + INTERVAL '1 year';
|
||||
|
||||
select INTERVAL '1 year 2 months 3 days 4 hours' - INTERVAL '1 year';
|
||||
|
||||
Reference in New Issue
Block a user