mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-04 12:22:55 +00:00
feat: flownode frontend client&test feat: Frontend Client feat: set frontend invoker for flownode feat: set frontend invoker for flownode chore: test script WIP: test flow distributed feat: hard coded demo docs: flownode example toml feat: add flownode support in runner docs: comments for node chore: after rebase docs: add a todo tests: move flow tests to common fix: flownode sqlness dist test chore: per review docs: make fix: make doc
123 lines
2.6 KiB
Plaintext
123 lines
2.6 KiB
Plaintext
CREATE TABLE numbers_input (
|
|
number INT,
|
|
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY(number),
|
|
TIME INDEX(ts)
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
CREATE FLOW test_numbers
|
|
SINK TO out_num_cnt
|
|
AS
|
|
SELECT sum(number) FROM numbers_input GROUP BY tumble(ts, '1 second', '2021-07-01 00:00:00');
|
|
|
|
Affected Rows: 0
|
|
|
|
INSERT INTO numbers_input
|
|
VALUES
|
|
(20, "2021-07-01 00:00:00.200"),
|
|
(22, "2021-07-01 00:00:00.600");
|
|
|
|
Affected Rows: 2
|
|
|
|
-- SQLNESS SLEEP 3s
|
|
SELECT col_0, window_start, window_end FROM out_num_cnt;
|
|
|
|
+-------+---------------------+---------------------+
|
|
| col_0 | window_start | window_end |
|
|
+-------+---------------------+---------------------+
|
|
| 42 | 2021-07-01T00:00:00 | 2021-07-01T00:00:01 |
|
|
+-------+---------------------+---------------------+
|
|
|
|
INSERT INTO numbers_input
|
|
VALUES
|
|
(23,"2021-07-01 00:00:01.000"),
|
|
(24,"2021-07-01 00:00:01.500");
|
|
|
|
Affected Rows: 2
|
|
|
|
-- SQLNESS SLEEP 2s
|
|
SELECT col_0, window_start, window_end FROM out_num_cnt;
|
|
|
|
+-------+---------------------+---------------------+
|
|
| col_0 | window_start | window_end |
|
|
+-------+---------------------+---------------------+
|
|
| 42 | 2021-07-01T00:00:00 | 2021-07-01T00:00:01 |
|
|
| 47 | 2021-07-01T00:00:01 | 2021-07-01T00:00:02 |
|
|
+-------+---------------------+---------------------+
|
|
|
|
DROP FLOW test_numbers;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE numbers_input;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE out_num_cnt;
|
|
|
|
Affected Rows: 0
|
|
|
|
CREATE TABLE numbers_input (
|
|
number INT,
|
|
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY(number),
|
|
TIME INDEX(ts)
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
CREATE FLOW test_numbers
|
|
SINK TO out_num_cnt
|
|
AS
|
|
SELECT date_trunc('second', ts), sum(number) FROM numbers_input GROUP BY date_trunc('second', ts);
|
|
|
|
Affected Rows: 0
|
|
|
|
INSERT INTO numbers_input
|
|
VALUES
|
|
(20, "2021-07-01 00:00:00.200"),
|
|
(22, "2021-07-01 00:00:00.600");
|
|
|
|
Affected Rows: 2
|
|
|
|
-- SQLNESS SLEEP 3s
|
|
SELECT col_0, col_1 FROM out_num_cnt;
|
|
|
|
+---------------------+-------+
|
|
| col_0 | col_1 |
|
|
+---------------------+-------+
|
|
| 2021-07-01T00:00:00 | 42 |
|
|
+---------------------+-------+
|
|
|
|
INSERT INTO numbers_input
|
|
VALUES
|
|
(23,"2021-07-01 00:00:01.000"),
|
|
(24,"2021-07-01 00:00:01.500");
|
|
|
|
Affected Rows: 2
|
|
|
|
-- SQLNESS SLEEP 2s
|
|
SELECT col_0, col_1 FROM out_num_cnt;
|
|
|
|
+---------------------+-------+
|
|
| col_0 | col_1 |
|
|
+---------------------+-------+
|
|
| 2021-07-01T00:00:00 | 42 |
|
|
| 2021-07-01T00:00:01 | 47 |
|
|
+---------------------+-------+
|
|
|
|
DROP FLOW test_numbers;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE numbers_input;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE out_num_cnt;
|
|
|
|
Affected Rows: 0
|
|
|