Changeset: ba3aae32f236 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ba3aae32f236
Modified Files:
        monetdb5/modules/mal/pp_algebra.c
        monetdb5/modules/mal/pp_hash.c
        monetdb5/modules/mal/pp_hash.h
        sql/server/rel_optimize_sel.c
Branch: pp_hashjoin
Log Message:

some more compilation fixes for 32 bit (only heapn needs more fixes)


diffs (296 lines):

diff --git a/monetdb5/modules/mal/pp_algebra.c 
b/monetdb5/modules/mal/pp_algebra.c
--- a/monetdb5/modules/mal/pp_algebra.c
+++ b/monetdb5/modules/mal/pp_algebra.c
@@ -940,7 +940,7 @@ LOCKEDAGGRnull(Client ctx, bat *result, 
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = HT_PRE_CLAIM; \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -1188,7 +1188,7 @@ LALGunique(Client ctx, bat *rid, bat *ui
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = HT_PRE_CLAIM; \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -1444,7 +1444,7 @@ LALGgroup_unique(Client ctx, bat *rid, b
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -1503,7 +1503,7 @@ LALGgroup_unique(Client ctx, bat *rid, b
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -1780,7 +1780,7 @@ LALGgroup(Client ctx, bat *rid, bat *uid
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) \
                                                        hash_rehash(h, p, err); 
{ \
                                                        vals = h->vals; \
diff --git a/monetdb5/modules/mal/pp_hash.c b/monetdb5/modules/mal/pp_hash.c
--- a/monetdb5/modules/mal/pp_hash.c
+++ b/monetdb5/modules/mal/pp_hash.c
@@ -622,7 +622,7 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -667,7 +667,7 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -709,7 +709,7 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -751,7 +751,7 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -796,7 +796,7 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
                                        if (!g) { \
                                                if (slots == 0) { \
                                                        slots = 
ht_preclaim(private); \
-                                                       slot = 
ATOMIC_ADD(&h->last, slots); \
+                                                       slot = 
ATOMIC_ADD_GID(&h->last, slots); \
                                                        if (((slot*100)/70) >= 
(gid)h->size) { \
                                                                hash_rehash(h, 
p, err); \
                                                                vals = h->vals; 
\
@@ -833,7 +833,7 @@ UHASHext(Client cntxt, MalBlkPtr m, MalS
                                        if (!g) { \
                                                if (slots == 0) { \
                                                        slots = 
ht_preclaim(private); \
-                                                       slot = 
ATOMIC_ADD(&h->last, slots); \
+                                                       slot = 
ATOMIC_ADD_GID(&h->last, slots); \
                                                        if (((slot*100)/70) >= 
(gid)h->size) { \
                                                                hash_rehash(h, 
p, err); \
                                                                vals = h->vals; 
\
@@ -1006,7 +1006,7 @@ error:
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -1054,7 +1054,7 @@ error:
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -1098,7 +1098,7 @@ error:
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -1143,7 +1143,7 @@ error:
                                if (!g) { \
                                        if (slots == 0) { \
                                                slots = ht_preclaim(private); \
-                                               slot = ATOMIC_ADD(&h->last, 
slots); \
+                                               slot = ATOMIC_ADD_GID(&h->last, 
slots); \
                                                if (((slot*100)/70) >= 
(gid)h->size) { \
                                                        hash_rehash(h, p, err); 
\
                                                        vals = h->vals; \
@@ -1191,7 +1191,7 @@ error:
                                        if (!g) { \
                                                if (slots == 0) { \
                                                        slots = 
ht_preclaim(private); \
-                                                       slot = 
ATOMIC_ADD(&h->last, slots); \
+                                                       slot = 
ATOMIC_ADD_GID(&h->last, slots); \
                                                        if (((slot*100)/70) >= 
(gid)h->size) { \
                                                                hash_rehash(h, 
p, err); \
                                                                vals = h->vals; 
\
@@ -1232,7 +1232,7 @@ error:
                                        if (!g) { \
                                                if (slots == 0) { \
                                                        slots = 
ht_preclaim(private); \
-                                                       slot = 
ATOMIC_ADD(&h->last, slots); \
+                                                       slot = 
ATOMIC_ADD_GID(&h->last, slots); \
                                                        if (((slot*100)/70) >= 
(gid)h->size) \
                                                                hash_rehash(h, 
p, err); \
                                                                vals = h->vals; 
\
@@ -1464,7 +1464,7 @@ OAHASHadd_freq(Client cntxt, MalBlkPtr m
                if (occrrence_idx) {
                        gid *occIdx = Tloc(res, 0);
                        TIMEOUT_LOOP_IDX_DECL(i, cnt, qry_ctx) {
-                               occIdx[i] = freqs[sltid[i]];
+                               occIdx[i] = (oid)freqs[sltid[i]];
                                freqs[sltid[i]]++;
                        }
                } else {
@@ -1530,7 +1530,7 @@ error:
                        } \
                        if ((slot?1:0) == match) { \
                                oid_mtd[mtdcnt] = off+i; \
-                               slt[mtdcnt] = slot - 1; \
+                               slt[mtdcnt] = (oid)(slot - 1); \
                                mtdcnt++; \
                                if (match && *single && freq[slot - 1] > 1) { \
                                        err = createException(SQL, 
"oahash.probe", "more than one match"); \
@@ -1857,7 +1857,7 @@ OAHASHnprobe(Client ctx, bat *PRB_oid, b
                        } \
                        oid_mtd[mtdcnt] = off+i; \
                        if (slot) { \
-                               slt[mtdcnt] = slot - 1; \
+                               slt[mtdcnt] = (oid)(slot - 1); \
                                mark[i] = true; \
                                if (*single && freq[slot - 1] > 1) { \
                                        err = createException(SQL, 
"oahash.probe", "more than one match"); \
@@ -2900,7 +2900,7 @@ OAHASHexpand(Client ctx, bat *expanded, 
                if (freq) {
                        TIMEOUT_LOOP_IDX_DECL(i, selcnt, qry_ctx) {
                                if (sid[i] != oid_nil && freq[sid[i]])
-                                       xpdcnt += freq[sid[i]];
+                                       xpdcnt += (oid)freq[sid[i]];
                                else
                                        xpdcnt++;
                        }
@@ -3059,13 +3059,13 @@ OAHASHexplode(Client ctx, bat *fetched, 
                if (*left_outer) {
                        TIMEOUT_LOOP_IDX_DECL(i, selcnt, qry_ctx) {
                                if (sid[i] != oid_nil)
-                                       fchcnt += freq[sid[i]];
+                                       fchcnt += (oid)freq[sid[i]];
                                else
                                        fchcnt++;
                        }
                } else {
                        TIMEOUT_LOOP_IDX_DECL(i, selcnt, qry_ctx)
-                               fchcnt += freq[sid[i]];
+                               fchcnt += (oid)freq[sid[i]];
                }
                TIMEOUT_CHECK(qry_ctx, err = createException(SQL, 
"oahash.explode", RUNTIME_QRY_TIMEOUT));
                if (err)
@@ -3099,7 +3099,7 @@ OAHASHexplode(Client ctx, bat *fetched, 
                                                        g = ht->gids[k];
                                                }
                                                assert(g>0);
-                                               res[idx++] = g-1;
+                                               res[idx++] = (oid)(g-1);
                                        }
                                } else {
                                        res[idx++] = oid_nil;
@@ -3118,7 +3118,7 @@ OAHASHexplode(Client ctx, bat *fetched, 
                                                g = ht->gids[k];
                                        }
                                        assert(g>0);
-                                       res[idx++] = g-1;
+                                       res[idx++] = (oid)(g-1);
                                }
                        }
                }
@@ -3245,11 +3245,11 @@ OAHASHexplode_unmatched(Client ctx, bat 
        // FIXME: replace this hacky solution with proper BATiter!!!
        if (umrk)
                        TIMEOUT_LOOP_IDX_DECL(i, cnt, qry_ctx) {
-                                       ttlcnt += freq[umrk[i]];
+                                       ttlcnt += (oid)freq[umrk[i]];
                        }
        else /* !umrk: u has dense tail */
                        TIMEOUT_LOOP_IDX_DECL(i, cnt, qry_ctx) {
-                                       ttlcnt += freq[u->hseqbase+i];
+                                       ttlcnt += (oid)freq[u->hseqbase+i];
                        }
        TIMEOUT_CHECK(qry_ctx, err = createException(SQL, 
"oahash.explode_unmatched", RUNTIME_QRY_TIMEOUT));
        if (err)
@@ -3328,7 +3328,7 @@ OAHASHnth_slice(Client ctx, bat *slice, 
        BUN j = 0;
        for (BUN i = s; i<e; i++) {
                if (h->gids[i])
-                       o[j++] = h->gids[i]-1;
+                       o[j++] = (oid)(h->gids[i]-1);
        }
        BATsetcount(r, j);
        BATnegateprops(r);
diff --git a/monetdb5/modules/mal/pp_hash.h b/monetdb5/modules/mal/pp_hash.h
--- a/monetdb5/modules/mal/pp_hash.h
+++ b/monetdb5/modules/mal/pp_hash.h
@@ -118,6 +118,7 @@ hash_prime_nr[32] = {
 typedef oid gid;
 typedef ATOMIC_TYPE hash_key_t;
 #define ATOMIC_GET_GID(a) ((gid)ATOMIC_GET(a))
+#define ATOMIC_ADD_GID(a,i) ((gid)ATOMIC_ADD(a,i))
 
 typedef int (*fcmp)(const void *v1, const void *v2);
 typedef lng (*fhsh)(const void *v);
diff --git a/sql/server/rel_optimize_sel.c b/sql/server/rel_optimize_sel.c
--- a/sql/server/rel_optimize_sel.c
+++ b/sql/server/rel_optimize_sel.c
@@ -2817,12 +2817,12 @@ exp_cost(visitor *v, sql_exp *e, ulng ma
                if (l) {
                        lcard = get_rel_count(l);
                        if (lcard == BUN_NONE)
-                               lcard = max;
+                               lcard = (BUN)max;
                }
                if (r) {
                        rcard = get_rel_count(r);
                        if (rcard == BUN_NONE)
-                               rcard = max;
+                               rcard = (BUN)max;
                }
                BUN n = l->nrcols + r->nrcols; /* not correct includes join 
exps */
                cost = ( (dbl)lcard + (dbl)rcard + (lcard*rcard * sel * n * 8) 
);
@@ -2879,12 +2879,12 @@ order_join_expressions_pp(mvc *sql, list
                        if (l) {
                                lcard = get_rel_count(l);
                                if (lcard == BUN_NONE)
-                                       lcard = max;
+                                       lcard = (BUN)max;
                        }
                        if (r) {
                                rcard = get_rel_count(r);
                                if (rcard == BUN_NONE)
-                                       rcard = max;
+                                       rcard = (BUN)max;
                        }
                        keys[i] =  ( (dbl)lcard + (dbl)rcard + (lcard*rcard * 
sel) );
                        if (VERBOSE) {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to