Skip to content

Commit

Permalink
add e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Chien <[email protected]>
  • Loading branch information
stdrc committed Feb 4, 2024
1 parent c68d8a5 commit 1ca5ea4
Show file tree
Hide file tree
Showing 12 changed files with 441 additions and 3 deletions.
40 changes: 40 additions & 0 deletions e2e_test/over_window/generated/batch/basic/cross_check.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ select
from v_a natural join v_c;
----

query i
select
id, out1, out10, out11
from v_a_d
except
select
id, out1, out10, out11
from v_a natural join v_d;
----

query i
select
id, out3, out4, out7, out8, out9
Expand All @@ -31,6 +41,26 @@ select
from v_b natural join v_c;
----

query i
select
id, out3, out4, out10, out11
from v_b_d
except
select
id, out3, out4, out10, out11
from v_b natural join v_d;
----

query i
select
id, out7, out8, out9, out10, out11
from v_c_d
except
select
id, out7, out8, out9, out10, out11
from v_c natural join v_d;
----

query i
select
id, out1, out2, out3, out4, out5, out6, out7, out8, out9
Expand All @@ -40,3 +70,13 @@ select
id, out1, out2, out3, out4, out5, out6, out7, out8, out9
from v_a natural join v_b natural join v_c;
----

query i
select
id, out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11
from v_a_b_c_d
except
select
id, out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11
from v_a natural join v_b natural join v_c natural join v_d;
----
35 changes: 35 additions & 0 deletions e2e_test/over_window/generated/batch/basic/mod.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ select * from v_c order by id;
100003 100 208 2 723 807 723 NULL NULL NULL NULL
100004 103 200 2 702 808 702 NULL NULL NULL NULL

query iiiiiiii
select * from v_d order by id;
----
100001 100 200 1 701 805 1 2124
100002 100 200 2 700 806 1 2124
100003 100 208 2 723 807 1 2124
100004 103 200 2 702 808 2 702

include ./cross_check.slt.part

statement ok
Expand Down Expand Up @@ -72,6 +80,16 @@ select * from v_c order by id;
100005 100 200 3 717 810 717 700 700 NULL NULL
100006 105 204 5 703 828 703 NULL NULL NULL NULL

query iiiiiiii
select * from v_d order by id;
----
100001 100 200 1 701 805 1 2124
100002 100 200 2 700 806 1 2841
100003 100 208 2 723 807 1 2841
100004 103 200 2 702 808 2 702
100005 100 200 3 717 810 1 2140
100006 105 204 5 703 828 5 703

include ./cross_check.slt.part

statement ok
Expand Down Expand Up @@ -113,6 +131,16 @@ select * from v_c order by id;
100005 100 200 1 717 810 717 723 701 806 806
100006 105 204 5 703 828 703 NULL NULL NULL NULL

query iiiiiiii
select * from v_d order by id;
----
100001 100 200 1 701 805 1 2940
100002 100 200 2 799 806 1 2940
100003 100 200 2 723 807 1 2940
100004 103 200 2 702 808 2 702
100005 100 200 1 717 810 1 2940
100006 105 204 5 703 828 5 703

include ./cross_check.slt.part

statement ok
Expand All @@ -139,6 +167,13 @@ select * from v_c order by id;
100005 100 200 1 717 810 717 701 701 NULL NULL
100006 105 204 5 703 828 703 NULL NULL NULL NULL

query iiiiiiii
select * from v_d order by id;
----
100001 100 200 1 701 805 1 1418
100005 100 200 1 717 810 1 1418
100006 105 204 5 703 828 5 703

include ./cross_check.slt.part

include ./teardown.slt.part
56 changes: 56 additions & 0 deletions e2e_test/over_window/generated/batch/basic/setup.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ select
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
from t;

# range frame
statement ok
create view v_d as
select
*
, last_value(time) over (partition by p1 order by time desc range between current row and 2 following) as out10
, sum(v1) over (partition by p1 order by time range between 1 preceding and 1 following) as out11
from t;

statement ok
create view v_a_b as
select
Expand All @@ -59,6 +68,15 @@ select
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
from t;

statement ok
create view v_a_d as
select
*
, first_value(v1) over (partition by p1, p2 order by time, id rows 3 preceding) as out1
, last_value(time) over (partition by p1 order by time desc range between current row and 2 following) as out10
, sum(v1) over (partition by p1 order by time range between 1 preceding and 1 following) as out11
from t;

statement ok
create view v_b_c as
select
Expand All @@ -70,6 +88,27 @@ select
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
from t;

statement ok
create view v_b_d as
select
*
, sum(v1) over (partition by p1, p2 order by time, id rows between unbounded preceding and current row) as out3
, min(v1) over (partition by p1, p2 order by time, id rows between current row and unbounded following) as out4
, last_value(time) over (partition by p1 order by time desc range between current row and 2 following) as out10
, sum(v1) over (partition by p1 order by time range between 1 preceding and 1 following) as out11
from t;

statement ok
create view v_c_d as
select
*
, lag(v1) over (partition by p1, p2 order by time, id) as out7
, lead(v2, 1) over (partition by p1, p2 order by time, id) as out8
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
, last_value(time) over (partition by p1 order by time desc range between current row and 2 following) as out10
, sum(v1) over (partition by p1 order by time range between 1 preceding and 1 following) as out11
from t;

statement ok
create view v_a_b_c as
select
Expand All @@ -84,3 +123,20 @@ select
, lead(v2, 1) over (partition by p1, p2 order by time, id) as out8
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
from t;

statement ok
create view v_a_b_c_d as
select
*
, first_value(v1) over (partition by p1, p2 order by time, id rows 3 preceding) as out1
, avg(v1) over (partition by p1) as out2
, sum(v1) over (partition by p1, p2 order by time, id rows between unbounded preceding and current row) as out3
, min(v1) over (partition by p1, p2 order by time, id rows between current row and unbounded following) as out4
, lag(v1, 0) over (partition by p1 order by id) as out5
, lag(v1, 1) over (partition by p1, p2 order by id) as out6
, lag(v1) over (partition by p1, p2 order by time, id) as out7
, lead(v2, 1) over (partition by p1, p2 order by time, id) as out8
, lead(v2, 2) over (partition by p1, p2 order by v1, v2) as out9
, last_value(time) over (partition by p1 order by time desc range between current row and 2 following) as out10
, sum(v1) over (partition by p1 order by time range between 1 preceding and 1 following) as out11
from t;
17 changes: 16 additions & 1 deletion e2e_test/over_window/generated/batch/basic/teardown.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,32 @@ drop view v_b;
statement ok
drop view v_c;

statement ok
drop view v_d;

statement ok
drop view v_a_b;

statement ok
drop view v_a_c;

statement ok
drop view v_a_d;

statement ok
drop view v_b_c;

statement ok
drop view v_a_c;
drop view v_b_d;

statement ok
drop view v_c_d;

statement ok
drop view v_a_b_c;

statement ok
drop view v_a_b_c_d;

statement ok
drop table t;
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ select
from v_a natural join v_c;
----

query i
select
id, out1, out10, out11
from v_a_d
except
select
id, out1, out10, out11
from v_a natural join v_d;
----

query i
select
id, out3, out4, out7, out8, out9
Expand All @@ -31,6 +41,26 @@ select
from v_b natural join v_c;
----

query i
select
id, out3, out4, out10, out11
from v_b_d
except
select
id, out3, out4, out10, out11
from v_b natural join v_d;
----

query i
select
id, out7, out8, out9, out10, out11
from v_c_d
except
select
id, out7, out8, out9, out10, out11
from v_c natural join v_d;
----

query i
select
id, out1, out2, out3, out4, out5, out6, out7, out8, out9
Expand All @@ -40,3 +70,13 @@ select
id, out1, out2, out3, out4, out5, out6, out7, out8, out9
from v_a natural join v_b natural join v_c;
----

query i
select
id, out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11
from v_a_b_c_d
except
select
id, out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11
from v_a natural join v_b natural join v_c natural join v_d;
----
35 changes: 35 additions & 0 deletions e2e_test/over_window/generated/streaming/basic/mod.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ select * from v_c order by id;
100003 100 208 2 723 807 723 NULL NULL NULL NULL
100004 103 200 2 702 808 702 NULL NULL NULL NULL

query iiiiiiii
select * from v_d order by id;
----
100001 100 200 1 701 805 1 2124
100002 100 200 2 700 806 1 2124
100003 100 208 2 723 807 1 2124
100004 103 200 2 702 808 2 702

include ./cross_check.slt.part

statement ok
Expand Down Expand Up @@ -72,6 +80,16 @@ select * from v_c order by id;
100005 100 200 3 717 810 717 700 700 NULL NULL
100006 105 204 5 703 828 703 NULL NULL NULL NULL

query iiiiiiii
select * from v_d order by id;
----
100001 100 200 1 701 805 1 2124
100002 100 200 2 700 806 1 2841
100003 100 208 2 723 807 1 2841
100004 103 200 2 702 808 2 702
100005 100 200 3 717 810 1 2140
100006 105 204 5 703 828 5 703

include ./cross_check.slt.part

statement ok
Expand Down Expand Up @@ -113,6 +131,16 @@ select * from v_c order by id;
100005 100 200 1 717 810 717 723 701 806 806
100006 105 204 5 703 828 703 NULL NULL NULL NULL

query iiiiiiii
select * from v_d order by id;
----
100001 100 200 1 701 805 1 2940
100002 100 200 2 799 806 1 2940
100003 100 200 2 723 807 1 2940
100004 103 200 2 702 808 2 702
100005 100 200 1 717 810 1 2940
100006 105 204 5 703 828 5 703

include ./cross_check.slt.part

statement ok
Expand All @@ -139,6 +167,13 @@ select * from v_c order by id;
100005 100 200 1 717 810 717 701 701 NULL NULL
100006 105 204 5 703 828 703 NULL NULL NULL NULL

query iiiiiiii
select * from v_d order by id;
----
100001 100 200 1 701 805 1 1418
100005 100 200 1 717 810 1 1418
100006 105 204 5 703 828 5 703

include ./cross_check.slt.part

include ./teardown.slt.part
Loading

0 comments on commit 1ca5ea4

Please sign in to comment.