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

Modified Files:
        opt_complex.c opt_reqval.c 
Log Message:
-- Split up the required distribution value property as it
   checked the order AND the consistent mapping of values at once.

   The two new properties now separately check for the required order columns
   and for columns whose values have to conform to a bijective mapping.


Index: opt_reqval.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_reqval.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- opt_reqval.c        11 Jan 2008 12:49:09 -0000      1.12
+++ opt_reqval.c        14 Jan 2008 14:03:25 -0000      1.13
@@ -130,10 +130,13 @@
         }
     }
 
-    /* replace rowrank operators whose real values
-       are not needed by rank operators */
+    /* Replace rowrank operators whose real values
+       are not needed by rank operators.
+       Note that we do not need to check for the order
+       constraint (PFprop_req_order_col()) as this rewrite
+       does not harm it.  */
     if (p->kind == la_rowrank &&
-        PFprop_req_distr_col (p->prop, p->sem.sort.res))
+        !PFprop_req_value_col (p->prop, p->sem.sort.res))
         *p = *PFla_rank (L(p), p->sem.sort.res, p->sem.sort.sortby);
                 
     /* infer properties for children */

Index: opt_complex.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_complex.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- opt_complex.c       11 Jan 2008 16:47:20 -0000      1.37
+++ opt_complex.c       14 Jan 2008 14:03:25 -0000      1.38
@@ -1036,17 +1036,23 @@
 
         case la_rownum:
             /* Replace the rownumber operator by a projection
-               if only its order and value distribution (keys)
-               are required instead of its values. */
-            if (PFprop_req_distr_col (p->prop, p->sem.sort.res) &&
+               if only its value distribution (keys) are required
+               instead of its real values. */
+            if (!PFprop_req_value_col (p->prop, p->sem.sort.res) &&
                 PFord_count (p->sem.sort.sortby) == 1 &&
-                PFord_order_dir_at (p->sem.sort.sortby, 0) == DIR_ASC &&
                 PFprop_key (p->prop,
                             PFord_order_col_at (p->sem.sort.sortby, 0))) {
                 /* create projection list */
                 PFalg_proj_t *proj_list = PFmalloc ((L(p)->schema.count + 1)
                                                     * sizeof (*(proj_list)));
 
+                /* We cannot rewrite if we require the correct order
+                   and the rownum operator changes it from descending
+                   to ascending. */
+                if (PFord_order_dir_at (p->sem.sort.sortby, 0) == DIR_DESC &&
+                    PFprop_req_order_col (p->prop, p->sem.sort.res))
+                    break;
+                
                 /* copy the child schema (as we cannot be sure that
                    the schema of the rownum operator is still valid) ...*/
                 for (unsigned int i = 0; i < L(p)->schema.count; i++)


-------------------------------------------------------------------------
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