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

Modified Files:
        opt_thetajoin.c 
Log Message:
-- Enable rowrank-thetajoin rewrite for a special case
   (where the thetajoin behaves like a cross product).


U opt_thetajoin.c
Index: opt_thetajoin.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_thetajoin.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- opt_thetajoin.c     12 Jun 2009 13:06:12 -0000      1.44
+++ opt_thetajoin.c     16 Jun 2009 14:01:25 -0000      1.45
@@ -1265,14 +1265,28 @@
             break;
 
         case la_rowrank:
-            /* the following rewrite is incorrect as the thetajoin arguments
-               filter out some rows from the cross product -- Not every
-               iteration has the same number of rows anymore and thus row-
-               ranking needs to take the result of the thetajoin into account. 
*/
-            break;
-#if 0
+            if (is_tj (L(p))) {
+                /******************** thetajoin check ************************/
+
+                unsigned int count = 0;
+                PFarray_t   *pred = p->sem.thetajoin_opt.pred;
+                
+                /* The following rewrite is incorrect if we have a real
+                   thetajoin as the thetajoin arguments filter out some
+                   rows from the cross product -- Not every group exists
+                   anymore and thus row-ranking needs to take the result
+                   of the thetajoin into account. */
+
+                /* Check if we have a cross product without selection. */
+                for (i = 0; i < PFarray_last (pred); i++)
+                    if (PERS_AT(pred, i)) count++;
+                /* skip rewrite (see explanation above) */
+                if (count) break;
+
+                /******************** thetajoin check ************************/
+            }
             /* fall through */
-#endif
+
         case la_rank:
             /* An expression that does not contain any sorting column
                required by the rank operator is independent of the rank.


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to