mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 13:22:57 +00:00
* define structs and methods Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * feat: re-implement interval types in time crate * feat: use new * feat: interval value * feat: query crate interval * feat: pg and mysql interval * chore: remove unused imports * chore: remove commented codes * feat: make flow compile but may not work * feat: flow datetime * test: fix some tests * test: fix some flow tests(WIP) * chore: some fix test&docs * fix: change interval order * chore: remove unused codes * chore: fix cilppy * chore: now signature change * chore: remove todo * feat: update error message --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: discord9 <discord9@163.com>
40 lines
1.7 KiB
Plaintext
40 lines
1.7 KiB
Plaintext
CREATE TABLE host (
|
|
ts timestamp(3) time index,
|
|
host STRING PRIMARY KEY,
|
|
val BIGINT,
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
INSERT INTO TABLE host VALUES
|
|
("1970-01-01T01:00:00+00:00", 'host1', 0),
|
|
("1970-01-01T02:00:00+00:00", 'host1', 1),
|
|
("1971-01-02T03:00:00+00:00", 'host1', 2),
|
|
("1971-01-02T04:00:00+00:00", 'host1', 3),
|
|
("1970-01-01T01:00:00+00:00", 'host2', 4),
|
|
("1970-01-01T02:00:00+00:00", 'host2', 5),
|
|
("1971-01-02T03:00:00+00:00", 'host2', 6),
|
|
("1971-01-02T04:00:00+00:00", 'host2', 7);
|
|
|
|
Affected Rows: 8
|
|
|
|
SELECT ts, host, min(val) RANGE (INTERVAL '1 year') FROM host ALIGN (INTERVAL '1 year') ORDER BY host, ts;
|
|
|
|
Error: 3000(PlanQuery), DataFusion error: Error during planning: Year or month interval is not allowed in range query: IntervalMonthDayNano("950737950171172051122527404032")
|
|
|
|
SELECT ts, host, min(val) RANGE (INTERVAL '1' day) FROM host ALIGN (INTERVAL '1' day) ORDER BY host, ts;
|
|
|
|
+---------------------+-------+------------------------------------------------------------------+
|
|
| ts | host | MIN(host.val) RANGE IntervalMonthDayNano("18446744073709551616") |
|
|
+---------------------+-------+------------------------------------------------------------------+
|
|
| 1970-01-01T00:00:00 | host1 | 0 |
|
|
| 1971-01-02T00:00:00 | host1 | 2 |
|
|
| 1970-01-01T00:00:00 | host2 | 4 |
|
|
| 1971-01-02T00:00:00 | host2 | 6 |
|
|
+---------------------+-------+------------------------------------------------------------------+
|
|
|
|
DROP TABLE host;
|
|
|
|
Affected Rows: 0
|
|
|