Changeset: faf3deaa31c4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/faf3deaa31c4 Added Files: sql/test/rel-optimizers/Tests/merge-unions-base.test sql/test/rel-optimizers/Tests/merge-unions.reqtests sql/test/rel-optimizers/Tests/merge-unions.test Modified Files: sql/test/rel-optimizers/Tests/All Branch: default Log Message:
Adds tests from merge_unions opt diffs (truncated from 363 to 300 lines): diff --git a/sql/test/rel-optimizers/Tests/All b/sql/test/rel-optimizers/Tests/All --- a/sql/test/rel-optimizers/Tests/All +++ b/sql/test/rel-optimizers/Tests/All @@ -10,3 +10,5 @@ local-replica local-replica-with-actual-remote remote-replica-plan remote-replica +merge-unions-base +merge-unions diff --git a/sql/test/rel-optimizers/Tests/merge-unions-base.test b/sql/test/rel-optimizers/Tests/merge-unions-base.test new file mode 100644 --- /dev/null +++ b/sql/test/rel-optimizers/Tests/merge-unions-base.test @@ -0,0 +1,76 @@ +statement ok +create table f1 (n int) + +statement ok +create table f2 (n int) + +statement ok +create table f3 (n int) + +statement ok +create table f4 (n int) + +statement ok +insert into f1 values (1), (2) + +statement ok +insert into f2 values (2), (3) + +statement ok +insert into f3 values (3), (4) + +statement ok +insert into f4 values (4), (5) + +statement ok +create view f_uchain as + select * from f1 + union all + select * from f2 + union all + select * from f3 + union all + select * from f4 + +statement ok +create merge table f12 (n int) + +statement ok +alter table f12 add table f1 + +statement ok +alter table f12 add table f2 + +statement ok +create merge table f34 (n int) + +statement ok +alter table f34 add table f3 + +statement ok +alter table f34 add table f4 + +statement ok +create merge table f_merge_rec (n int) + +statement ok +alter table f_merge_rec add table f12 + +statement ok +alter table f_merge_rec add table f34 + +statement ok +create merge table f_merge (n int) + +statement ok +alter table f_merge add table f1 + +statement ok +alter table f_merge add table f2 + +statement ok +alter table f_merge add table f3 + +statement ok +alter table f_merge add table f4 + diff --git a/sql/test/rel-optimizers/Tests/merge-unions.reqtests b/sql/test/rel-optimizers/Tests/merge-unions.reqtests new file mode 100644 --- /dev/null +++ b/sql/test/rel-optimizers/Tests/merge-unions.reqtests @@ -0,0 +1,1 @@ +merge-unions-base diff --git a/sql/test/rel-optimizers/Tests/merge-unions.test b/sql/test/rel-optimizers/Tests/merge-unions.test new file mode 100644 --- /dev/null +++ b/sql/test/rel-optimizers/Tests/merge-unions.test @@ -0,0 +1,262 @@ +query I rowsort +select * from f_uchain +---- +1 +2 +2 +3 +3 +4 +4 +5 + +query T nosort +plan select * from f_uchain +---- +munion ( +| project ( +| | table("sys"."f4") [ "f4"."n" UNIQUE ] +| ) [ "f4"."n" UNIQUE as "f_uchain"."n" ], +| project ( +| | table("sys"."f3") [ "f3"."n" UNIQUE ] +| ) [ "f3"."n" UNIQUE as "f_uchain"."n" ], +| project ( +| | table("sys"."f1") [ "f1"."n" UNIQUE ] +| ) [ "f1"."n" UNIQUE as "f_uchain"."n" ], +| project ( +| | table("sys"."f2") [ "f2"."n" UNIQUE ] +| ) [ "f2"."n" UNIQUE as "f_uchain"."n" ] +) [ "f_uchain"."n" ] + +query I rowsort +select * from f_uchain +where n > 1 and n < 5 +---- +2 +2 +3 +3 +4 +4 + +query T nosort +plan select * from f_uchain + where n > 1 and n < 5 +---- +munion ( +| project ( +| | select ( +| | | table("sys"."f4") [ "f4"."n" UNIQUE ] +| | ) [ (int(2) "1") < ("f4"."n" UNIQUE) < (int(2) "5") ] +| ) [ "f4"."n" UNIQUE as "f_uchain"."n" ], +| project ( +| | select ( +| | | table("sys"."f3") [ "f3"."n" UNIQUE ] +| | ) [ (int(2) "1") < ("f3"."n" UNIQUE) < (int(2) "5") ] +| ) [ "f3"."n" UNIQUE as "f_uchain"."n" ], +| project ( +| | select ( +| | | table("sys"."f1") [ "f1"."n" UNIQUE ] +| | ) [ (int(2) "1") < ("f1"."n" UNIQUE) < (int(2) "5") ] +| ) [ "f1"."n" UNIQUE as "f_uchain"."n" ], +| project ( +| | select ( +| | | table("sys"."f2") [ "f2"."n" UNIQUE ] +| | ) [ (int(2) "1") < ("f2"."n" UNIQUE) < (int(2) "5") ] +| ) [ "f2"."n" UNIQUE as "f_uchain"."n" ] +) [ "f_uchain"."n" ] + +query II rowsort +select n, count(n) from f_uchain group by n +---- +1 +1 +2 +2 +3 +2 +4 +2 +5 +1 + +query T nosort +plan select * from f_uchain + where n > 1 and n < 5 +---- +munion ( +| project ( +| | select ( +| | | table("sys"."f4") [ "f4"."n" UNIQUE ] +| | ) [ (int(2) "1") < ("f4"."n" UNIQUE) < (int(2) "5") ] +| ) [ "f4"."n" UNIQUE as "f_uchain"."n" ], +| project ( +| | select ( +| | | table("sys"."f3") [ "f3"."n" UNIQUE ] +| | ) [ (int(2) "1") < ("f3"."n" UNIQUE) < (int(2) "5") ] +| ) [ "f3"."n" UNIQUE as "f_uchain"."n" ], +| project ( +| | select ( +| | | table("sys"."f1") [ "f1"."n" UNIQUE ] +| | ) [ (int(2) "1") < ("f1"."n" UNIQUE) < (int(2) "5") ] +| ) [ "f1"."n" UNIQUE as "f_uchain"."n" ], +| project ( +| | select ( +| | | table("sys"."f2") [ "f2"."n" UNIQUE ] +| | ) [ (int(2) "1") < ("f2"."n" UNIQUE) < (int(2) "5") ] +| ) [ "f2"."n" UNIQUE as "f_uchain"."n" ] +) [ "f_uchain"."n" ] + +query I rowsort +select * from f_merge +---- +1 +2 +2 +3 +3 +4 +4 +5 + +query T nosort +plan select * from f_merge +---- +munion ( +| project ( +| | table("sys"."f1") [ "f1"."n" UNIQUE as "f_merge"."n" ] +| ) [ "f_merge"."n" UNIQUE ], +| project ( +| | table("sys"."f2") [ "f2"."n" UNIQUE as "f_merge"."n" ] +| ) [ "f_merge"."n" UNIQUE ], +| project ( +| | table("sys"."f3") [ "f3"."n" UNIQUE as "f_merge"."n" ] +| ) [ "f_merge"."n" UNIQUE ], +| project ( +| | table("sys"."f4") [ "f4"."n" UNIQUE as "f_merge"."n" ] +| ) [ "f_merge"."n" UNIQUE ] +) [ "f_merge"."n" ] + +query T nosort +select * from f_merge +where n > 1 and n < 5 +---- +2 +2 +3 +3 +4 +4 + +query T nosort +plan select * from f_merge + where n > 1 and n < 5 +---- +munion ( +| project ( +| | select ( +| | | table("sys"."f1") [ "f1"."n" UNIQUE as "f_merge"."n" ] +| | ) [ (int(31) "1") < ("f_merge"."n" UNIQUE) < (int(31) "5") ] +| ) [ "f_merge"."n" UNIQUE ], +| project ( +| | select ( +| | | table("sys"."f2") [ "f2"."n" UNIQUE as "f_merge"."n" ] +| | ) [ (int(31) "1") < ("f_merge"."n" UNIQUE) < (int(31) "5") ] +| ) [ "f_merge"."n" UNIQUE ], +| project ( +| | select ( +| | | table("sys"."f3") [ "f3"."n" UNIQUE as "f_merge"."n" ] +| | ) [ (int(31) "1") < ("f_merge"."n" UNIQUE) < (int(31) "5") ] +| ) [ "f_merge"."n" UNIQUE ], +| project ( +| | select ( +| | | table("sys"."f4") [ "f4"."n" UNIQUE as "f_merge"."n" ] +| | ) [ (int(31) "1") < ("f_merge"."n" UNIQUE) < (int(31) "5") ] +| ) [ "f_merge"."n" UNIQUE ] +) [ "f_merge"."n" ] + +query I rowsort +select * from f_merge_rec +---- +1 +2 +2 +3 +3 +4 +4 +5 + +query T nosort +plan select * from f_merge_rec +---- +munion ( +| project ( +| | table("sys"."f1") [ "f1"."n" UNIQUE as "f_merge_rec"."n" ] +| ) [ "f_merge_rec"."n" UNIQUE ], +| project ( +| | table("sys"."f2") [ "f2"."n" UNIQUE as "f_merge_rec"."n" ] +| ) [ "f_merge_rec"."n" UNIQUE ], _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org