-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
147 additions
and
13 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,146 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
create table t1 (v1 int, v2 int); | ||
|
||
statement ok | ||
create table t2 (v1 int, v2 int); | ||
|
||
statement ok | ||
create table t3 (v1 int primary key, v2 int); | ||
|
||
statement ok | ||
create materialized view mv1 as with sub as changedlog from t1 select * from sub; | ||
|
||
statement ok | ||
create materialized view mv2 as with sub as changedlog from t2 select * from sub; | ||
|
||
statement ok | ||
create materialized view mv3 as with sub as changedlog from t1 select v1, v2 from sub; | ||
|
||
statement ok | ||
create materialized view mv4 as with sub1 as changedlog from t1, sub2 as changedlog from t2 | ||
select sub1.v1 as v11, sub1.v2 as v12, sub2.v1 as v21, sub2.v2 as v22 from sub1 inner join sub2 on sub1.v1 = sub2.v1; | ||
|
||
statement ok | ||
create materialized view mv5 as with sub1 as changedlog from t1, sub2 as changedlog from t2 | ||
select sub1.v1 as v11, sub1.v2 as v12, sub2.v1 as v21, sub2.v2 as v22, sub1.op as op1, sub2.op as op2 from sub1 inner join sub2 on sub1.v1 = sub2.v1; | ||
|
||
statement ok | ||
create materialized view mv6 as with sub as changedlog from t3 select * from sub; | ||
|
||
statement ok | ||
insert into t1 values(1,1),(2,2); | ||
|
||
statement ok | ||
insert into t2 values(1,10),(2,20); | ||
|
||
statement ok | ||
insert into t3 values(5,5),(6,6); | ||
|
||
statement ok | ||
update t1 set v2 = 100 where v1 = 1; | ||
|
||
statement ok | ||
update t2 set v2 = 100 where v1 = 1; | ||
|
||
statement ok | ||
update t3 set v2 = 500 where v1 = 5; | ||
|
||
statement ok | ||
delete from t1 where v1 = 2; | ||
|
||
query III rowsort | ||
select * from mv1 order by v1; | ||
---- | ||
1 1 1 | ||
1 1 4 | ||
1 100 3 | ||
2 2 1 | ||
2 2 2 | ||
|
||
query III rowsort | ||
select * from mv2 order by v1; | ||
---- | ||
1 10 1 | ||
1 10 4 | ||
1 100 3 | ||
2 20 1 | ||
|
||
query III rowsort | ||
select * from mv3 order by v1; | ||
---- | ||
1 1 | ||
1 1 | ||
1 100 | ||
2 2 | ||
2 2 | ||
|
||
query III rowsort | ||
select * from mv4 order by v11,v21; | ||
---- | ||
1 1 1 10 | ||
1 1 1 10 | ||
1 1 1 10 | ||
1 1 1 10 | ||
1 1 1 100 | ||
1 1 1 100 | ||
1 100 1 10 | ||
1 100 1 10 | ||
1 100 1 100 | ||
2 2 2 20 | ||
2 2 2 20 | ||
|
||
|
||
query III rowsort | ||
select * from mv5 order by v11,v21; | ||
---- | ||
1 1 1 10 1 1 | ||
1 1 1 10 1 4 | ||
1 1 1 10 4 1 | ||
1 1 1 10 4 4 | ||
1 1 1 100 1 3 | ||
1 1 1 100 4 3 | ||
1 100 1 10 3 1 | ||
1 100 1 10 3 4 | ||
1 100 1 100 3 3 | ||
2 2 2 20 1 1 | ||
2 2 2 20 2 1 | ||
|
||
query III rowsort | ||
select * from mv6 order by v1; | ||
---- | ||
5 5 1 | ||
5 5 4 | ||
5 500 3 | ||
6 6 1 | ||
|
||
|
||
statement ok | ||
drop materialized view mv6; | ||
|
||
statement ok | ||
drop materialized view mv5; | ||
|
||
statement ok | ||
drop materialized view mv4; | ||
|
||
statement ok | ||
drop materialized view mv3; | ||
|
||
statement ok | ||
drop materialized view mv2; | ||
|
||
statement ok | ||
drop materialized view mv1; | ||
|
||
|
||
statement ok | ||
drop table t3; | ||
|
||
statement ok | ||
drop table t2; | ||
|
||
statement ok | ||
drop table t1; |
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
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
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
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
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