-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: sqlness tests added back for flow
- Loading branch information
Showing
6 changed files
with
769 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
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) FROM numbers_input_basic GROUP BY tumble(ts, '1 second', '2021-07-01 00:00:00'); | ||
|
||
Affected Rows: 0 | ||
|
||
-- TODO(discord9): confirm if it's necessary to flush flow here? | ||
select flush_flow('test_numbers_basic')*0; | ||
|
||
+---------------------------------------------------+ | ||
| flush_flow(Utf8("test_numbers_basic")) * Int64(0) | | ||
+---------------------------------------------------+ | ||
| 0 | | ||
+---------------------------------------------------+ | ||
|
||
INSERT INTO numbers_input_basic | ||
VALUES | ||
(20, "2021-07-01 00:00:00.200"), | ||
(22, "2021-07-01 00:00:00.600"); | ||
|
||
Affected Rows: 2 | ||
|
||
select flush_flow('test_numbers_basic')*0; | ||
|
||
+---------------------------------------------------+ | ||
| flush_flow(Utf8("test_numbers_basic")) * Int64(0) | | ||
+---------------------------------------------------+ | ||
| 0 | | ||
+---------------------------------------------------+ | ||
|
||
SELECT col_0, window_start, window_end FROM out_num_cnt_basic; | ||
|
||
+-------+---------------------+---------------------+ | ||
| col_0 | window_start | window_end | | ||
+-------+---------------------+---------------------+ | ||
| 42 | 2021-07-01T00:00:00 | 2021-07-01T00:00:01 | | ||
+-------+---------------------+---------------------+ | ||
|
||
select flush_flow('test_numbers_basic')*0; | ||
|
||
+---------------------------------------------------+ | ||
| flush_flow(Utf8("test_numbers_basic")) * Int64(0) | | ||
+---------------------------------------------------+ | ||
| 0 | | ||
+---------------------------------------------------+ | ||
|
||
INSERT INTO numbers_input_basic | ||
VALUES | ||
(23,"2021-07-01 00:00:01.000"), | ||
(24,"2021-07-01 00:00:01.500"); | ||
|
||
Affected Rows: 2 | ||
|
||
select flush_flow('test_numbers_basic')*0; | ||
|
||
+---------------------------------------------------+ | ||
| flush_flow(Utf8("test_numbers_basic")) * Int64(0) | | ||
+---------------------------------------------------+ | ||
| 0 | | ||
+---------------------------------------------------+ | ||
|
||
SELECT col_0, window_start, window_end FROM out_num_cnt_basic; | ||
|
||
+-------+---------------------+---------------------+ | ||
| 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_basic; | ||
|
||
Affected Rows: 0 | ||
|
||
DROP TABLE numbers_input_basic; | ||
|
||
Affected Rows: 0 | ||
|
||
DROP TABLE out_num_cnt_basic; | ||
|
||
Affected Rows: 0 | ||
|
||
-- test interprete interval | ||
CREATE TABLE numbers_input_basic ( | ||
number INT, | ||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY(number), | ||
TIME INDEX(ts) | ||
); | ||
|
||
Affected Rows: 0 | ||
|
||
create table out_num_cnt_basic ( | ||
number INT, | ||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP TIME INDEX); | ||
|
||
Affected Rows: 0 | ||
|
||
CREATE FLOW filter_numbers_basic SINK TO out_num_cnt_basic AS SELECT INTERVAL '1 day 1 second', INTERVAL '1 month 1 day 1 second', INTERVAL '1 year 1 month' FROM numbers_input_basic where number > 10; | ||
|
||
Affected Rows: 0 | ||
|
||
SHOW CREATE FLOW filter_numbers_basic; | ||
|
||
+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| Flow | Create Flow | | ||
+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| filter_numbers_basic | CREATE OR REPLACE FLOW IF NOT EXISTS filter_numbers_basic | | ||
| | SINK TO out_num_cnt_basic | | ||
| | AS SELECT INTERVAL '1 day 1 second', INTERVAL '1 month 1 day 1 second', INTERVAL '1 year 1 month' FROM numbers_input_basic WHERE number > 10 | | ||
+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ | ||
|
||
drop flow filter_numbers_basic; | ||
|
||
Affected Rows: 0 | ||
|
||
drop table out_num_cnt_basic; | ||
|
||
Affected Rows: 0 | ||
|
||
drop table numbers_input_basic; | ||
|
||
Affected Rows: 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
CREATE TABLE numbers_input_basic ( | ||
number INT, | ||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY(number), | ||
TIME INDEX(ts) | ||
); | ||
|
||
CREATE FLOW test_numbers_basic | ||
SINK TO out_num_cnt_basic | ||
AS | ||
SELECT sum(number) FROM numbers_input_basic GROUP BY tumble(ts, '1 second', '2021-07-01 00:00:00'); | ||
|
||
-- TODO(discord9): confirm if it's necessary to flush flow here? | ||
select flush_flow('test_numbers_basic')*0; | ||
|
||
INSERT INTO numbers_input_basic | ||
VALUES | ||
(20, "2021-07-01 00:00:00.200"), | ||
(22, "2021-07-01 00:00:00.600"); | ||
|
||
select flush_flow('test_numbers_basic')*0; | ||
|
||
SELECT col_0, window_start, window_end FROM out_num_cnt_basic; | ||
|
||
select flush_flow('test_numbers_basic')*0; | ||
|
||
INSERT INTO numbers_input_basic | ||
VALUES | ||
(23,"2021-07-01 00:00:01.000"), | ||
(24,"2021-07-01 00:00:01.500"); | ||
|
||
select flush_flow('test_numbers_basic')*0; | ||
|
||
SELECT col_0, window_start, window_end FROM out_num_cnt_basic; | ||
|
||
DROP FLOW test_numbers_basic; | ||
DROP TABLE numbers_input_basic; | ||
DROP TABLE out_num_cnt_basic; | ||
|
||
-- test interprete interval | ||
|
||
CREATE TABLE numbers_input_basic ( | ||
number INT, | ||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY(number), | ||
TIME INDEX(ts) | ||
); | ||
create table out_num_cnt_basic ( | ||
number INT, | ||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP TIME INDEX); | ||
|
||
CREATE FLOW filter_numbers_basic SINK TO out_num_cnt_basic AS SELECT INTERVAL '1 day 1 second', INTERVAL '1 month 1 day 1 second', INTERVAL '1 year 1 month' FROM numbers_input_basic where number > 10; | ||
|
||
SHOW CREATE FLOW filter_numbers_basic; | ||
|
||
drop flow filter_numbers_basic; | ||
|
||
drop table out_num_cnt_basic; | ||
|
||
drop table numbers_input_basic; |
Oops, something went wrong.