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

Modified Files:
      Tag: XQuery_0-24
        planner.c 
Log Message:
-- Ensure input ordering of the thetajoin operator.

   This should fix bug #1981852 PF/alg: test immune_for_updates.SF-1766259 
fails.
   My machine however seems to be too slow to verify this fix---tomorrows
   testing will show more.


U planner.c
Index: planner.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/planner.c,v
retrieving revision 1.62.2.5
retrieving revision 1.62.2.6
diff -u -d -r1.62.2.5 -r1.62.2.6
--- planner.c   31 May 2008 20:15:29 -0000      1.62.2.5
+++ planner.c   2 Jun 2008 13:19:42 -0000       1.62.2.6
@@ -631,8 +631,10 @@
 static PFplanlist_t *
 plan_unique_thetajoin (const PFla_op_t *n)
 {
-    PFplanlist_t  *ret = new_planlist ();
-    PFalg_att_t    ldist, rdist;
+    PFplanlist_t *ret     = new_planlist (),
+                 *lsorted = new_planlist (),
+                 *rsorted = new_planlist ();
+    PFalg_att_t   ldist, rdist;
 
     PFalg_simple_type_t cur_type;
 
@@ -669,8 +671,23 @@
         cur_type & aat_node)
         return ret;
 
-    for (unsigned int l = 0; l < PFarray_last (L(LL(n))->plans); l++)
-        for (unsigned int r = 0; r < PFarray_last (R(LL(n))->plans); r++) {
+    /* make sure the left input is sorted by the left sort criterion */
+    for (unsigned int i = 0; i < PFarray_last (L(LL(n))->plans); i++)
+        add_plans (lsorted,
+                   ensure_ordering (
+                       *(plan_t **) PFarray_at (L(LL(n))->plans, i),
+                       sortby (ldist)));
+
+    /* make sure the right input is sorted by the right sort criterion */
+    for (unsigned int i = 0; i < PFarray_last (R(LL(n))->plans); i++)
+        add_plans (rsorted,
+                   ensure_ordering (
+                       *(plan_t **) PFarray_at (R(LL(n))->plans, i),
+                       sortby (rdist)));
+
+    /* combine each plan in R with each plan in S */
+    for (unsigned int l = 0; l < PFarray_last (lsorted); l++)
+        for (unsigned int r = 0; r < PFarray_last (rsorted); r++) {
             add_plan (ret,
                       /* add the renaming projection afterwards */
                       project (
@@ -684,8 +701,8 @@
                               LL(n)->sem.thetajoin.pred[0].right,
                               ldist,
                               rdist,
-                              *(plan_t **) PFarray_at (L(LL(n))->plans, l),
-                              *(plan_t **) PFarray_at (R(LL(n))->plans, r)),
+                              *(plan_t **) PFarray_at (lsorted, l),
+                              *(plan_t **) PFarray_at (rsorted, r)),
                           2,
                           L(n)->sem.proj.items));
 
@@ -704,8 +721,8 @@
                                   LL(n)->sem.thetajoin.pred[0].left,
                                   rdist,
                                   ldist,
-                                  *(plan_t **) PFarray_at (R(LL(n))->plans, r),
-                                  *(plan_t **) PFarray_at (L(LL(n))->plans, 
l)),
+                                  *(plan_t **) PFarray_at (rsorted, r),
+                                  *(plan_t **) PFarray_at (lsorted, l)),
                               2,
                               L(n)->sem.proj.items));
         }


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to