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

Modified Files:
      Tag: Aug2009
        planner.c 
Log Message:
-- Fix physical plan for merge-adjacent-text-nodes.
   (The MIL code generation expects oids instead of nodes.)


U planner.c
Index: planner.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/planner.c,v
retrieving revision 1.86
retrieving revision 1.86.2.1
diff -u -d -r1.86 -r1.86.2.1
--- planner.c   12 Jun 2009 13:06:10 -0000      1.86
+++ planner.c   28 Sep 2009 13:42:26 -0000      1.86.2.1
@@ -2510,12 +2510,9 @@
                   iter_res = n->sem.merge_adjacent.iter_res,
                   pos_res  = n->sem.merge_adjacent.pos_res,
                   item_res = n->sem.merge_adjacent.item_res;
-    PFalg_proj_t *proj     = PFmalloc (3 * sizeof (PFalg_proj_t));
+    unsigned int  count    = 3;
+    PFalg_proj_t *proj     = PFmalloc (count * sizeof (PFalg_proj_t));
 
-    proj[0] = PFalg_proj (iter_res, iter);
-    proj[1] = PFalg_proj (pos_res, pos);
-    proj[2] = PFalg_proj (item_res, item);
-                         
     /* The merge_adjacent_text_node operator requires
        its inputs to be properly sorted. */
     for (unsigned int i = 0; i < PFarray_last (R(n)->plans); i++)
@@ -2530,6 +2527,25 @@
                          cheapest_sorted))
             cheapest_sorted = *(plan_t **) PFarray_at (sorted, i);
 
+    /* ensure that the generated MIL code can cope with our position values */
+    if (PFprop_type_of (n, pos) != aat_nat) {
+        pos = PFcol_new (col_pos);
+        cheapest_sorted = mark_grp (cheapest_sorted,
+                                    pos,
+                                    iter);
+    }
+
+    /* in some situations the position are identical to the item columns */
+    proj[0] = PFalg_proj (iter_res, iter);
+    if (pos_res == item_res) {
+        count = 2;
+        proj[1] = PFalg_proj (item_res, item);
+    }
+    else {
+        proj[1] = PFalg_proj (pos_res, pos);
+        proj[2] = PFalg_proj (item_res, item);
+    }
+                         
     /* generate a merge_adjacent_text_node operator for
        the single remaining plan */
     add_plan (ret,
@@ -2537,7 +2553,7 @@
                   merge_adjacent (
                       cheapest_sorted,
                       iter, pos, item),
-                  3, proj));
+                  count, proj));
     return ret;
 }
 


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to