Update of /cvsroot/monetdb/pathfinder/compiler/algebra/opt
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20038/algebra/opt

Modified Files:
      Tag: Feb2009
        opt_general.brg 
Log Message:
-- Bring rewrites into order (such that they do not overlap each other).


U opt_general.brg
Index: opt_general.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_general.brg,v
retrieving revision 1.63.2.1
retrieving revision 1.63.2.2
diff -u -d -r1.63.2.1 -r1.63.2.2
--- opt_general.brg     16 Feb 2009 14:35:11 -0000      1.63.2.1
+++ opt_general.brg     17 Feb 2009 15:31:50 -0000      1.63.2.2
@@ -1357,45 +1357,12 @@
                 break;
             }
         } /* fall trough otherwise */
-        /* Rel:    cast (Rel) */
-        case 59:
-        {
-            /*
-             * If an algebra expression already has the requested
-             * type, replace it by a projection.
-             */
-            bool cast_req = true;
-            for (unsigned int i = 0; i < p->schema.count; i++)
-                if (p->sem.type.col == p->schema.items[i].name &&
-                    p->sem.type.ty == p->schema.items[i].type) {
-                    cast_req = false;
-                    break;
-                }
-
-            if (!cast_req) {
-                PFalg_proj_t *proj = PFmalloc (p->schema.count
-                                               * sizeof (PFalg_proj_t));
-
-                for (unsigned int j = 0; j < p->schema.count; j++)
-                    if (p->schema.items[j].name != p->sem.type.res) {
-                        proj[j] = PFalg_proj (p->schema.items[j].name,
-                                              p->schema.items[j].name);
-                    } else {
-                        proj[j] = PFalg_proj (p->sem.type.res,
-                                              p->sem.type.col);
-                    }
-
-                *p = *PFla_project_ (L(p), p->schema.count, proj);
-                SEEN(p) = false;
-                relabel (p, kids);
-                break;
-            }
-        }   break;
 
         /* Rel:    cast (lit_tbl) */
         case 58:
             /* apply the cast in the literal table */
-            if (p->sem.type.ty == aat_int &&
+            if (L(p)->kind == la_lit_tbl &&
+                p->sem.type.ty == aat_int &&
                 PFprop_type_of (p, p->sem.type.col) == aat_nat) {
                 unsigned int     i, j,
                                  count  = p->schema.count,
@@ -1434,7 +1401,42 @@
                 SEEN(p) = false;
                 label (p);
             }
-            break;
+            /* fall trough otherwise */
+
+        /* Rel:    cast (Rel) */
+        case 59:
+        {
+            /*
+             * If an algebra expression already has the requested
+             * type, replace it by a projection.
+             */
+            bool cast_req = true;
+            for (unsigned int i = 0; i < p->schema.count; i++)
+                if (p->sem.type.col == p->schema.items[i].name &&
+                    p->sem.type.ty == p->schema.items[i].type) {
+                    cast_req = false;
+                    break;
+                }
+
+            if (!cast_req) {
+                PFalg_proj_t *proj = PFmalloc (p->schema.count
+                                               * sizeof (PFalg_proj_t));
+
+                for (unsigned int j = 0; j < p->schema.count; j++)
+                    if (p->schema.items[j].name != p->sem.type.res) {
+                        proj[j] = PFalg_proj (p->schema.items[j].name,
+                                              p->schema.items[j].name);
+                    } else {
+                        proj[j] = PFalg_proj (p->sem.type.res,
+                                              p->sem.type.col);
+                    }
+
+                *p = *PFla_project_ (L(p), p->schema.count, proj);
+                SEEN(p) = false;
+                relabel (p, kids);
+                break;
+            }
+        }   break;
 
         /* ScjRel: step (Frag, ScjRel) */
         case 64:


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to