Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19535/compiler/algebra

Modified Files:
        core2alg.brg 
Log Message:
propagated changes of Thursday Mar 27 2008 - Friday Mar 28 2008
from the XQuery_0-22 branch to the development trunk

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2008/03/27 - tsheyar: compiler/algebra/core2alg.brg,1.61.2.2
-- Fixing bug triggered by proxy operator rewriting
   (as e.g. in benchmarks/XBench/DC_MD/q04 observed).

   An assumption for the proxy rewrite was not met. The problem is now
   circumvented by generating algebra code that fulfills the assumption
   (during Core to Logical Algebra translation).

   Details: Moved rownum operator generating the numbers for the positional
            for-loop variable outside the body. We thus avoid any reference
            to an outer scope from an inner scope. We hopefully get rid of
            (parts of) the proxy idea soon and thus do not have to rely any
            more on the fragile assumptions ensured only by the code
            generation.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



U core2alg.brg
Index: core2alg.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/core2alg.brg,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- core2alg.brg        20 Mar 2008 08:29:25 -0000      1.68
+++ core2alg.brg        28 Mar 2008 10:27:01 -0000      1.69
@@ -984,7 +984,19 @@
             /* initiate translation of e1 */
             reduce (ctx, kids[1], nts[1]);
 
-            rowid = rowid (A(LR(p)).rel, att_inner);
+            /*
+             * Add 'real' positions and the new iter values.
+             * (Note: We add the positions outside as some proxy rewrites
+             *        expect that no rownum can escape its 'scope'. The
+             *        result of the rownum operator is discarded in the
+             *        first icols optimization if no positional variable
+             *        exists.)
+             */
+            rowid = rowid (rownum (A(LR(p)).rel,
+                                   att_pos1,
+                                   sortby (att_pos),
+                                   att_iter),
+                           att_inner);
 
             /* translate $v */
             var = attach (project (rowid,
@@ -1009,19 +1021,18 @@
                                proj (att_inner, att_inner));
 
             /*
-             * handle optional variable ($p); we need map operator
-             * for this purpose
-             * note that the rownum () routine is used to create
-             * the 'item' column of $p's operator; since this
-             * column must be of type integer instead of nat, we
-             * cast it accordingly
+             * Handle optional variable ($p).
+             * (Note: The rownum () routine was used to create
+             *        the 'item' column of $p's operator. Since this
+             *        column must be of type integer instead of nat, we
+             *        cast it accordingly.)
              */
             if (LLR(p)->kind == c_var) {
                 assert (LLR(p)->sem.var);
-                opt_var = attach (project (cast (rownum (var_map, att_item,
-                                                         sortby (att_sort),
-                                                         att_outer),
-                                                 att_cast, att_item, aat_int),
+                opt_var = attach (project (cast (rowid,
+                                                 att_cast,
+                                                 att_pos1,
+                                                 aat_int),
                                            proj (att_iter, att_inner),
                                            proj (att_item, att_cast)),
                                   att_pos, lit_nat (1));


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to