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

Modified Files:
        opt_thetajoin.c 
Log Message:
-- Enable thetajoin -- rownum rewrite for some special cases.


U opt_thetajoin.c
Index: opt_thetajoin.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_thetajoin.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- opt_thetajoin.c     8 May 2009 15:17:36 -0000       1.42
+++ opt_thetajoin.c     28 May 2009 15:00:36 -0000      1.43
@@ -1179,11 +1179,6 @@
             break;
 
         case la_rownum:
-            /* 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-
-               numbering needs to take the result of the thetajoin into 
account. */
-#if 0
             /* An expression that does not contain any sorting column
                required by the rownum operator, but contains the partitioning
                column is independent of the rownum. The translation thus
@@ -1196,6 +1191,25 @@
                 unsigned int lsortby = 0,
                              rsortby = 0;
 
+                /******************** 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 iteration
+                   has the same number of rows anymore and thus row-numbering
+                   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 ************************/
+
                 /* first check for the required columns
                    in the left thetajoin input */
                 for (i = 0; i < LL(p)->schema.count; i++) {
@@ -1255,7 +1269,6 @@
                     break;
                 }
             }
-#endif
             break;
 
         case la_rowrank:


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to