mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-22 07:50:38 +00:00
* chore: upgrade DataFusion family Signed-off-by: luofucong <luofc@foxmail.com> * chore: switch to released version of datafusion-pg-catalog --------- Signed-off-by: luofucong <luofc@foxmail.com> Co-authored-by: Ning Sun <sunning@greptime.com> Co-authored-by: Ning Sun <sunng@protonmail.com>
195 lines
8.2 KiB
Plaintext
195 lines
8.2 KiB
Plaintext
CREATE TABLE numbers_input_basic (
|
|
"number" INT,
|
|
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY(number),
|
|
TIME INDEX(ts)
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
CREATE FLOW test_numbers_basic SINK TO out_num_cnt_basic AS
|
|
SELECT
|
|
sum(number),
|
|
date_bin(INTERVAL '1 second', ts, '2021-07-01 00:00:00') as time_window
|
|
FROM
|
|
numbers_input_basic
|
|
GROUP BY
|
|
time_window;
|
|
|
|
Affected Rows: 0
|
|
|
|
SHOW CREATE TABLE out_num_cnt_basic;
|
|
|
|
+-------------------+---------------------------------------------------+
|
|
| Table | Create Table |
|
|
+-------------------+---------------------------------------------------+
|
|
| out_num_cnt_basic | CREATE TABLE IF NOT EXISTS "out_num_cnt_basic" ( |
|
|
| | "sum(numbers_input_basic.number)" BIGINT NULL, |
|
|
| | "time_window" TIMESTAMP(9) NOT NULL, |
|
|
| | "update_at" TIMESTAMP(3) NULL, |
|
|
| | TIME INDEX ("time_window") |
|
|
| | ) |
|
|
| | |
|
|
| | ENGINE=mito |
|
|
| | WITH( |
|
|
| | 'comment' = 'Auto created table by flow engine' |
|
|
| | ) |
|
|
+-------------------+---------------------------------------------------+
|
|
|
|
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
|
ADMIN FLUSH_FLOW('test_numbers_basic');
|
|
|
|
+----------------------------------------+
|
|
| ADMIN FLUSH_FLOW('test_numbers_basic') |
|
|
+----------------------------------------+
|
|
| FLOW_FLUSHED |
|
|
+----------------------------------------+
|
|
|
|
-- SQLNESS ARG restart=true
|
|
SELECT 1;
|
|
|
|
+----------+
|
|
| Int64(1) |
|
|
+----------+
|
|
| 1 |
|
|
+----------+
|
|
|
|
-- SQLNESS SLEEP 3s
|
|
SHOW CREATE TABLE out_num_cnt_basic;
|
|
|
|
+-------------------+---------------------------------------------------+
|
|
| Table | Create Table |
|
|
+-------------------+---------------------------------------------------+
|
|
| out_num_cnt_basic | CREATE TABLE IF NOT EXISTS "out_num_cnt_basic" ( |
|
|
| | "sum(numbers_input_basic.number)" BIGINT NULL, |
|
|
| | "time_window" TIMESTAMP(9) NOT NULL, |
|
|
| | "update_at" TIMESTAMP(3) NULL, |
|
|
| | TIME INDEX ("time_window") |
|
|
| | ) |
|
|
| | |
|
|
| | ENGINE=mito |
|
|
| | WITH( |
|
|
| | 'comment' = 'Auto created table by flow engine' |
|
|
| | ) |
|
|
+-------------------+---------------------------------------------------+
|
|
|
|
SHOW CREATE FLOW test_numbers_basic;
|
|
|
|
+--------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| Flow | Create Flow |
|
|
+--------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| test_numbers_basic | CREATE FLOW IF NOT EXISTS test_numbers_basic |
|
|
| | SINK TO public.out_num_cnt_basic |
|
|
| | AS SELECT sum(number), date_bin(INTERVAL '1 second', ts, '2021-07-01 00:00:00') AS time_window FROM numbers_input_basic GROUP BY time_window |
|
|
+--------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
DROP FLOW test_numbers_basic;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE numbers_input_basic;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE out_num_cnt_basic;
|
|
|
|
Affected Rows: 0
|
|
|
|
CREATE TABLE numbers_input_basic (
|
|
"number" INT,
|
|
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY(number),
|
|
TIME INDEX(ts)
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
CREATE FLOW test_numbers_basic SINK TO out_num_cnt_basic AS
|
|
SELECT
|
|
sum(number) as sumup, ts as event_time
|
|
FROM
|
|
numbers_input_basic
|
|
GROUP BY
|
|
ts;
|
|
|
|
Affected Rows: 0
|
|
|
|
-- SQLNESS ARG restart=true
|
|
SELECT 1;
|
|
|
|
+----------+
|
|
| Int64(1) |
|
|
+----------+
|
|
| 1 |
|
|
+----------+
|
|
|
|
-- SQLNESS SLEEP 3s
|
|
SHOW CREATE TABLE out_num_cnt_basic;
|
|
|
|
+-------------------+---------------------------------------------------+
|
|
| Table | Create Table |
|
|
+-------------------+---------------------------------------------------+
|
|
| out_num_cnt_basic | CREATE TABLE IF NOT EXISTS "out_num_cnt_basic" ( |
|
|
| | "sumup" BIGINT NULL, |
|
|
| | "event_time" TIMESTAMP(3) NOT NULL, |
|
|
| | "update_at" TIMESTAMP(3) NULL, |
|
|
| | TIME INDEX ("event_time") |
|
|
| | ) |
|
|
| | |
|
|
| | ENGINE=mito |
|
|
| | WITH( |
|
|
| | 'comment' = 'Auto created table by flow engine' |
|
|
| | ) |
|
|
+-------------------+---------------------------------------------------+
|
|
|
|
-- SQLNESS ARG restart=true
|
|
SELECT 1;
|
|
|
|
+----------+
|
|
| Int64(1) |
|
|
+----------+
|
|
| 1 |
|
|
+----------+
|
|
|
|
-- SQLNESS SLEEP 3s
|
|
SHOW CREATE FLOW test_numbers_basic;
|
|
|
|
+--------------------+---------------------------------------------------------------------------------------+
|
|
| Flow | Create Flow |
|
|
+--------------------+---------------------------------------------------------------------------------------+
|
|
| test_numbers_basic | CREATE FLOW IF NOT EXISTS test_numbers_basic |
|
|
| | SINK TO public.out_num_cnt_basic |
|
|
| | AS SELECT sum(number) AS sumup, ts AS event_time FROM numbers_input_basic GROUP BY ts |
|
|
+--------------------+---------------------------------------------------------------------------------------+
|
|
|
|
SHOW CREATE TABLE out_num_cnt_basic;
|
|
|
|
+-------------------+---------------------------------------------------+
|
|
| Table | Create Table |
|
|
+-------------------+---------------------------------------------------+
|
|
| out_num_cnt_basic | CREATE TABLE IF NOT EXISTS "out_num_cnt_basic" ( |
|
|
| | "sumup" BIGINT NULL, |
|
|
| | "event_time" TIMESTAMP(3) NOT NULL, |
|
|
| | "update_at" TIMESTAMP(3) NULL, |
|
|
| | TIME INDEX ("event_time") |
|
|
| | ) |
|
|
| | |
|
|
| | ENGINE=mito |
|
|
| | WITH( |
|
|
| | 'comment' = 'Auto created table by flow engine' |
|
|
| | ) |
|
|
+-------------------+---------------------------------------------------+
|
|
|
|
DROP FLOW test_numbers_basic;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE numbers_input_basic;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE out_num_cnt_basic;
|
|
|
|
Affected Rows: 0
|
|
|