Update of /cvsroot/monetdb/pathfinder/runtime
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv7720/runtime

Modified Files:
      Tag: M5XQ
        pathfinder.mx 
Log Message:
propagated changes of Wednesday Oct 07 2009
from the development trunk to the M5XQ branch

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/10/07 - sjoerd: runtime/pathfinder.mx,1.464
  propagated changes of Tuesday Oct 06 2009 - Wednesday Oct 07 2009
  from the Aug2009_NFI branch to the development trunk
  
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2009/10/06 - boncz: runtime/pathfinder.mx,1.462.6.2
    enable heuristic rewrite value-selections in the algebra backend of 
MonetDB/xQuery
  
    has to properly implement pf:attribute(ctx, node, ns1, loc1, ns2, loc2) 
first,
    as only the verion without namespaces was there (that one is now gone).
  
    many restrictions:
    - only non-loop-lifted equality tests
    - not involving fn:collection or pf:collection (as path reversal in the 
latter will never find the supernode)
    - not involving any date/time/etc typed expressions (as the indices only 
work for string and numerical equality)
  
    went through the testweb and fixed all apparant problems
  
    note the Aug2009_NFI value indices are full; whereas previously they would 
omit frequent data items
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


U pathfinder.mx
Index: pathfinder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pathfinder.mx,v
retrieving revision 1.458.2.5
retrieving revision 1.458.2.6
diff -u -d -r1.458.2.5 -r1.458.2.6
--- pathfinder.mx       5 Oct 2009 12:16:15 -0000       1.458.2.5
+++ pathfinder.mx       7 Oct 2009 14:23:56 -0000       1.458.2.6
@@ -530,6 +530,13 @@
 var xrpc_hostport := my_hostname() + ":" + str(get_xrpc_port());
 var xrpc_querynr  := (lng(get_xrpc_port()) * 100000LL) - 1LL;
 
+# dummy variables to make MIL test scripts work
+# (otherwise always overridden by a declaration in the pf-generated MIL plan)
+var xrpc_mode := "";
+var xrpc_qid := "";
+var xrpc_method := "";
+var xrpc_timeout := 30000LL;
+
 # abort a 2PC transaction, keeping the record (note ws should have been 
destroyed already)
 PROC _ws_xrpc_abort(oid idx, str status) : void
 {
@@ -2300,7 +2307,8 @@
         vxt := 
[xquery_hash](tmp.leftfetchjoin(attr_prp).leftfetchjoin(prp_val)).access(BAT_WRITE);
         vxt := [:rotate_xor_hash=](vxt, 13, vxp);
         vxp := tmp.leftfetchjoin(attr_own); tmp := nil;
-        tmp := vx_reduce(vxt, vxp);
+        #tmp := vx_reduce(vxt, vxp);
+        tmp := reverse(vxt).leftfetchjoin(vxp); 
         vxp := nil; vxt := nil;
 
     if (updatable or (coll_oid < DOCID_MIN)) { # hash-index, created here each 
time document is first used
@@ -2581,9 +2589,11 @@
     var vx_hsh_nid_del := ws.fetch(VX_HSH_NID_DEL).fetch(cont);
     var map_pid        := ws.fetch(MAP_PID).fetch(cont);
     var iter_cand;
- 
+
     if (count(qns) = 0) return empty_bat; # qn not present in the document, so 
there cannot be any matches
-    if (cont = WS)      return iter_val.project(1...@0); # give up, temporary 
doc container has no index
+    if (cont = WS) {
+        return cross(iter_val, 
reverse(ws.fetch(PRE_KIND).fetch(WS).uselect(getattr.ifthenelse(ELEMENT,TEXT))));
+    }
 
     # for each iter, create a hash number (for each tuple in qns -- usually 
one of course)
     var iter_hsh  := cross(iter_val, qns);
@@ -2615,13 +2625,8 @@
                bat[void,str] iter_val,
                str elt_uri, str elt_loc, str attr_uri, str attr_loc, bit 
getattr) : BAT[oid,oid]
 {
-    # if the average context XML tree is small index access should be avoided
-    var id_cont     := get_container(id_kind);
-    var avg_size := avg(mposjoin(id_item.tmark(0...@0), id_cont, 
ws.fetch(PRE_SIZE)));
-    if (isnil(avg_size) or (avg_size < dbl(IDX_MAGICAL_CONST)) or 
(count(iter_val) > IDX_MAGICAL_CONST)) 
-        return id_iter.project(1...@0);
- 
     # hash the strings, loop over the containers, and perform the lookups.
+    var id_cont := get_container(id_kind);
     var qns     := bat(oid,int).insert(0...@0,0);
     var id_pre  := bat(oid,oid,count(iter_val));
        iter_val := [xquery_hash](iter_val);
@@ -2632,9 +2637,6 @@
         var key_id  := id_val.hmark(0...@0);
         var key_val := id_val.tmark(0...@0);
         var key_nid := vx_lookup(ws, $h, key_val, qns, getattr);
-        if ((count(id_pre) + count(key_nid)) > (10*count(iter_val))) {
-            id_pre := id_iter.project(1...@0); break;
-        }
         var key_pre := ws_docfilter(ws, key_nid, $h, true).ssort(); # sort on 
[iter,pre]
         id_pre.insert(reverse(reverse(key_pre).leftfetchjoin(key_id)));
     }
@@ -2658,9 +2660,12 @@
     # first, ensure sorted PREs
     if (swizzle) 
         swizzle := (ttype(map_pid) = oid);
+    if (cont = WS) 
+        swizzle := false;
     if (not(swizzle)) {
         any_pre := any_pre.tsort(); # no-op for read-only nsloc element index
         if (frag_root.exist(TEMP_DOC)) return any_pre; # temporary document 
(collections) can never have been deleted
+        if (cont = WS) return any_pre; 
     } else if (any_pre.htype() = void) {
         any_pre := any_pre.leftfetchjoin(nid_rid).[swizzle](map_pid).tsort();
     } else {


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to