Update of /cvsroot/monetdb/MonetDB4/src/modules/plain
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25590/src/modules/plain

Modified Files:
        xtables.mx 
Log Message:
CTsubhisto returned a bat of type idxentry,int but accessed only the
oid (hcur) of the idxentry struct. Therefor it changed the type (hack)
into TYPE_oid. This gave problems in the batcache (it returned a
bat with types of incorrect size). 
Now the idxentry type is no longer used (removed) but simply 2 bats.
The waisted space is freed at the end of the subhisto function.

this fixes the failing xtables test on 32 platforms/32 bit oids.


Index: xtables.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB4/src/modules/plain/xtables.mx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- xtables.mx  24 Oct 2007 10:03:44 -0000      1.7
+++ xtables.mx  7 Nov 2007 21:17:46 -0000       1.8
@@ -96,8 +96,6 @@
 
 .ATOM mapentry[32,8];
 .END;
-.ATOM idxentry[16,8];
-.END;
 .ATOM grp[8,8];
 .FIX   = grp_fix; 
 .UNFIX = grp_unfix;
@@ -381,13 +379,6 @@
 #define tst_derive_unclustered(eq,p,t) (e->hcur == hcur && eq(p, tcur, t))
 #define tst_derive_clustered(eq,p,t)   ((samecluster = e->hcur == hcur) && 
eq(p, tcur, t))
 
-/* NOTE: the first two fields of idxentry_t and mapentry_t MUST be the
-   same */
-typedef struct {
-       oid hcur;               /* old group id */
-       hash_t link;            /* hash link */
-} idxentry_t;
-
 typedef struct {
        oid hcur;               /* old group id */
        hash_t link;            /* hash link */
@@ -977,7 +968,12 @@
        size_t size = BATcount(dom);
        hash_t yy, mask, *hash = NULL;
        BUN r, p, q;
-       BAT *bn = BATnew(TYPE_idxentry, TYPE_int, size);
+       BAT *bn = BATnew(TYPE_oid, TYPE_int, size);
+       BAT *lnk = BATnew(TYPE_oid, TYPE_void, size);
+       int *hcnt = (int*)Tloc(bn, BUNfirst(bn));
+       oid *hcur = (oid*)Hloc(bn, BUNfirst(bn));
+       oid *link = (oid*)Hloc(lnk, BUNfirst(lnk));
+       oid *hdom = (oid*)Hloc(dom, 0);
 
        if (bn == NULL)
                return GDK_FAIL;
@@ -998,24 +994,21 @@
        mask--;
 
        /* insert all values in the hash table, and in bn with count zero */
-       r = BUNfirst(bn);
+       r = 0;
        yy = 0;
        BATloop(dom, p, q) {
-               oid v = *(oid *) Hloc(dom, p);
+               oid v = hdom[p];
                hash_t c = v & mask;
 
-               ((idxentry_t *) Hloc(bn, r))->hcur = v;
-               ((idxentry_t *) Hloc(bn, r))->link = hash[c];
-               *(int *) Tloc(bn, r) = 0;
+               hcur[r] = v;
+               link[r] = hash[c];
+               hcnt[r] = 0;
                r++;
                hash[c] = yy;
                yy++;
        }
        BATsetcount(bn, r);
        bn->tsorted = 0;
-       bn->htype = BATmirror(bn)->ttype = TYPE_oid;
-       /* assert(offsetof(idxentry_t,hcur) == 0);
-       ALIGNsetH(bn, dom); */
 
        /* add the counts for this selection using the hash table */
        BATloop(grp, p, q) {
@@ -1023,10 +1016,10 @@
                        oid v = *(oid *) Tloc(grp, p);
                        hash_t c = v & mask;
 
-                       for (yy = hash[c]; yy != HASH_MAX; yy = ((idxentry_t *) 
Hloc(bn, r))->link) {
+                       for (yy = hash[c]; yy != HASH_MAX; yy = link[r]) {
                                r = yy;
-                               if (((idxentry_t *) Hloc(bn, r))->hcur == v) {
-                                       *(int *) Tloc(bn, r) += 1;
+                               if (hcur[r] == v) {
+                                       hcnt[r]++;
                                        break;
                                }
                        }
@@ -1035,6 +1028,7 @@
 
        }
        GDKfree(hash);
+       BBPreclaim(lnk);
        *ret = bn;
        return GDK_SUCCEED;
 }


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