Update of /cvsroot/monetdb/MonetDB5/src/modules/kernel
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2818/src/modules/kernel

Modified Files:
        group.mx 
Log Message:
propagated changes of Monday Oct 22 2007 - Wednesday Oct 24 2007
from the MonetDB_5-2 branch to the development trunk


Index: group.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/kernel/group.mx,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- group.mx    4 Oct 2007 10:37:25 -0000       1.94
+++ group.mx    24 Oct 2007 08:01:12 -0000      1.95
@@ -656,6 +656,38 @@
                break;
        }
 
[EMAIL PROTECTED]
+#define SAMPLE_SIZE    1024
+hash_t
+derive_mask( BAT *ct_map, BAT *ct_histo, BAT *b)
+{
+       size_t cnt = BATcount(b);
+       int n = bits(BATcount(ct_histo)), *N = &n;
+
+       if (BATcount(b) > (SAMPLE_SIZE<<3)) {
+               BAT *s = BATsample(b, SAMPLE_SIZE);
+               BUN p, q;
+               BAT *histo, *map;
+               hash_t r = 0;
+
+               if (CTderive(&map, &histo, ct_histo, ct_map, s) != GDK_SUCCEED){
+                       BBPunfix(s->batCacheid);
+                       return GDK_FAIL;
+               }
+               BBPunfix(s->batCacheid);
+               BATloop(histo, p, q) {
+                       /* + 4 for a average chain list of 4 */
+                       r += ((dbl)cnt/SAMPLE_SIZE)/(*(int*)BUNtloc(histo,p)+4);
+               }
+               BBPunfix(histo->batCacheid);
+               BBPunfix(map->batCacheid);
+               if (bits(r) > *N)
+                       return (1<<bits(r))-1;
+       }
+       /* default to */
+       return (1<<*N) - 1;
+}
+
 @= derive
 static BAT *
 [EMAIL PROTECTED]@[EMAIL PROTECTED](BAT* ct_map, BAT *ct_histo, BAT *b, BAT 
*bn, map_T *m)
@@ -667,9 +699,8 @@
        BUN p, q, r, cp = BUNfirst(ct_map) - 1;
        mapentry_t entry, *e;
        BAT *map;
-       int n = bits(BATcount(ct_histo)), *N = &n;
        [EMAIL PROTECTED]
-       declare_mask_CUSTOM
+       hash_t mask = derive_mask(ct_map, ct_histo, b); 
        int custom_rng = BATcount(ct_histo); /* expected number of groups */
        hash_t custom_MASK = mask;
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to