Update of /cvsroot/monetdb/pathfinder/compiler/algebra/map
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11089/algebra/map
Modified Files:
intro_proxy.c map_unq_names.c
Log Message:
-- First steps to get rid of bit-encoded column names:
o The planner and the MIL generation do not rely
on bit-encoded columns anymore.
o A global counter allows to assign new column names
without the need to analyze the plan before.
o Operator la_eqjoin_unq is only introduced in the
join pushdown phase and a normal eqjoin is available
for all other phases working on unique column names.
o Changed the required node optimization phase to cope
with unique column names.
U intro_proxy.c
Index: intro_proxy.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/intro_proxy.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- intro_proxy.c 2 Jun 2008 13:53:59 -0000 1.35
+++ intro_proxy.c 18 Jun 2008 11:24:22 -0000 1.36
@@ -98,7 +98,7 @@
/* rename the join argument in case a name conflict occurs */
if (used_cols & new_col)
new_col = PFalg_ori_name (
- PFalg_unq_name (new_col, 0),
+ PFalg_unq_name (new_col),
~used_cols);
/* project away all columns except for the join column */
@@ -811,20 +811,20 @@
/* Create 4 new column names for the two additional rowid operators
and their backmapping equi-joins */
- num_col1 = PFalg_ori_name (PFalg_unq_name (num_col, 0), ~used_cols);
+ num_col1 = PFalg_ori_name (PFalg_unq_name (num_col), ~used_cols);
used_cols = used_cols | num_col1;
- num_col2 = PFalg_ori_name (PFalg_unq_name (num_col, 0), ~used_cols);
+ num_col2 = PFalg_ori_name (PFalg_unq_name (num_col), ~used_cols);
used_cols = used_cols | num_col2;
- num_col_alias1 = PFalg_ori_name (PFalg_unq_name (num_col, 0), ~used_cols);
+ num_col_alias1 = PFalg_ori_name (PFalg_unq_name (num_col), ~used_cols);
used_cols = used_cols | num_col_alias1;
- num_col_alias2 = PFalg_ori_name (PFalg_unq_name (num_col, 0), ~used_cols);
+ num_col_alias2 = PFalg_ori_name (PFalg_unq_name (num_col), ~used_cols);
used_cols = used_cols | num_col_alias2;
/* Create a new alias for the mapping rowid operator if its
name conflicts with the column name of the sub-DAG */
if (join_att2 == num_col) {
num_col_alias = PFalg_ori_name (
- PFalg_unq_name (num_col, 0),
+ PFalg_unq_name (num_col),
~used_cols);
used_cols = used_cols | num_col_alias;
} else
@@ -1235,7 +1235,7 @@
/* Generate a new column name that will hold the values of the
new upper rowid operator... */
new_num_col = PFalg_ori_name (
- PFalg_unq_name (proxy_exit->sem.rowid.res, 0),
+ PFalg_unq_name (proxy_exit->sem.rowid.res),
~used_cols);
used_cols = used_cols | new_num_col;
@@ -1266,7 +1266,7 @@
cur_col = proxy_exit->schema.items[i].name;
if (cur_col != proxy_exit->sem.rowid.res) {
- new_col = PFalg_ori_name (PFalg_unq_name (cur_col, 0), ~used_cols);
+ new_col = PFalg_ori_name (PFalg_unq_name (cur_col), ~used_cols);
used_cols = used_cols | new_col;
lower_left_proj[i] = PFalg_proj (new_col, cur_col);
@@ -1627,7 +1627,7 @@
used_cols = used_cols | item;
/* Create a new column name for the result of the new path step. */
- item_res = PFalg_ori_name (PFalg_unq_name (att_item, 0), ~used_cols);
+ item_res = PFalg_ori_name (PFalg_unq_name (att_item), ~used_cols);
/* Get the column of the resulting item column of the step */
if (proj) {
@@ -1928,7 +1928,7 @@
/* Generate a new column name that will hold the values of the
new nested rowid operator... */
new_num_col = PFalg_ori_name (
- PFalg_unq_name (num_col, 0),
+ PFalg_unq_name (num_col),
~used_cols);
used_cols = used_cols | new_num_col;
@@ -1939,11 +1939,11 @@
/* In addition create two names for mapping the old as well
as the new rowid operators... */
new_num_col_alias = PFalg_ori_name (
- PFalg_unq_name (num_col, 0),
+ PFalg_unq_name (num_col),
~used_cols);
used_cols = used_cols | new_num_col_alias;
num_col_alias = PFalg_ori_name (
- PFalg_unq_name (num_col, 0),
+ PFalg_unq_name (num_col),
~used_cols);
used_cols = used_cols | num_col_alias;
@@ -2026,7 +2026,7 @@
if (j == base_count) {
/* create new column name */
PFalg_att_t new_exit_col = PFalg_ori_name (
- PFalg_unq_name (entry_col, 0),
+ PFalg_unq_name (entry_col),
~used_cols);
used_cols = used_cols | new_exit_col;
/* add column to the list of new columns */
@@ -2702,9 +2702,9 @@
/* Generate two new column names from the list
of 'remaining' column names. */
- num_col1 = PFalg_ori_name (PFalg_unq_name (att_iter, 0), ~used_cols);
+ num_col1 = PFalg_ori_name (PFalg_unq_name (att_iter), ~used_cols);
used_cols = used_cols | num_col1;
- num_col2 = PFalg_ori_name (PFalg_unq_name (att_iter, 0), ~used_cols);
+ num_col2 = PFalg_ori_name (PFalg_unq_name (att_iter), ~used_cols);
/* used_cols = used_cols | num_col2; */
/* create overall rowid operator */
U map_unq_names.c
Index: map_unq_names.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/map_unq_names.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- map_unq_names.c 30 May 2008 09:41:09 -0000 1.34
+++ map_unq_names.c 18 Jun 2008 11:24:22 -0000 1.35
@@ -270,54 +270,60 @@
{
/* Prepare a projection list for both operands
to ensure the correct names of all columns. */
- PFla_op_t *left,
- *right;
- PFarray_t *lproj,
- *rproj;
- PFalg_att_t ori,
- unq,
- l_unq,
- r_unq,
- att1_unq,
- att2_unq;
+ PFla_op_t *left = U(L(p)),
+ *right = U(R(p));
+ PFalg_proj_t *projlist,
+ *projlist1,
+ *projlist2;
+ PFalg_att_t ori,
+ unq,
+ att1 = UNAME (p, p->sem.eqjoin.att1),
+ att2 = UNAME (p, p->sem.eqjoin.att2),
+ new_unq;
+ unsigned int count;
- left = U(L(p));
- right = U(R(p));
-
- att1_unq = PFprop_unq_name_left (p->prop, p->sem.eqjoin.att1);
- att2_unq = PFprop_unq_name_right (p->prop, p->sem.eqjoin.att2);
-
- lproj = PFarray (sizeof (PFalg_proj_t), left->schema.count);
- rproj = PFarray (sizeof (PFalg_proj_t), right->schema.count);
-
- *(PFalg_proj_t *) PFarray_add (lproj)
- = proj (UNAME(p, p->sem.eqjoin.att1), att1_unq);
- *(PFalg_proj_t *) PFarray_add (rproj)
- = proj (UNAME(p, p->sem.eqjoin.att2), att2_unq);
+ projlist = PFmalloc (p->schema.count * sizeof (PFalg_proj_t));
+ projlist1 = PFmalloc (left->schema.count * sizeof (PFalg_proj_t));
+ projlist2 = PFmalloc (right->schema.count * sizeof (PFalg_proj_t));
+ assert (att1 == att2);
+ /* Replace att2 by a new column name to ensure that
+ the join columns use a different column name. */
+ att2 = PFalg_new_name (att2);
+
for (unsigned int i = 0; i < left->schema.count; i++) {
- l_unq = left->schema.items[i].name;
- ori = PFprop_ori_name_left (p->prop, l_unq);
+ unq = left->schema.items[i].name;
+ ori = PFprop_ori_name_left (p->prop, unq);
assert (ori);
-
- unq = UNAME(p, ori);
- if (l_unq != att1_unq)
- *(PFalg_proj_t *) PFarray_add (lproj) = proj (unq, l_unq);
+ projlist1[i] = proj (UNAME(p, ori), unq);
}
for (unsigned int i = 0; i < right->schema.count; i++) {
- r_unq = right->schema.items[i].name;
- ori = PFprop_ori_name_right (p->prop, r_unq);
+ unq = right->schema.items[i].name;
+ ori = PFprop_ori_name_right (p->prop, unq);
assert (ori);
-
- unq = UNAME(p, ori);
- if (r_unq != att2_unq)
- *(PFalg_proj_t *) PFarray_add (rproj) = proj (unq, r_unq);
+ new_unq = UNAME(p, ori);
+ if (new_unq == att1)
+ projlist2[i] = proj (att2, unq);
+ else
+ projlist2[i] = proj (new_unq, unq);
}
- /* create a join operator that comes with two internal
- projection lists */
- res = PFla_eqjoin_clone (left, right, lproj, rproj);
+ res = eqjoin (PFla_project_ (left, left->schema.count, projlist1),
+ PFla_project_ (right, right->schema.count,
projlist2),
+ att1,
+ att2);
+
+ /* Make sure that the new column name att2 is not visible.
+ (Otherwise some mapping might fail due to the missing
+ properties collected for that column.) */
+ count = 0;
+ for (unsigned int i = 0; i < res->schema.count; i++) {
+ unq = res->schema.items[i].name;
+ if (unq != att2)
+ projlist[count++] = proj (unq, unq);
+ }
+ res = PFla_project_ (res, count, projlist);
} break;
case la_eqjoin_unq:
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins