Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16:/tmp/cvs-serv1709/runtime

Modified Files:
        ll_staircasejoin.mx 
Log Message:

Fixing BUG #1611545 "XQ: wrong path step result (duplicates)"

loop-lifted child implementation did not properly cope with the case 
that the same item (context node) occurs more than once for the same iter,
i.e., in case [iter,item] ([iter,ctx]) is not a set (i.e., contains duplicates).

Fix: avoid producing duplicates in such cases in ll_child result generation.

ToDo:
Can we do this more efficiently, e.g.,
by upfront ensuring that [iter,item] ([iter,ctx])
is a set, i.e., duplicate free??


Added tests in
benchmarks/XBench/TC/SD/Tests/q02alg.*
benchmarks/XBench/TC/MD/Tests/q17alg.*


Index: ll_staircasejoin.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/ll_staircasejoin.mx,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- ll_staircasejoin.mx 23 Feb 2007 12:51:42 -0000      1.53
+++ ll_staircasejoin.mx 6 May 2007 12:51:10 -0000       1.54
@@ -562,6 +562,7 @@
         size_t grow = ((stack[stack_top-1].last - stack[stack_top-1].first) / 
iter_bunsize) + 1;
         BUN dst = NULL;
         int bunsize = BUNsize(res);
+        oid prev_iter = oid_nil;
 
         /* check, if result buffer is big enough; otherwise extend it */
         PFll_check_BAT_capacity(res, grow);
@@ -572,9 +573,22 @@
         for (cur_bun = stack[stack_top-1].first;
              cur_bun <= stack[stack_top-1].last;
              cur_bun += iter_bunsize) {
-            *(oid*)dst              = *(oid*)BUNtail(iter_bat,cur_bun);
-            *(oid*)(dst+SIZEOF_OID) = pre;
-            dst += bunsize;
+            oid next_iter = *(oid*)BUNtail(iter_bat,cur_bun);
+            if (next_iter != prev_iter) {
+                /* (Even) if the same context node (item)
+                 * occurs multiple times per iter,
+                 * we must not produce duplicate results;
+                 * let's hope, the iters are ordered per item (context node).
+                 * ToDo:
+                 * Can we do this more efficiently, e.g.,
+                 * by upfront ensuring that [iter,item] ([iter,ctx])
+                 * is a set, i.e., duplicate free??
+                 */
+                *(oid*)dst              = next_iter;
+                *(oid*)(dst+SIZEOF_OID) = pre;
+                dst += bunsize;
+                prev_iter = next_iter;
+            }
         }
         res->batBuns->free = dst - res->batBuns->base;
         BATsetcount(res, 
(res->batBuns->free+Bunbase(res)-BUNfirst(res))/bunsize);


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to