Changeset: 6a21380b2ec3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6a21380b2ec3
Modified Files:
        sql/server/rel_dump.c
        sql/server/rel_optimizer.c
        sql/test/Tests/order_by_complex_exp.test
        sql/test/miscellaneous/Tests/groupby_error.test
        sql/test/miscellaneous/Tests/groupby_expressions.test
        sql/test/miscellaneous/Tests/simple_plans.test
        sql/test/miscellaneous/Tests/simple_selects.test
        sql/test/miscellaneous/Tests/unique_keys.test
Branch: properties
Log Message:

Approving tests with deducted properties. Small fixes


diffs (truncated from 475 to 300 lines):

diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -323,10 +323,10 @@ exp_print(mvc *sql, stream *fout, sql_ex
                mnstr_printf(fout, " NOT NULL");
        if (e->type != e_atom && e->type != e_cmp && is_unique(e))
                mnstr_printf(fout, " UNIQUE");
-       if (e->p && !(GDKdebug & FORCEMITOMASK)) {
+       if (e->p) {
                for (prop *p = e->p; p; p = p->p) {
-                       /* don't show min/max on atoms */
-                       if (e->type != e_atom || (p->kind != PROP_MIN && 
p->kind != PROP_MAX)) {
+                       /* Don't show min/max on atoms, or when running tests 
with forcemito */
+                       if (e->type != e_atom && (!(GDKdebug & FORCEMITOMASK) 
|| (p->kind != PROP_MIN && p->kind != PROP_MAX))) {
                                char *pv = propvalue2string(sql->ta, p);
                                mnstr_printf(fout, " %s %s", 
propkind2string(p), pv);
                        }
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -24,7 +24,6 @@ rel_properties(visitor *v, sql_rel *rel)
        /* Don't flag any changes here! */
        gp->cnt[(int)rel->op]++;
        gp->needs_distinct |= need_distinct(rel);
-       gp->has_special_modify = is_modify(rel->op) && rel->flag&UPD_COMP;
        if (gp->instantiate && is_basetable(rel->op)) {
                mvc *sql = v->sql;
                sql_table *t = (sql_table *) rel->l;
@@ -748,7 +747,8 @@ run_optimizer_set(visitor *v, sql_optimi
 sql_rel *
 rel_optimizer(mvc *sql, sql_rel *rel, int profile, int instantiate, int 
value_based_opt, int storage_based_opt)
 {
-       global_props gp = (global_props) {.cnt = {0}, .instantiate = 
(uint8_t)instantiate, .opt_cycle = 0};
+       global_props gp = (global_props) {.cnt = {0}, .instantiate = 
(uint8_t)instantiate, .opt_cycle = 0,
+                                                                         
.has_special_modify = rel && is_modify(rel->op) && rel->flag&UPD_COMP};
        visitor v = { .sql = sql, .value_based_opt = value_based_opt, 
.storage_based_opt = storage_based_opt, .changes = 1, .data = &gp };
 
        if (!(rel = rel_keep_renames(sql, rel)))
@@ -757,7 +757,7 @@ rel_optimizer(mvc *sql, sql_rel *rel, in
        sql->runs = !(GDKdebug & FORCEMITOMASK) && profile ? sa_zalloc(sql->sa, 
NSQLREWRITERS * sizeof(sql_optimizer_run)) : NULL;
        for ( ;rel && gp.opt_cycle < 20 && v.changes; gp.opt_cycle++) {
                v.changes = 0;
-               gp = (global_props) {.cnt = {0}, .instantiate = 
(uint8_t)instantiate, .opt_cycle = gp.opt_cycle};
+               gp = (global_props) {.cnt = {0}, .instantiate = 
(uint8_t)instantiate, .opt_cycle = gp.opt_cycle, .has_special_modify = 
gp.has_special_modify};
                rel = rel_visitor_topdown(&v, rel, &rel_properties); /* collect 
relational tree properties */
                gp.opt_level = calculate_opt_level(sql, rel);
                if (gp.opt_level == 0 && !gp.needs_mergetable_rewrite)
diff --git a/sql/test/Tests/order_by_complex_exp.test 
b/sql/test/Tests/order_by_complex_exp.test
--- a/sql/test/Tests/order_by_complex_exp.test
+++ b/sql/test/Tests/order_by_complex_exp.test
@@ -45,7 +45,7 @@ project (
 | group by (
 | | table("sys"."test02") [ "test02"."col1" NOT NULL ]
 | ) [ "test02"."col1" NOT NULL ] [ "test02"."col1" NOT NULL, "sys"."count"() 
NOT NULL as "%1"."%1" ]
-) [ "test02"."col1" NOT NULL ] [ "%1"."%1" ASC NOT NULL, "test02"."col1" ASC 
NOT NULL ]
+) [ "test02"."col1" NOT NULL UNIQUE ] [ "%1"."%1" ASC NOT NULL, 
"test02"."col1" ASC NOT NULL UNIQUE ]
 
 query T rowsort
 select col1
diff --git a/sql/test/miscellaneous/Tests/groupby_error.test 
b/sql/test/miscellaneous/Tests/groupby_error.test
--- a/sql/test/miscellaneous/Tests/groupby_error.test
+++ b/sql/test/miscellaneous/Tests/groupby_error.test
@@ -402,9 +402,9 @@ group by
 project (
 | group by (
 | | left outer join (
-| | | table("sys"."tab1") [ "tab1"."part" as "myalias0"."part", "tab1"."tet" 
as "myalias0"."tet" ],
-| | | table("sys"."tab2") [ "tab2"."myk" as "myalias1"."myk", "tab2"."ups" as 
"myalias1"."ups" ]
-| | ) [ ("myalias0"."part") = ("myalias1"."myk") ]
+| | | table("sys"."tab1") [ "tab1"."part" UNIQUE as "myalias0"."part", 
"tab1"."tet" UNIQUE as "myalias0"."tet" ],
+| | | table("sys"."tab2") [ "tab2"."myk" as "myalias1"."myk", "tab2"."ups" 
UNIQUE as "myalias1"."ups" ]
+| | ) [ ("myalias0"."part" UNIQUE) = ("myalias1"."myk") ]
 | ) [ "myalias1"."ups", "myalias0"."part", "myalias0"."tet" as "track" ] [ 
"myalias0"."part", "track", "sys"."count"() NOT NULL as "%1"."%1" ]
 ) [ "myalias0"."part", "track" as "tet", "%1"."%1" NOT NULL as "mycount", 
"track" ]
 
diff --git a/sql/test/miscellaneous/Tests/groupby_expressions.test 
b/sql/test/miscellaneous/Tests/groupby_expressions.test
--- a/sql/test/miscellaneous/Tests/groupby_expressions.test
+++ b/sql/test/miscellaneous/Tests/groupby_expressions.test
@@ -28,7 +28,7 @@ project (
 | | | table("sys"."groupings") [ "groupings"."aa" ]
 | | ) [ bigint(33)["groupings"."aa"] as "%2"."%2", "sys"."sql_add"("%2"."%2", 
bigint(33) "1") as "%1"."%1" ]
 | ) [ "%1"."%1" ] [ "%1"."%1" ]
-) [ "%1"."%1" ]
+) [ "%1"."%1" UNIQUE ]
 
 query I rowsort
 select cast(("aa"+1) + ("bb"+1) as bigint) from "groupings" group by "aa"+1, 
"bb"+1
diff --git a/sql/test/miscellaneous/Tests/simple_plans.test 
b/sql/test/miscellaneous/Tests/simple_plans.test
--- a/sql/test/miscellaneous/Tests/simple_plans.test
+++ b/sql/test/miscellaneous/Tests/simple_plans.test
@@ -25,7 +25,7 @@ project (
 | | | table("sys"."myy") [ "myy"."col1", "myy"."col2" ]
 | | ) [ "sys"."sql_add"(bigint(33)["myy"."col1"], bigint(33)["myy"."col2"]) as 
"%1"."%1" ]
 | ) [ "%1"."%1" ] [ "%1"."%1" ]
-) [ "%1"."%1" ] [ "%1"."%1" ASC ]
+) [ "%1"."%1" UNIQUE ] [ "%1"."%1" ASC UNIQUE ]
 
 query T nosort
 plan select col2 from myy order by col1 ASC, col1 DESC
@@ -49,27 +49,27 @@ plan select * from myx where x in ('1aea
 ----
 project (
 | select (
-| | table("sys"."myx") [ "myx"."x", "myx"."y" ]
-| ) [ (("myx"."x") = (uuid[char(32) "1aea00e5db6e0810b554fde31d961965"] NOT 
NULL)) or (("myx"."y") = (uuid[char(32) "1aea00e5db6e0810b554fde31d961965"] NOT 
NULL)) ]
-) [ "myx"."x", "myx"."y" ]
+| | table("sys"."myx") [ "myx"."x" NOT NULL, "myx"."y" NOT NULL ]
+| ) [ (("myx"."x" NOT NULL) = (uuid[char(32) 
"1aea00e5db6e0810b554fde31d961965"] NOT NULL)) or (("myx"."y" NOT NULL) = 
(uuid[char(32) "1aea00e5db6e0810b554fde31d961965"] NOT NULL)) ]
+) [ "myx"."x" NOT NULL, "myx"."y" NOT NULL ]
 
 query T nosort
 plan select * from myx where x in ('1aea00e5db6e0810b554fde31d961965') or y is 
null
 ----
 project (
 | select (
-| | table("sys"."myx") [ "myx"."x", "myx"."y" ]
-| ) [ (("myx"."x") = (uuid[char(32) "1aea00e5db6e0810b554fde31d961965"] NOT 
NULL)) or (("myx"."y") * = (uuid NULL)) ]
-) [ "myx"."x", "myx"."y" ]
+| | table("sys"."myx") [ "myx"."x" NOT NULL, "myx"."y" NOT NULL ]
+| ) [ (("myx"."x" NOT NULL) = (uuid[char(32) 
"1aea00e5db6e0810b554fde31d961965"] NOT NULL)) or (("myx"."y" NOT NULL) * = 
(uuid NULL)) ]
+) [ "myx"."x" NOT NULL, "myx"."y" NOT NULL ]
 
 query T nosort
 plan select * from myx where x in ('1aea00e5db6e0810b554fde31d961965', 
'1aea00e5db6e0810b554fde31d961966') or y = '1aea00e5db6e0810b554fde31d961967'
 ----
 project (
 | select (
-| | table("sys"."myx") [ "myx"."x", "myx"."y" ]
-| ) [ (("myx"."x") in (uuid[char(32) "1aea00e5db6e0810b554fde31d961965"] NOT 
NULL, uuid[char(32) "1aea00e5db6e0810b554fde31d961966"] NOT NULL)) or 
(("myx"."y") = (uuid[char(32) "1aea00e5db6e0810b554fde31d961967"] NOT NULL)) ]
-) [ "myx"."x", "myx"."y" ]
+| | table("sys"."myx") [ "myx"."x" NOT NULL, "myx"."y" NOT NULL ]
+| ) [ (("myx"."x" NOT NULL) in (uuid[char(32) 
"1aea00e5db6e0810b554fde31d961965"] NOT NULL, uuid[char(32) 
"1aea00e5db6e0810b554fde31d961966"] NOT NULL)) or (("myx"."y" NOT NULL) = 
(uuid[char(32) "1aea00e5db6e0810b554fde31d961967"] NOT NULL)) ]
+) [ "myx"."x" NOT NULL, "myx"."y" NOT NULL ]
 
 statement ok
 insert into myx values ('1aea00e5db6e0810b554fde31d961965', 
'1aea00e5db6e0810b554fde31d961967')
@@ -155,12 +155,12 @@ project (
 ) [ tinyint(1) "1" ]
 
 query T nosort
-plan select 1 from tab0 where col1 <> 1 and col1 <> 81 and (col2 < 0)
+plan select 1 from tab0 where col1 <> 1 and col1 <> 81 and (col2 < 100)
 ----
 project (
 | select (
 | | table("sys"."tab0") [ "tab0"."col1", "tab0"."col2" ]
-| ) [ ("tab0"."col2") < (int(32) "0"), ("tab0"."col1") notin (int(32) "1", 
int(32) "81") ]
+| ) [ ("tab0"."col2") < (int(32) "100"), ("tab0"."col1") notin (int(32) "1", 
int(32) "81") ]
 ) [ tinyint(1) "1" ]
 
 query T nosort
@@ -182,12 +182,12 @@ project (
 ) [ tinyint(1) "1" ]
 
 query T nosort
-plan select 1 from tab0 where ((col1 <> 1 and col1 <> 81) or col2 = 100) and 
(col1 <> 100)
+plan select 1 from tab0 where ((col1 <> 1 and col1 <> 81) or col2 = 100) and 
(col1 <> 47)
 ----
 project (
 | select (
 | | table("sys"."tab0") [ "tab0"."col1", "tab0"."col2" ]
-| ) [ ("tab0"."col1") != (int(32) "100"), (("tab0"."col1") notin (int(32) "1", 
int(32) "81")) or (("tab0"."col2") = (int(32) "100")) ]
+| ) [ ("tab0"."col1") != (int(32) "47"), (("tab0"."col1") notin (int(32) "1", 
int(32) "81")) or (("tab0"."col2") = (int(32) "100")) ]
 ) [ tinyint(1) "1" ]
 
 statement ok
@@ -392,16 +392,16 @@ project (
 | | | left outer join (
 | | | | join (
 | | | | | project (
-| | | | | | table("sys"."tabel1") [ "tabel1"."id_nr" as "a"."id_nr" ]
-| | | | | ) [ "a"."id_nr" as "s"."id_nr" ],
+| | | | | | table("sys"."tabel1") [ "tabel1"."id_nr" UNIQUE as "a"."id_nr" ]
+| | | | | ) [ "a"."id_nr" UNIQUE as "s"."id_nr" ],
 | | | | | project (
 | | | | | | table("sys"."tabel2") [ "tabel2"."id_nr" as "a"."id_nr" ]
 | | | | | ) [ "a"."id_nr" as "h"."id_nr" ]
-| | | | ) [ ("s"."id_nr") = ("h"."id_nr") ],
+| | | | ) [ ("s"."id_nr" UNIQUE) = ("h"."id_nr") ],
 | | | | table("sys"."tabel2") [ "tabel2"."id_nr" as "a"."id_nr" ]
-| | | ) [ ("h"."id_nr") = ("a"."id_nr") ]
-| | ) [ "s"."id_nr" ]
-| ) [ ("a"."id_nr") = ("s"."id_nr") ]
+| | | ) [ ("h"."id_nr" NOT NULL) = ("a"."id_nr") ]
+| | ) [ "s"."id_nr" NOT NULL ]
+| ) [ ("a"."id_nr") = ("s"."id_nr" NOT NULL) ]
 ) [ tinyint(1) "1" ]
 
 statement ok
@@ -437,10 +437,10 @@ plan select i1.i, i2.i from integers i1 
 ----
 project (
 | full outer join (
-| | table("sys"."integers") [ "integers"."i" as "i1"."i" ],
-| | table("sys"."integers") [ "integers"."i" as "i2"."i" ]
-| ) [ ("i1"."i") * = ("i2"."i") ]
-) [ "i1"."i", "i2"."i" ]
+| | table("sys"."integers") [ "integers"."i" UNIQUE as "i1"."i" ],
+| | table("sys"."integers") [ "integers"."i" UNIQUE as "i2"."i" ]
+| ) [ ("i1"."i" UNIQUE) * = ("i2"."i" UNIQUE) ]
+) [ "i1"."i" UNIQUE, "i2"."i" UNIQUE ]
 
 query II rowsort
 select i1.i, i2.i from integers i1 full outer join integers i2 on (i1.i is 
null and i2.i is null) or i1.i = i2.i
@@ -459,9 +459,9 @@ plan select i, j from integers where i =
 ----
 project (
 | select (
-| | table("sys"."integers") [ "integers"."i", "integers"."j" ]
-| ) [ ("integers"."i") * = ("integers"."j") ]
-) [ "integers"."i", "integers"."j" ]
+| | table("sys"."integers") [ "integers"."i" UNIQUE, "integers"."j" ]
+| ) [ ("integers"."i" UNIQUE) * = ("integers"."j") ]
+) [ "integers"."i" UNIQUE, "integers"."j" ]
 
 query II rowsort
 select i, j from integers where i = j or (i is null and j is null)
@@ -506,7 +506,7 @@ project (
 | | ) [ ("t1"."a") = ("t2"."a") ],
 | | table("sys"."t3") [ "t3"."b" ]
 | ) [ ("t1"."b") FILTER "sys"."like"("t3"."b", clob "", boolean(1) "false") ]
-) [ "t1"."a", "t1"."b" ]
+) [ "t1"."a" NOT NULL, "t1"."b" ]
 
 query T python .explain.function_histogram
 explain select t1.a, t1.b from t1 inner join t2 on t1.a = t2.a inner join t3 
on t1.b like t3.b
@@ -546,17 +546,17 @@ project (
 | | | | select (
 | | | | | table("sys"."t1") [ "t1"."a" ]
 | | | | ) [ ("t1"."a") > (int(32) "2") ]
-| | | ) [ "t1"."a" as "b", "sys"."sql_div"("t1"."a", tinyint(2) "3") as "c" ]
-| | ) [ "b" as "x"."x", "c" as "x"."y" ],
+| | | ) [ "t1"."a" NOT NULL as "b", "sys"."sql_div"("t1"."a" NOT NULL, 
tinyint(2) "3") NOT NULL as "c" ]
+| | ) [ "b" NOT NULL as "x"."x", "c" NOT NULL as "x"."y" ],
 | | project (
 | | | project (
 | | | | select (
 | | | | | table("sys"."t2") [ "t2"."a" ]
 | | | | ) [ ("t2"."a") > (int(32) "2") ]
-| | | ) [ "t2"."a" as "z", "sys"."sql_div"("t2"."a", tinyint(3) "5") as "d" ]
-| | ) [ "z" as "x"."x", "d" as "x"."y" ]
-| ) [ "x"."x", "x"."y" ]
-) [ "x"."x", "x"."y" ]
+| | | ) [ "t2"."a" NOT NULL as "z", "sys"."sql_div"("t2"."a" NOT NULL, 
tinyint(3) "5") NOT NULL as "d" ]
+| | ) [ "z" NOT NULL as "x"."x", "d" NOT NULL as "x"."y" ]
+| ) [ "x"."x" NOT NULL, "x"."y" NOT NULL ]
+) [ "x"."x" NOT NULL, "x"."y" NOT NULL ]
 
 query T nosort
 plan select x, y from (select a as b, a / 3 as c from t1 union distinct select 
a as z, a / 5 as d from t2) x(x,y) where x > 2
@@ -569,20 +569,20 @@ project (
 | | | | | select (
 | | | | | | table("sys"."t1") [ "t1"."a" ]
 | | | | | ) [ ("t1"."a") > (int(32) "2") ]
-| | | | ) [ "t1"."a" as "b", "sys"."sql_div"("t1"."a", tinyint(2) "3") as "c" ]
-| | | ) [ "b", "c" ] [ "b", "c" ]
-| | ) [ "b" as "x"."x", "c" as "x"."y" ],
+| | | | ) [ "t1"."a" NOT NULL as "b", "sys"."sql_div"("t1"."a" NOT NULL, 
tinyint(2) "3") NOT NULL as "c" ]
+| | | ) [ "b" NOT NULL, "c" NOT NULL ] [ "b" NOT NULL, "c" NOT NULL ]
+| | ) [ "b" NOT NULL as "x"."x", "c" NOT NULL as "x"."y" ],
 | | project (
 | | | group by (
 | | | | project (
 | | | | | select (
 | | | | | | table("sys"."t2") [ "t2"."a" ]
 | | | | | ) [ ("t2"."a") > (int(32) "2") ]
-| | | | ) [ "t2"."a" as "z", "sys"."sql_div"("t2"."a", tinyint(3) "5") as "d" ]
-| | | ) [ "z", "d" ] [ "z", "d" ]
-| | ) [ "z" as "x"."x", "d" as "x"."y" ]
-| ) [ "x"."x", "x"."y" ]
-) [ "x"."x", "x"."y" ]
+| | | | ) [ "t2"."a" NOT NULL as "z", "sys"."sql_div"("t2"."a" NOT NULL, 
tinyint(3) "5") NOT NULL as "d" ]
+| | | ) [ "z" NOT NULL, "d" NOT NULL ] [ "z" NOT NULL, "d" NOT NULL ]
+| | ) [ "z" NOT NULL as "x"."x", "d" NOT NULL as "x"."y" ]
+| ) [ "x"."x" NOT NULL, "x"."y" NOT NULL ]
+) [ "x"."x" NOT NULL, "x"."y" NOT NULL ]
 
 statement ok
 rollback
@@ -599,7 +599,7 @@ project (
 | | select (
 | | |  [  [ tinyint(2) "1", tinyint(2) "2", tinyint(2) "3" ] as "x"."x" ]
 | | ) [ ("x"."x") > (tinyint(2) "2") ]
-| ) [ "x"."x" ] [ "x"."x" ]
+| ) [ "x"."x" ] [ "x"."x" NOT NULL ]
 ) [ tinyint(1) "1" ]
 
 query T nosort
@@ -610,8 +610,8 @@ project (
 | | select (
 | | |  [  [ tinyint(2) "1", tinyint(2) "2", tinyint(2) "3" ] as "x"."x" ]
 | | ) [ ("x"."x") > (tinyint(2) "2") ]
-| ) [ "x"."x" ] [ "sys"."max" no nil ("x"."x") as "%5"."%5" ]
-) [ "%5"."%5" as "x"."y" ]
+| ) [ "x"."x" ] [ "sys"."max" no nil ("x"."x" NOT NULL) NOT NULL as "%5"."%5" ]
+) [ "%5"."%5" NOT NULL as "x"."y" ]
 
 # here the select cannot be pushed down
 query T nosort
@@ -623,4 +623,4 @@ project (
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to