Changeset: e284b7016e9b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e284b7016e9b
Branch: default
Log Message:
merged
diffs (146 lines):
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -391,7 +391,6 @@ exp_atom(sql_allocator *sa, atom *a)
e->l = a;
if (!a->isnull)
set_has_no_nil(e);
- set_unique(e);
return e;
}
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
@@ -4794,9 +4794,14 @@ point_select_on_unique_column(sql_rel *r
if (is_compare(e->type) && e->flag == cmp_equal) {
if (is_numeric_upcast(el))
el = el->l;
+ if (is_numeric_upcast(er))
+ er = er->l;
if (is_alias(el->type) && exp_is_atom(er) &&
(found = rel_find_exp(rel->l, el)) &&
is_unique(found) && (!is_semantics(e)
|| !has_nil(found) || !has_nil(er)))
return true;
+ if (is_alias(er->type) && exp_is_atom(el) &&
(found = rel_find_exp(rel->l, er)) &&
+ is_unique(found) && (!is_semantics(e)
|| !has_nil(el) || !has_nil(found)))
+ return true;
}
}
}
@@ -9849,8 +9854,9 @@ rel_optimizer(mvc *sql, sql_rel *rel, in
#ifndef NDEBUG
assert(level < 20);
#endif
- /* Run the following optimizers only once after the others run to avoid
an infinite optimization loop */
- rel = rel_visitor_bottomup(&v, rel, &rel_push_select_up);
+ /* Run the following optimizers only once at the end to avoid an
infinite optimization loop */
+ if (opt == 2)
+ rel = rel_visitor_bottomup(&v, rel, &rel_push_select_up);
/* merge table rewrites may introduce remote or replica tables */
if (instantiate && (gp.needs_mergetable_rewrite ||
gp.needs_remote_replica_rewrite)) {
diff --git
a/sql/test/BugTracker-2015/Tests/crash_in_reduce_groupby.Bug-3818.test
b/sql/test/BugTracker-2015/Tests/crash_in_reduce_groupby.Bug-3818.test
--- a/sql/test/BugTracker-2015/Tests/crash_in_reduce_groupby.Bug-3818.test
+++ b/sql/test/BugTracker-2015/Tests/crash_in_reduce_groupby.Bug-3818.test
@@ -28,8 +28,8 @@ GROUP BY cods, elrik, ether, jaelen, sor
project (
| group by (
| | table("sys"."t2a") [ "t2a"."tib0" ]
-| ) [ tinyint(8) "0" as "sora" ] [ tinyint(8) "0" as "cods", tinyint(8) "0" as
"elrik", tinyint(8) "0" as "ether", tinyint(8) "0" as "jaelen", "sora" NOT NULL
UNIQUE, "sys"."min" no nil ("t2a"."tib0") as "%1"."%1" ]
-) [ "cods" NOT NULL UNIQUE, "elrik" NOT NULL UNIQUE, "ether" NOT NULL UNIQUE,
"jaelen" NOT NULL UNIQUE, "sora" NOT NULL UNIQUE, "%1"."%1" ]
+| ) [ tinyint(8) "0" as "sora" ] [ tinyint(8) "0" as "cods", tinyint(8) "0" as
"elrik", tinyint(8) "0" as "ether", tinyint(8) "0" as "jaelen", "sora" NOT
NULL, "sys"."min" no nil ("t2a"."tib0") as "%1"."%1" ]
+) [ "cods" NOT NULL, "elrik" NOT NULL, "ether" NOT NULL, "jaelen" NOT NULL,
"sora" NOT NULL, "%1"."%1" ]
statement ok
drop table t2a
diff --git
a/sql/test/BugTracker-2015/Tests/quantile_function_resolution.Bug-3773.test
b/sql/test/BugTracker-2015/Tests/quantile_function_resolution.Bug-3773.test
--- a/sql/test/BugTracker-2015/Tests/quantile_function_resolution.Bug-3773.test
+++ b/sql/test/BugTracker-2015/Tests/quantile_function_resolution.Bug-3773.test
@@ -12,7 +12,7 @@ project (
| | project (
| | | table("sys"."x") [ "x"."y" ]
| | ) [ "x"."y", double(53) "0" as "%2"."%2" ]
-| ) [ ] [ "sys"."quantile" no nil (decimal(18,3)["x"."y"], "%2"."%2" NOT NULL
UNIQUE) as "%1"."%1" ]
+| ) [ ] [ "sys"."quantile" no nil (decimal(18,3)["x"."y"], "%2"."%2" NOT
NULL) as "%1"."%1" ]
) [ "%1"."%1" ]
query T nosort
@@ -23,7 +23,7 @@ project (
| | project (
| | | table("sys"."x") [ "x"."y" ]
| | ) [ "x"."y", double(53) "0" as "%2"."%2" ]
-| ) [ ] [ "sys"."quantile" no nil (decimal(18,3)["x"."y"], "%2"."%2" NOT NULL
UNIQUE) as "%1"."%1" ]
+| ) [ ] [ "sys"."quantile" no nil (decimal(18,3)["x"."y"], "%2"."%2" NOT
NULL) as "%1"."%1" ]
) [ "%1"."%1" ]
statement ok
diff --git a/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test
b/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test
--- a/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test
+++ b/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test
@@ -61,7 +61,7 @@ statement error GDK reported error: merg
select EXISTS(select 1 from t_qh left outer join (select cast(2 as INTEGER)
from t_qh) as subq_0(c1) on true <> EXISTS(select 1 from t_qh as ref_6 where 2 <
(select subq_0.c1 as c0 from t_qh where (1 <> ref_6.c_f) or (subq_0.c1 is
NULL)))) from (select 30 from t_qh) as subq_0(c1)
-statement error GDK reported error: BATsubcross: more than one match
+statement error GDK reported error: mergejoin: more than one match
select EXISTS(select 1 from t_qh left outer join (select cast(2 as INTEGER)
from t_qh) as subq_0(c1) on 2 <> (select 1 from t_qh where EXISTS(select 3 as
c0 from t_qh as ref_6 where 2 <
(select subq_0.c1 as c0 from t_qh where (1 <> ref_6.c_f) or (subq_0.c1 is
NULL))))) from (select 30 from t_qh) as subq_0(c1)
diff --git a/sql/test/SQLancer/Tests/sqlancer17.test
b/sql/test/SQLancer/Tests/sqlancer17.test
--- a/sql/test/SQLancer/Tests/sqlancer17.test
+++ b/sql/test/SQLancer/Tests/sqlancer17.test
@@ -79,7 +79,7 @@ project (
| | | | | | [ boolean(1) "true" ]
| | | | | ) [ (tinyint(3) "4") ! <= (tinyint(1) "1") ! <= (tinyint(3) "4"),
(tinyint(2) "3") <= (tinyint(3) "4") <= (tinyint(3) "5") ]
| | | | ) [ tinyint(3) "4" as "v0"."vc0" ]
-| | | ) [ "v0"."vc0" NOT NULL UNIQUE ]
+| | | ) [ "v0"."vc0" NOT NULL ]
| | ) [ "sys"."sql_max"(tinyint(1) "1", tinyint(1) "1") NOT NULL as
"v20"."vc0" ]
| ) [ (tinyint(3) "7") > ("v20"."vc0" NOT NULL) ]
) [ tinyint(1) "1" ]
diff --git a/sql/test/SQLancer/Tests/sqlancer18.test
b/sql/test/SQLancer/Tests/sqlancer18.test
--- a/sql/test/SQLancer/Tests/sqlancer18.test
+++ b/sql/test/SQLancer/Tests/sqlancer18.test
@@ -253,7 +253,6 @@ SELECT CAST(SUM(count) AS BIGINT) FROM (
----
135
-# the hash is not right, it's a reminder it has to return 135 rows
query R rowsort
SELECT sub0.c2 FROM t2 JOIN (SELECT DISTINCT t2.c2, 3 FROM t2) AS sub0(c2,c3)
on t2.c2 = sub0.c2
----
diff --git a/sql/test/analytics/Tests/analytics00.test
b/sql/test/analytics/Tests/analytics00.test
--- a/sql/test/analytics/Tests/analytics00.test
+++ b/sql/test/analytics/Tests/analytics00.test
@@ -1891,7 +1891,7 @@ project (
| | | | table("sys"."myorders") [ "myorders"."o_totalprice" NOT NULL,
"myorders"."o_orderdate" NOT NULL ]
| | | ) [ "myorders"."o_totalprice" NOT NULL,
"sys"."day"("myorders"."o_orderdate" NOT NULL) NOT NULL as "%1"."%1" ]
| | ) [ "myorders"."o_totalprice" NOT NULL, "%1"."%1" NOT NULL ] [ "%1"."%1"
ASC NOT NULL ]
-| ) [ "%1"."%1" NOT NULL, boolean(1) "false" as "%2"."%2",
"sys"."max"("myorders"."o_totalprice" NOT NULL, "%2"."%2" NOT NULL UNIQUE,
"sys"."diff"("%1"."%1" NOT NULL), int(9) "1", "sys"."window_bound"("%1"."%1"
ASC NOT NULL, int(9) "1", int(9) "0", int(9) "0", int(32) "2"),
"sys"."window_bound"("%1"."%1" ASC NOT NULL, int(9) "1", int(9) "5", int(9)
"0", int(32) "0")) as "%3"."%3" ]
+| ) [ "%1"."%1" NOT NULL, boolean(1) "false" as "%2"."%2",
"sys"."max"("myorders"."o_totalprice" NOT NULL, "%2"."%2" NOT NULL,
"sys"."diff"("%1"."%1" NOT NULL), int(9) "1", "sys"."window_bound"("%1"."%1"
ASC NOT NULL, int(9) "1", int(9) "0", int(9) "0", int(32) "2"),
"sys"."window_bound"("%1"."%1" ASC NOT NULL, int(9) "1", int(9) "5", int(9)
"0", int(32) "0")) as "%3"."%3" ]
) [ "%3"."%3" ]
query R rowsort
@@ -1910,7 +1910,7 @@ project (
| | | | table("sys"."myorders") [ "myorders"."o_totalprice" NOT NULL,
"myorders"."o_orderdate" NOT NULL ]
| | | ) [ "myorders"."o_totalprice" NOT NULL,
"sys"."year"("myorders"."o_orderdate" NOT NULL) NOT NULL as "%1"."%1" ]
| | ) [ "myorders"."o_totalprice" NOT NULL, "%1"."%1" NOT NULL ] [ "%1"."%1"
ASC NOT NULL ]
-| ) [ "%1"."%1" NOT NULL, boolean(1) "false" as "%2"."%2",
"sys"."diff"("%1"."%1" NOT NULL) as "%3"."%3",
"sys"."count"("myorders"."o_totalprice" NOT NULL, boolean(1) "true", "%2"."%2"
NOT NULL UNIQUE, "sys"."diff"("%1"."%1" NOT NULL), int(9) "2",
"sys"."window_bound"("%3"."%3", int(9) "2", int(9) "0", int(9) "0", tinyint(2)
"2"), "sys"."window_bound"("%3"."%3", int(9) "2", int(9) "3", int(9) "0",
bigint(64) "9223372036854775807")) as "%4"."%4" ]
+| ) [ "%1"."%1" NOT NULL, boolean(1) "false" as "%2"."%2",
"sys"."diff"("%1"."%1" NOT NULL) as "%3"."%3",
"sys"."count"("myorders"."o_totalprice" NOT NULL, boolean(1) "true", "%2"."%2"
NOT NULL, "sys"."diff"("%1"."%1" NOT NULL), int(9) "2",
"sys"."window_bound"("%3"."%3", int(9) "2", int(9) "0", int(9) "0", tinyint(2)
"2"), "sys"."window_bound"("%3"."%3", int(9) "2", int(9) "3", int(9) "0",
bigint(64) "9223372036854775807")) as "%4"."%4" ]
) [ "%4"."%4" ]
query I rowsort
diff --git a/sql/test/miscellaneous/Tests/simple_selects.test
b/sql/test/miscellaneous/Tests/simple_selects.test
--- a/sql/test/miscellaneous/Tests/simple_selects.test
+++ b/sql/test/miscellaneous/Tests/simple_selects.test
@@ -670,8 +670,8 @@ project (
| | project (
| | | [ boolean(1) "true" ]
| | ) [ tinyint(1) "1" as "x"."x" ]
-| ) [ "x"."x" NOT NULL UNIQUE as "z" ] [ "z" NOT NULL UNIQUE ]
-) [ "z" NOT NULL UNIQUE, tinyint(2) "2" ]
+| ) [ "x"."x" NOT NULL as "z" ] [ "z" NOT NULL ]
+) [ "z" NOT NULL, tinyint(2) "2" ]
statement error
select x as z, y as z from (select 1, 2) as x(x,y) group by z
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list