Changeset: 9e7c6d4e336d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9e7c6d4e336d
Modified Files:
sql/server/rel_optimizer.c
sql/test/BugTracker-2010/Tests/ORDER_BY_over_UNION_EXCEPT_INTERSECT.Bug-2606.stable.out
Branch: Jan2014
Log Message:
fixed problem with rel_distinct_project2groupby
diffs (240 lines):
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
@@ -1994,14 +1994,16 @@ rel_distinct_project2groupby(int *change
node *n;
list *exps = new_exp_list(sql->sa), *gbe =
new_exp_list(sql->sa);
+ rel->l = rel_project(sql->sa, rel->l, rel->exps);
+
for (n = rel->exps->h; n; n = n->next) {
sql_exp *e = n->data;
if (e->card > CARD_ATOM) { /* no need to group by on
constants */
- append(gbe, e);
if (!exp_name(e))
exp_label(sql->sa, e, ++sql->label);
e = exp_column(sql->sa, exp_relname(e),
exp_name(e), exp_subtype(e), exp_card(e), has_nil(e), 0);
+ append(gbe, e);
}
append(exps, e);
}
diff --git
a/sql/test/BugTracker-2010/Tests/ORDER_BY_over_UNION_EXCEPT_INTERSECT.Bug-2606.stable.out
b/sql/test/BugTracker-2010/Tests/ORDER_BY_over_UNION_EXCEPT_INTERSECT.Bug-2606.stable.out
---
a/sql/test/BugTracker-2010/Tests/ORDER_BY_over_UNION_EXCEPT_INTERSECT.Bug-2606.stable.out
+++
b/sql/test/BugTracker-2010/Tests/ORDER_BY_over_UNION_EXCEPT_INTERSECT.Bug-2606.stable.out
@@ -61,14 +61,18 @@ Ready.
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| distinct union (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | group by (
-| | | table(sys.t2606b) [ t2606b.a ] COUNT
+| | | project (
+| | | | table(sys.t2606b) [ t2606b.a ] COUNT
+| | | ) [ t2606b.a ]
| | ) [ t2606b.a ] [ t2606b.a ]
| ) [ t2606a.a as L.a ]
) [ L.a ] [ L.a ASC ]
@@ -90,14 +94,18 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| distinct union (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | group by (
-| | | table(sys.t2606b) [ t2606b.a ] COUNT
+| | | project (
+| | | | table(sys.t2606b) [ t2606b.a ] COUNT
+| | | ) [ t2606b.a ]
| | ) [ t2606b.a ] [ t2606b.a ]
| ) [ t2606a.a as L.a ]
) [ L.a ] [ L.a ASC ]
@@ -119,14 +127,18 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| distinct union (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | group by (
-| | | table(sys.t2606b) [ t2606b.a ] COUNT
+| | | project (
+| | | | table(sys.t2606b) [ t2606b.a ] COUNT
+| | | ) [ t2606b.a ]
| | ) [ t2606b.a ] [ t2606b.a ]
| ) [ t2606a.a as L.a ]
) [ L.a ] [ L.a ASC ]
@@ -148,11 +160,13 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| except (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | project (
| | | table(sys.t2606b) [ t2606b.a ] COUNT
@@ -171,11 +185,13 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| except (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | project (
| | | table(sys.t2606b) [ t2606b.a ] COUNT
@@ -194,11 +210,13 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| except (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | project (
| | | table(sys.t2606b) [ t2606b.a ] COUNT
@@ -217,11 +235,13 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| intersect (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | project (
| | | table(sys.t2606b) [ t2606b.a ] COUNT
@@ -240,11 +260,13 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| intersect (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | project (
| | | table(sys.t2606b) [ t2606b.a ] COUNT
@@ -263,11 +285,13 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| intersect (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | project (
| | | table(sys.t2606b) [ t2606b.a ] COUNT
@@ -286,14 +310,18 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| distinct union (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | group by (
-| | | table(sys.t2606b) [ t2606b.a ] COUNT
+| | | project (
+| | | | table(sys.t2606b) [ t2606b.a ] COUNT
+| | | ) [ t2606b.a ]
| | ) [ t2606b.a ] [ t2606b.a ]
| ) [ t2606a.a as t.a ]
) [ t.a ] [ t.a ASC ]
@@ -315,11 +343,13 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| except (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | project (
| | | table(sys.t2606b) [ t2606b.a ] COUNT
@@ -338,11 +368,13 @@ project (
% .plan # table_name
% rel # name
% clob # type
-% 43 # length
+% 45 # length
project (
| intersect (
| | group by (
-| | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | project (
+| | | | table(sys.t2606a) [ t2606a.a ] COUNT
+| | | ) [ t2606a.a ]
| | ) [ t2606a.a ] [ t2606a.a ],
| | project (
| | | table(sys.t2606b) [ t2606b.a ] COUNT
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list