Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27681/runtime

Modified Files:
      Tag: XQuery_0-22
        pathfinder.mx 
Log Message:
sum now returns NULL for empty bats
so, introduced an old_sum which has the old semantics


Index: pathfinder.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/pathfinder.mx,v
retrieving revision 1.399.2.5
retrieving revision 1.399.2.6
diff -u -d -r1.399.2.5 -r1.399.2.6
--- pathfinder.mx       27 Feb 2008 00:11:48 -0000      1.399.2.5
+++ pathfinder.mx       14 Mar 2008 19:23:44 -0000      1.399.2.6
@@ -1413,6 +1413,16 @@
     return lng(bbpname(ws));
 }
 
+PROC old_sum(BAT[any,lng] b) : lng 
+{
+        var s := sum(b);
+        if (isnil(s)) {
+                return lng(0);
+        } else {
+                return s;
+        }
+}
+
 PROC _ws_free(lng wsid) : BAT[void,any]
 {
     # remove the dependencies of this query (modifies ws_overlaps_ws) 
@@ -1427,7 +1437,7 @@
     reverse(colname_pins).delete(wsid);
  
     # determine whether a cache flush is desired (only count cached bats, 
those with a timestamp)
-    var cursize := 
sum(doc_timestamp.select(timestamp_nil,timestamp_nil).mirror().join(collection_size));
+    var cursize := 
old_sum(doc_timestamp.select(timestamp_nil,timestamp_nil).mirror().join(collection_size));
     var maxsize := (1024LL * 1024LL) * 
lng(monet_environment.find("xquery_cacheMB"));
     if (cursize > maxsize) del_doc_base(true, doc_name, false);
 
@@ -1735,7 +1745,7 @@
         # check sizes of all indices, stuffed in the seqbase of the UNQ bats
         var indices := 
[count](reverse(colname_runtime).mirror()).ord_uselect(RT_QN_NID_UNQ, int_nil);
         if (bit(count(indices))) {
-            var totsize := [fetch](reverse(indices), 
RT_QN_NID_UNQ).[seqbase]().[lng]().sum();
+            var totsize := [fetch](reverse(indices), 
RT_QN_NID_UNQ).[seqbase]().[lng]().old_sum();
             if (totsize > (mem_maxsize()/4LL)) _runtime_flush();
         }
     }
@@ -3400,10 +3410,10 @@
         coll_oid := docid_base;
         if (collection_name.texist(colname)) ERROR("_shred_doc: collection 
name should be globally unique\n");
         collection_name.insert(coll_oid, colname);
-        collection_size.insert(coll_oid, sum([batdsksize](docBAT)));
+        collection_size.insert(coll_oid, old_sum([batdsksize](docBAT)));
         [persists]([rename](docBAT, [+](str(int(coll_oid)), mirror(docBAT))), 
true);
     } else {
-        collection_size.replace(coll_oid, sum([batdsksize](docBAT)));
+        collection_size.replace(coll_oid, old_sum([batdsksize](docBAT)));
     }
 
     # all documents to the doc_* table


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