Changeset: 18f03ffc3380 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=18f03ffc3380
Modified Files:
        sql/server/rel_optimizer.c
Branch: Jul2017
Log Message:

make sure union projection lists and the inner part are aligned also
when rewriting a join/union combination


diffs (32 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
@@ -4536,6 +4536,8 @@ rel_push_join_down_union(int *changes, m
                        nr = rel_crossproduct(sql->sa, lr, rel_dup(or), 
rel->op);
                        nl->exps = exps_copy(sql->sa, exps);
                        nr->exps = exps_copy(sql->sa, exps);
+                       nl = rel_project(sql->sa, nl, rel_projections(sql, nl, 
NULL, 1, 1));
+                       nr = rel_project(sql->sa, nr, rel_projections(sql, nr, 
NULL, 1, 1));
                        (*changes)++;
                        return rel_inplace_setop(rel, nl, nr, op_union, 
rel_projections(sql, rel, NULL, 1, 1));
                } else if (is_union(l->op) && !need_distinct(l) &&
@@ -4577,7 +4579,8 @@ rel_push_join_down_union(int *changes, m
                        nr = rel_crossproduct(sql->sa, lr, rr, rel->op);
                        nl->exps = exps_copy(sql->sa, exps);
                        nr->exps = exps_copy(sql->sa, exps);
-
+                       nl = rel_project(sql->sa, nl, rel_projections(sql, nl, 
NULL, 1, 1));
+                       nr = rel_project(sql->sa, nr, rel_projections(sql, nr, 
NULL, 1, 1));
                        (*changes)++;
                        return rel_inplace_setop(rel, nl, nr, op_union, 
rel_projections(sql, rel, NULL, 1, 1));
                } else if (!is_union(l->op) && 
@@ -4605,7 +4608,8 @@ rel_push_join_down_union(int *changes, m
                        nr = rel_crossproduct(sql->sa, rel_dup(ol), rr, 
rel->op);
                        nl->exps = exps_copy(sql->sa, exps);
                        nr->exps = exps_copy(sql->sa, exps);
-
+                       nl = rel_project(sql->sa, nl, rel_projections(sql, nl, 
NULL, 1, 1));
+                       nr = rel_project(sql->sa, nr, rel_projections(sql, nr, 
NULL, 1, 1));
                        (*changes)++;
                        return rel_inplace_setop(rel, nl, nr, op_union, 
rel_projections(sql, rel, NULL, 1, 1));
                /* {semi}join ( A1, union (A2, B)) [A1.partkey = A2.partkey] ->
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to