Skip to content

Commit

Permalink
test: sqlness test update
Browse files Browse the repository at this point in the history
  • Loading branch information
discord9 committed Aug 2, 2024
1 parent 6abebca commit d408fdb
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 94 deletions.
53 changes: 27 additions & 26 deletions tests/cases/standalone/common/flow/flow_basic.result
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ select flush_flow('test_numbers_basic')<=1;
| true |
+----------------------------------------------------+

SELECT col_0, window_start, window_end FROM out_num_cnt_basic;
SELECT "SUM(numbers_input_basic.number)", 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 |
+-------+---------------------+---------------------+
+---------------------------------+---------------------+---------------------+
| SUM(numbers_input_basic.number) | window_start | window_end |
+---------------------------------+---------------------+---------------------+
| 42 | 2021-07-01T00:00:00 | 2021-07-01T00:00:01 |
+---------------------------------+---------------------+---------------------+

select flush_flow('test_numbers_basic')<=1;

Expand All @@ -70,14 +70,14 @@ select flush_flow('test_numbers_basic')<=1;
| true |
+----------------------------------------------------+

SELECT col_0, window_start, window_end FROM out_num_cnt_basic;
SELECT "SUM(numbers_input_basic.number)", 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 |
+-------+---------------------+---------------------+
+---------------------------------+---------------------+---------------------+
| SUM(numbers_input_basic.number) | 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;

Expand Down Expand Up @@ -141,8 +141,9 @@ CREATE TABLE bytes_log (

Affected Rows: 0

-- TODO(discord9): remove this after auto infer table's time index is impl
CREATE TABLE approx_rate (
rate FLOAT,
rate DOUBLE,
time_window TIMESTAMP,
update_at TIMESTAMP,
TIME INDEX(time_window)
Expand All @@ -153,7 +154,7 @@ Affected Rows: 0
CREATE FLOW find_approx_rate
SINK TO approx_rate
AS
SELECT CAST((max(byte) - min(byte)) AS FLOAT)/30.0, date_bin(INTERVAL '30 second', ts) as time_window from bytes_log GROUP BY time_window;
SELECT CAST((max(byte) - min(byte)) AS FLOAT)/30.0 as rate, date_bin(INTERVAL '30 second', ts) as time_window from bytes_log GROUP BY time_window;

Affected Rows: 0

Expand All @@ -173,11 +174,11 @@ SELECT flush_flow('find_approx_rate')<=1;

SELECT rate, time_window FROM approx_rate;

+----------+---------------------+
| rate | time_window |
+----------+---------------------+
| 6.633333 | 2025-01-01T00:00:00 |
+----------+---------------------+
+-------------------+---------------------+
| rate | time_window |
+-------------------+---------------------+
| 6.633333333333334 | 2025-01-01T00:00:00 |
+-------------------+---------------------+

INSERT INTO bytes_log VALUES
(450, '2025-01-01 00:00:32'),
Expand All @@ -195,12 +196,12 @@ SELECT flush_flow('find_approx_rate')<=1;

SELECT rate, time_window FROM approx_rate;

+-----------+---------------------+
| rate | time_window |
+-----------+---------------------+
| 6.633333 | 2025-01-01T00:00:00 |
| 1.6666666 | 2025-01-01T00:00:30 |
+-----------+---------------------+
+--------------------+---------------------+
| rate | time_window |
+--------------------+---------------------+
| 6.633333333333334 | 2025-01-01T00:00:00 |
| 1.6666666666666667 | 2025-01-01T00:00:30 |
+--------------------+---------------------+

DROP TABLE bytes_log;

Expand Down
9 changes: 5 additions & 4 deletions tests/cases/standalone/common/flow/flow_basic.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ VALUES

select flush_flow('test_numbers_basic')<=1;

SELECT col_0, window_start, window_end FROM out_num_cnt_basic;
SELECT "SUM(numbers_input_basic.number)", window_start, window_end FROM out_num_cnt_basic;

select flush_flow('test_numbers_basic')<=1;

Expand All @@ -32,7 +32,7 @@ VALUES

select flush_flow('test_numbers_basic')<=1;

SELECT col_0, window_start, window_end FROM out_num_cnt_basic;
SELECT "SUM(numbers_input_basic.number)", window_start, window_end FROM out_num_cnt_basic;

DROP FLOW test_numbers_basic;
DROP TABLE numbers_input_basic;
Expand Down Expand Up @@ -66,8 +66,9 @@ CREATE TABLE bytes_log (
TIME INDEX(ts)
);

-- TODO(discord9): remove this after auto infer table's time index is impl
CREATE TABLE approx_rate (
rate FLOAT,
rate DOUBLE,
time_window TIMESTAMP,
update_at TIMESTAMP,
TIME INDEX(time_window)
Expand All @@ -76,7 +77,7 @@ CREATE TABLE approx_rate (
CREATE FLOW find_approx_rate
SINK TO approx_rate
AS
SELECT CAST((max(byte) - min(byte)) AS FLOAT)/30.0, date_bin(INTERVAL '30 second', ts) as time_window from bytes_log GROUP BY time_window;
SELECT CAST((max(byte) - min(byte)) AS FLOAT)/30.0 as rate, date_bin(INTERVAL '30 second', ts) as time_window from bytes_log GROUP BY time_window;

INSERT INTO bytes_log VALUES
(101, '2025-01-01 00:00:01'),
Expand Down
108 changes: 54 additions & 54 deletions tests/cases/standalone/common/flow/flow_call_df_func.result
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ select flush_flow('test_numbers_df_func')<=1;
| true |
+------------------------------------------------------+

SELECT col_0, window_start, window_end FROM out_num_cnt_df_func;
SELECT "SUM(abs(numbers_input_df_func.number))", window_start, window_end FROM out_num_cnt_df_func;

+-------+---------------------+---------------------+
| col_0 | window_start | window_end |
+-------+---------------------+---------------------+
| 42 | 2021-07-01T00:00:00 | 2021-07-01T00:00:01 |
+-------+---------------------+---------------------+
+----------------------------------------+---------------------+---------------------+
| SUM(abs(numbers_input_df_func.number)) | window_start | window_end |
+----------------------------------------+---------------------+---------------------+
| 42 | 2021-07-01T00:00:00 | 2021-07-01T00:00:01 |
+----------------------------------------+---------------------+---------------------+

select flush_flow('test_numbers_df_func')<=1;

Expand All @@ -70,14 +70,14 @@ select flush_flow('test_numbers_df_func')<=1;
| true |
+------------------------------------------------------+

SELECT col_0, window_start, window_end FROM out_num_cnt_df_func;
SELECT "SUM(abs(numbers_input_df_func.number))", window_start, window_end FROM out_num_cnt_df_func;

+-------+---------------------+---------------------+
| 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 |
+-------+---------------------+---------------------+
+----------------------------------------+---------------------+---------------------+
| SUM(abs(numbers_input_df_func.number)) | 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_df_func;

Expand Down Expand Up @@ -132,13 +132,13 @@ select flush_flow('test_numbers_df_func')<=1;
| true |
+------------------------------------------------------+

SELECT col_0, window_start, window_end FROM out_num_cnt_df_func;
SELECT "abs(SUM(numbers_input_df_func.number))", window_start, window_end FROM out_num_cnt_df_func;

+-------+---------------------+---------------------+
| col_0 | window_start | window_end |
+-------+---------------------+---------------------+
| 2 | 2021-07-01T00:00:00 | 2021-07-01T00:00:01 |
+-------+---------------------+---------------------+
+----------------------------------------+---------------------+---------------------+
| abs(SUM(numbers_input_df_func.number)) | window_start | window_end |
+----------------------------------------+---------------------+---------------------+
| 2 | 2021-07-01T00:00:00 | 2021-07-01T00:00:01 |
+----------------------------------------+---------------------+---------------------+

select flush_flow('test_numbers_df_func')<=1;

Expand All @@ -163,14 +163,14 @@ select flush_flow('test_numbers_df_func')<=1;
| true |
+------------------------------------------------------+

SELECT col_0, window_start, window_end FROM out_num_cnt_df_func;
SELECT "abs(SUM(numbers_input_df_func.number))", window_start, window_end FROM out_num_cnt_df_func;

+-------+---------------------+---------------------+
| col_0 | window_start | window_end |
+-------+---------------------+---------------------+
| 2 | 2021-07-01T00:00:00 | 2021-07-01T00:00:01 |
| 1 | 2021-07-01T00:00:01 | 2021-07-01T00:00:02 |
+-------+---------------------+---------------------+
+----------------------------------------+---------------------+---------------------+
| abs(SUM(numbers_input_df_func.number)) | window_start | window_end |
+----------------------------------------+---------------------+---------------------+
| 2 | 2021-07-01T00:00:00 | 2021-07-01T00:00:01 |
| 1 | 2021-07-01T00:00:01 | 2021-07-01T00:00:02 |
+----------------------------------------+---------------------+---------------------+

DROP FLOW test_numbers_df_func;

Expand All @@ -197,7 +197,7 @@ Affected Rows: 0
CREATE FLOW test_numbers_df_func
SINK TO out_num_cnt_df_func
AS
SELECT max(number) - min(number), date_bin(INTERVAL '1 second', ts, '2021-07-01 00:00:00'::TimestampNanosecond) FROM numbers_input_df_func GROUP BY date_bin(INTERVAL '1 second', ts, '2021-07-01 00:00:00'::TimestampNanosecond);
SELECT max(number) - min(number) as maxmin, date_bin(INTERVAL '1 second', ts, '2021-07-01 00:00:00'::TimestampNanosecond) as time_window FROM numbers_input_df_func GROUP BY date_bin(INTERVAL '1 second', ts, '2021-07-01 00:00:00'::TimestampNanosecond);

Affected Rows: 0

Expand All @@ -224,13 +224,13 @@ select flush_flow('test_numbers_df_func')<=1;
| true |
+------------------------------------------------------+

SELECT col_0, col_1 FROM out_num_cnt_df_func;
SELECT maxmin, time_window FROM out_num_cnt_df_func;

+-------+---------------------+
| col_0 | col_1 |
+-------+---------------------+
| 2 | 2021-07-01T00:00:00 |
+-------+---------------------+
+--------+---------------------+
| maxmin | time_window |
+--------+---------------------+
| 2 | 2021-07-01T00:00:00 |
+--------+---------------------+

select flush_flow('test_numbers_df_func')<=1;

Expand All @@ -255,14 +255,14 @@ select flush_flow('test_numbers_df_func')<=1;
| true |
+------------------------------------------------------+

SELECT col_0, col_1 FROM out_num_cnt_df_func;
SELECT maxmin, time_window FROM out_num_cnt_df_func;

+-------+---------------------+
| col_0 | col_1 |
+-------+---------------------+
| 2 | 2021-07-01T00:00:00 |
| 1 | 2021-07-01T00:00:01 |
+-------+---------------------+
+--------+---------------------+
| maxmin | time_window |
+--------+---------------------+
| 2 | 2021-07-01T00:00:00 |
| 1 | 2021-07-01T00:00:01 |
+--------+---------------------+

DROP FLOW test_numbers_df_func;

Expand All @@ -289,7 +289,7 @@ Affected Rows: 0
CREATE FLOW test_numbers_df_func
SINK TO out_num_cnt
AS
SELECT date_trunc('second', ts), sum(number) FROM numbers_input_df_func GROUP BY date_trunc('second', ts);
SELECT date_trunc('second', ts) as time_window, sum(number) as sum_num FROM numbers_input_df_func GROUP BY date_trunc('second', ts);

Affected Rows: 0

Expand All @@ -316,13 +316,13 @@ select flush_flow('test_numbers_df_func')<=1;
| true |
+------------------------------------------------------+

SELECT col_0, col_1 FROM out_num_cnt;
SELECT time_window, sum_num FROM out_num_cnt;

+---------------------+-------+
| col_0 | col_1 |
+---------------------+-------+
| 2021-07-01T00:00:00 | 42 |
+---------------------+-------+
+---------------------+---------+
| time_window | sum_num |
+---------------------+---------+
| 2021-07-01T00:00:00 | 42 |
+---------------------+---------+

select flush_flow('test_numbers_df_func')<=1;

Expand All @@ -347,14 +347,14 @@ select flush_flow('test_numbers_df_func')<=1;
| true |
+------------------------------------------------------+

SELECT col_0, col_1 FROM out_num_cnt;
SELECT time_window, sum_num FROM out_num_cnt;

+---------------------+-------+
| col_0 | col_1 |
+---------------------+-------+
| 2021-07-01T00:00:00 | 42 |
| 2021-07-01T00:00:01 | 47 |
+---------------------+-------+
+---------------------+---------+
| time_window | sum_num |
+---------------------+---------+
| 2021-07-01T00:00:00 | 42 |
| 2021-07-01T00:00:01 | 47 |
+---------------------+---------+

DROP FLOW test_numbers_df_func;

Expand Down
Loading

0 comments on commit d408fdb

Please sign in to comment.