Update of /cvsroot/monetdb/pathfinder/compiler/algebra/map
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25955/algebra/map
Modified Files:
map_ori_names.c map_unq_names.c
Log Message:
-- Various bugfixes
* Cope with nested recursion correctly.
* Remove superfluous recursion arguments.
* Adjust the schema of the semijoin operator correctly.
Index: map_ori_names.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/map_ori_names.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- map_ori_names.c 4 Jan 2007 15:26:18 -0000 1.9
+++ map_ori_names.c 13 Feb 2007 16:44:26 -0000 1.10
@@ -597,8 +597,22 @@
break;
case la_rec_param:
- res = rec_param (O(L(p)), O(R(p)));
- break;
+ {
+ PFla_op_t *arg = NULL;
+
+ /* In case the recursion argument is not referenced anymore
+ we can safely throw it away. */
+ for (unsigned int i = 0; i < PFarray_last (map); i++)
+ if (((ori_unq_map *) PFarray_at (map, i))->unq == L(p)) {
+ arg = ((ori_unq_map *) PFarray_at (map, i))->ori;
+ break;
+ }
+
+ if (arg)
+ res = rec_param (arg, O(R(p)));
+ else
+ res = O(R(p));
+ } break;
case la_rec_nil:
res = rec_nil ();
@@ -611,6 +625,7 @@
(Schema L -> Schema Base and Schema R -> Schema Base)
if necessary. */
{
+ PFla_op_t *base = NULL;
PFalg_att_t unq, base_ori, seed_ori, rec_ori;
unsigned int count = p->schema.count;
bool seed_rename = false, rec_rename = false;
@@ -636,13 +651,25 @@
rec_rename = rec_rename || (base_ori != rec_ori);
}
- res = rec_arg (seed_rename
- ? PFla_project_ (O(L(p)), count, seed_proj)
- : O(L(p)),
- rec_rename
- ? PFla_project_ (O(R(p)), count, rec_proj)
- : O(R(p)),
- O(p->sem.rec_arg.base));
+ /* In case the recursion base is not referenced anymore
+ we do not need to include the recursion argument. */
+ for (unsigned int i = 0; i < PFarray_last (map); i++)
+ if (((ori_unq_map *) PFarray_at (map, i))->unq
+ == p->sem.rec_arg.base) {
+ base = ((ori_unq_map *) PFarray_at (map, i))->ori;
+ break;
+ }
+
+ if (base)
+ res = rec_arg (seed_rename
+ ? PFla_project_ (O(L(p)), count, seed_proj)
+ : O(L(p)),
+ rec_rename
+ ? PFla_project_ (O(R(p)), count, rec_proj)
+ : O(R(p)),
+ base);
+ else
+ return;
} break;
case la_rec_base:
Index: map_unq_names.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/map/map_unq_names.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- map_unq_names.c 4 Jan 2007 15:26:18 -0000 1.10
+++ map_unq_names.c 13 Feb 2007 16:44:26 -0000 1.11
@@ -288,13 +288,26 @@
/* Transform semi-join operations into equi-joins
as these semi-joins might be superfluous as well. */
if (PFprop_set (p->prop)) {
- res = PFla_eqjoin_clone (
- U(L(p)),
- U(R(p)),
- UNAME (p, p->sem.eqjoin.att1),
- PFprop_unq_name_right (p->prop,
- p->sem.eqjoin.att2),
- UNAME (p, p->sem.eqjoin.att1));
+ /* we have to make sure that only the columns from
+ the left side are visible */
+ PFalg_proj_t *projlist;
+ PFla_op_t *left = U(L(p));
+
+ projlist = PFmalloc (left->schema.count *
+ sizeof (PFalg_proj_t));
+ for (unsigned int i = 0; i < left->schema.count; i++)
+ projlist[i] = proj (left->schema.items[i].name,
+ left->schema.items[i].name);
+ res = PFla_project_ (
+ PFla_eqjoin_clone (
+ left,
+ U(R(p)),
+ UNAME (p, p->sem.eqjoin.att1),
+ PFprop_unq_name_right (p->prop,
+ p->sem.eqjoin.att2),
+ UNAME (p, p->sem.eqjoin.att1)),
+ left->schema.count,
+ projlist);
} else {
res = semijoin (U(L(p)), U(R(p)),
UNAME (p, p->sem.eqjoin.att1),
@@ -599,8 +612,22 @@
break;
case la_rec_param:
- res = rec_param (U(L(p)), U(R(p)));
- break;
+ {
+ PFla_op_t *arg = NULL;
+
+ /* In case the recursion argument is not referenced anymore
+ we can safely throw it away. */
+ for (unsigned int i = 0; i < PFarray_last (map); i++)
+ if (((ori_unq_map *) PFarray_at (map, i))->ori == L(p)) {
+ arg = ((ori_unq_map *) PFarray_at (map, i))->unq;
+ break;
+ }
+
+ if (arg)
+ res = rec_param (arg, U(R(p)));
+ else
+ res = U(R(p));
+ } break;
case la_rec_nil:
res = rec_nil ();
@@ -612,16 +639,31 @@
projection that transforms the recursion schema into the seed
(and base) schema. */
{
+ PFla_op_t *base = NULL;
PFalg_proj_t *projlist = PFmalloc (p->schema.count *
sizeof (PFalg_proj_t));
for (unsigned int i = 0; i < p->schema.count; i++)
projlist[i] = proj (UNAME(p, p->schema.items[i].name),
UNAME(R(p), p->schema.items[i].name));
+
+ /* In case the recursion base is not referenced anymore
+ we do not need to include the recursion argument. */
+ for (unsigned int i = 0; i < PFarray_last (map); i++)
+ if (((ori_unq_map *) PFarray_at (map, i))->ori
+ == p->sem.rec_arg.base) {
+ base = ((ori_unq_map *) PFarray_at (map, i))->unq;
+ break;
+ }
- res = rec_arg (U(L(p)),
- PFla_project_ (U(R(p)), p->schema.count, projlist),
- U(p->sem.rec_arg.base));
+ if (base)
+ res = rec_arg (U(L(p)),
+ PFla_project_ (U(R(p)),
+ p->schema.count,
+ projlist),
+ base);
+ else
+ return;
} break;
case la_rec_base:
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins