Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3509/mil

Modified Files:
        milprint_summer.c 
Log Message:
* implement new PFTIJAH/Pathfinder function:

  pf:tijah-resultsize(integer)

  This method has arg argument the result tid from tijah-query-id() and returns
  the size of the original return set before returnNumber was applied.



Index: milprint_summer.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milprint_summer.c,v
retrieving revision 1.330
retrieving revision 1.331
diff -u -d -r1.330 -r1.331
--- milprint_summer.c   1 Mar 2007 11:34:15 -0000       1.330
+++ milprint_summer.c   1 Mar 2007 13:23:13 -0000       1.331
@@ -8082,10 +8082,13 @@
           
        /* execute tijah query */
        milprintf(f,
-                "    var nexi_score := 
run_tijah_query(optbat,startNodes,item%s%03u.fetch(int($h)));\n"
+                "    var nexi_allscores := 
run_tijah_query(optbat,startNodes,item%s%03u.fetch(int($h)));\n"
+               "    var nexi_score;\n"
                "    if ( optbat.exist(\"returnNumber\") ) {\n"
                "        var retNum := int(optbat.find(\"returnNumber\"));\n"
-               "        nexi_score := nexi_score.slice(0, retNum - 1);\n"
+               "        nexi_score := nexi_allscores.slice(0, retNum - 1);\n"
+               "    } else {\n"
+               "        nexi_score := nexi_allscores;\n"
                "    }\n"
                , item_ext, str_counter);
        
@@ -8111,6 +8114,7 @@
            /* store scores and nodes */
            milprintf(f,
                "    tID := oid(int(tID) + 1);\n" 
+               "    
tijah_resultsz.insert(lng(tID),lng(nexi_allscores.count()));\n"
                "    tijah_tID.append(item.project(tID));\n"
                "    tijah_frag.append(frag);\n"
                "    tijah_pre.append(item);\n"
@@ -8298,6 +8302,32 @@
         deleteResult_ (f, str_counter, STR);
        counter--;
         return (code)?STR:NORMAL;
+    } else if (!PFqname_eq(fnQname,PFqname (PFns_lib,"tijah-resultsize")))
+    {
+        rc = translate2MIL (f, VALUES, cur_level, counter, L(args));
+        if (rc == NORMAL)
+        {
+            assert (fun->sig_count == 1); 
+            rc = get_kind(fun->sigs[0].ret_ty);
+            milprintf(f, "item%s := item%s;\n", kind_str(rc), val_join(rc));
+        }
+        char *item_ext = kind_str(rc);
+        /* because functions are only allowed for dbl
+           we need to cast integers */
+        type_co t_co = kind_container(rc);
+    
+        milprintf(f,
+                "if (ipik.count() != 0) { # pf:tijah-resultsize\n"
+                "var res := item%s.join(tijah_resultsz);\n"
+               ,item_ext);
+        if (code)
+            milprintf(f, "item%s := res;\n", item_ext);
+        else 
+            addValues (f, t_co, "res", "item");
+    
+        item_ext = (code)?item_ext:"";
+        milprintf(f, "} # end of pf:tijah-resultsize\n");
+        return rc;
     }
 #endif /* PFTIJAH */
     PFoops(OOPS_FATAL,"function %s is not supported.", PFqname_str (fnQname));
@@ -10956,6 +10986,7 @@
        "var tijah_frag  := new(void,oid).seqbase([EMAIL PROTECTED]);\n"
        "var tijah_pre   := new(void,oid).seqbase([EMAIL PROTECTED]);\n"
        "var tijah_score := new(void,dbl).seqbase([EMAIL PROTECTED]);\n"
+       "var tijah_resultsz := new(lng,lng);\n"
        "var tijah_lock  := lock_nil; # pftijah collection lock\n"
 #endif
         "\n"


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to