Changeset: 7c2d080dad36 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7c2d080dad36
Modified Files:
        gdk/gdk.h
        gdk/gdk_hash.c
        gdk/gdk_project.c
Branch: default
Log Message:

Merge with Mar2025 branch.


diffs (72 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1694,7 +1694,7 @@ TIMEOUT_TEST(QryCtx *qc)
 #define TIMEOUT_LOOP_BREAK                     \
        {                                       \
                END1 = END2 = 0;                \
-               continue;                       \
+               break;                          \
        }
 
 /* check whether a timeout occurred, and execute the CALLBACK argument
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -665,7 +665,8 @@ BAThashsave(BAT *b, bool dosync)
 #define starthash(TYPE)                                                        
\
        do {                                                            \
                const TYPE *restrict v = (const TYPE *) BUNtloc(bi, 0); \
-               TIMEOUT_LOOP(p, qry_ctx) {                              \
+               TIMEOUT_LOOP_IDX(p, cnt1, qry_ctx) {                    \
+                       c = hash_##TYPE(h, v + o - b->hseqbase);        \
                        hget = HASHget(h, c);                           \
                        if (hget == BUN_NONE) {                         \
                                if (h->nheads == maxslots)              \
@@ -802,7 +803,13 @@ BAThash_impl(BAT *restrict b, struct can
                 * adjusting the hash mask */
                mask = HASHmask(ci->ncand);
        } else if (!hascand && bi.unique_est != 0) {
-               mask = (BUN) (bi.unique_est * 1.15); /* about 8/7 */
+               maxmask = HASHmask(ci->ncand);
+               mask = HASHmask(bi.unique_est);
+               if (mask < maxmask) {
+                       /* it's only an estimate: try out on first 25%
+                        * of b */
+                       cnt1 = ci->ncand >> 2;
+               }
        } else {
                /* dynamic hash: we start with HASHmask(ci->ncand)/64, or,
                 * if ci->ncand large enough, HASHmask(ci->ncand)/256; if there
@@ -814,6 +821,8 @@ BAThash_impl(BAT *restrict b, struct can
                mask = maxmask >> 6;
                while (mask > 4096)
                        mask >>= 2;
+               if (mask < BATTINY)
+                       mask = BATTINY;
                /* try out on first 25% of b */
                cnt1 = ci->ncand >> 2;
        }
@@ -872,7 +881,7 @@ BAThash_impl(BAT *restrict b, struct can
                        break;
                default: {
                        bool (*atomeq)(const void *, const void *) = 
ATOMequal(h->type);
-                       TIMEOUT_LOOP(p, qry_ctx) {
+                       TIMEOUT_LOOP_IDX(p, cnt1, qry_ctx) {
                                const void *restrict v = BUNtail(bi, o - 
b->hseqbase);
                                c = hash_any(h, v);
                                hget = HASHget(h, c);
diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c
--- a/gdk/gdk_project.c
+++ b/gdk/gdk_project.c
@@ -824,8 +824,8 @@ BATproject2(BAT *restrict l, BAT *restri
        }
 
        bn->tunique_est =
-               MIN(li.unique_est ? li.unique_est : BATcount(li.b),
-                   r1i.unique_est ? r1i.unique_est : BATcount(r1i.b));
+               MIN(li.unique_est ? li.unique_est : li.count,
+                   r1i.unique_est ? r1i.unique_est : r1i.count);
        if (!BATtdensebi(&r1i) || (r2 && !BATtdensebi(&r2i)))
                BATtseqbase(bn, oid_nil);
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to