Changeset: 342739e1a5ca for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/342739e1a5ca Modified Files: gdk/gdk_string.c monetdb5/modules/mal/pcre.c Branch: pushcands Log Message:
Merged with default diffs (truncated from 985 to 300 lines): diff --git a/.github/lock.yml b/.github/lock.yml new file mode 100644 --- /dev/null +++ b/.github/lock.yml @@ -0,0 +1,38 @@ +# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app + +# Number of days of inactivity before a closed issue or pull request is locked +daysUntilLock: 20 + +# Skip issues and pull requests created before a given timestamp. Timestamp must +# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable +skipCreatedBefore: false + +# Issues and pull requests with these labels will be ignored. Set to `[]` to disable +exemptLabels: [] + +# Label to add before locking, such as `outdated`. Set to `false` to disable +lockLabel: false + +# Comment to post before locking. Set to `false` to disable +lockComment: > + This thread has been automatically locked since there has not been + any recent activity after it was closed. Please open a new issue for + related bugs. + +# Assign `resolved` as the reason for locking. Set to `false` to disable +setLockReason: false + +# Limit to only `issues` or `pulls` +# only: issues + +# Optionally, specify configuration settings just for `issues` or `pulls` +# issues: +# exemptLabels: +# - help-wanted +# lockLabel: outdated + +# pulls: +# daysUntilLock: 30 + +# Repository to extend settings from +# _extends: repo diff --git a/gdk/gdk_atoms.h b/gdk/gdk_atoms.h --- a/gdk/gdk_atoms.h +++ b/gdk/gdk_atoms.h @@ -406,7 +406,7 @@ strEQ(const char *l, const char *r) static inline bool __attribute__((__pure__)) strNil(const char *s) { - return s == NULL || *s == '\200'; + return s == NULL || (s[0] == '\200' && s[1] == '\0'); } static inline size_t __attribute__((__pure__)) diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -550,53 +550,107 @@ fullscan_any(BAT *b, struct canditer *re if (equi) { *algo = "select: fullscan equi"; - for (p = 0; p < ci->ncand; p++) { - o = canditer_next(ci); - v = BUNtail(bi,(BUN)(o-hseq)); - if ((*cmp)(tl, v) == 0) { - buninsfix(bn, dst, cnt, o, - (BUN) ((dbl) cnt / (dbl) (p == 0 ? 1 : p) - * (dbl) (ci->ncand-p) * 1.1 + 1024), - maximum, BUN_NONE); - cnt++; + if (ci->tpe == cand_dense) { + for (p = 0; p < ci->ncand; p++) { + o = canditer_next_dense(ci); + v = BUNtail(bi, o-hseq); + if ((*cmp)(tl, v) == 0) { + buninsfix(bn, dst, cnt, o, + (BUN) ((dbl) cnt / (dbl) (p == 0 ? 1 : p) + * (dbl) (ci->ncand-p) * 1.1 + 1024), + maximum, BUN_NONE); + cnt++; + } + } + } else { + for (p = 0; p < ci->ncand; p++) { + o = canditer_next(ci); + v = BUNtail(bi, o-hseq); + if ((*cmp)(tl, v) == 0) { + buninsfix(bn, dst, cnt, o, + (BUN) ((dbl) cnt / (dbl) (p == 0 ? 1 : p) + * (dbl) (ci->ncand-p) * 1.1 + 1024), + maximum, BUN_NONE); + cnt++; + } } } } else if (anti) { *algo = "select: fullscan anti"; - for (p = 0; p < ci->ncand; p++) { - o = canditer_next(ci); - v = BUNtail(bi,(BUN)(o-hseq)); - if ((nil == NULL || (*cmp)(v, nil) != 0) && - ((lval && - ((c = (*cmp)(tl, v)) > 0 || - (!li && c == 0))) || - (hval && - ((c = (*cmp)(th, v)) < 0 || - (!hi && c == 0))))) { - buninsfix(bn, dst, cnt, o, - (BUN) ((dbl) cnt / (dbl) (p == 0 ? 1 : p) - * (dbl) (ci->ncand-p) * 1.1 + 1024), - maximum, BUN_NONE); - cnt++; + if (ci->tpe == cand_dense) { + for (p = 0; p < ci->ncand; p++) { + o = canditer_next_dense(ci); + v = BUNtail(bi, o-hseq); + if ((nil == NULL || (*cmp)(v, nil) != 0) && + ((lval && + ((c = (*cmp)(tl, v)) > 0 || + (!li && c == 0))) || + (hval && + ((c = (*cmp)(th, v)) < 0 || + (!hi && c == 0))))) { + buninsfix(bn, dst, cnt, o, + (BUN) ((dbl) cnt / (dbl) (p == 0 ? 1 : p) + * (dbl) (ci->ncand-p) * 1.1 + 1024), + maximum, BUN_NONE); + cnt++; + } + } + } else { + for (p = 0; p < ci->ncand; p++) { + o = canditer_next(ci); + v = BUNtail(bi, o-hseq); + if ((nil == NULL || (*cmp)(v, nil) != 0) && + ((lval && + ((c = (*cmp)(tl, v)) > 0 || + (!li && c == 0))) || + (hval && + ((c = (*cmp)(th, v)) < 0 || + (!hi && c == 0))))) { + buninsfix(bn, dst, cnt, o, + (BUN) ((dbl) cnt / (dbl) (p == 0 ? 1 : p) + * (dbl) (ci->ncand-p) * 1.1 + 1024), + maximum, BUN_NONE); + cnt++; + } } } } else { *algo = "select: fullscan range"; - for (p = 0; p < ci->ncand; p++) { - o = canditer_next(ci); - v = BUNtail(bi,(BUN)(o-hseq)); - if ((nil == NULL || (*cmp)(v, nil) != 0) && - ((!lval || - (c = cmp(tl, v)) < 0 || - (li && c == 0)) && - (!hval || - (c = cmp(th, v)) > 0 || - (hi && c == 0)))) { - buninsfix(bn, dst, cnt, o, - (BUN) ((dbl) cnt / (dbl) (p == 0 ? 1 : p) - * (dbl) (ci->ncand-p) * 1.1 + 1024), - maximum, BUN_NONE); - cnt++; + if (ci->tpe == cand_dense) { + for (p = 0; p < ci->ncand; p++) { + o = canditer_next_dense(ci); + v = BUNtail(bi, o-hseq); + if ((nil == NULL || (*cmp)(v, nil) != 0) && + ((!lval || + (c = cmp(tl, v)) < 0 || + (li && c == 0)) && + (!hval || + (c = cmp(th, v)) > 0 || + (hi && c == 0)))) { + buninsfix(bn, dst, cnt, o, + (BUN) ((dbl) cnt / (dbl) (p == 0 ? 1 : p) + * (dbl) (ci->ncand-p) * 1.1 + 1024), + maximum, BUN_NONE); + cnt++; + } + } + } else { + for (p = 0; p < ci->ncand; p++) { + o = canditer_next(ci); + v = BUNtail(bi, o-hseq); + if ((nil == NULL || (*cmp)(v, nil) != 0) && + ((!lval || + (c = cmp(tl, v)) < 0 || + (li && c == 0)) && + (!hval || + (c = cmp(th, v)) > 0 || + (hi && c == 0)))) { + buninsfix(bn, dst, cnt, o, + (BUN) ((dbl) cnt / (dbl) (p == 0 ? 1 : p) + * (dbl) (ci->ncand-p) * 1.1 + 1024), + maximum, BUN_NONE); + cnt++; + } } } } diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c --- a/gdk/gdk_string.c +++ b/gdk/gdk_string.c @@ -108,11 +108,14 @@ strCleanHash(Heap *h, bool rebuild) * started. */ memset(newhash, 0, sizeof(newhash)); pos = GDK_STRHASHSIZE; - while (pos < h->free && - pos + (pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1))) < GDK_ELIMLIMIT) { + while (pos < h->free) { + pad = GDK_VARALIGN - (pos & (GDK_VARALIGN - 1)); if (pad < sizeof(stridx_t)) pad += GDK_VARALIGN; - pos += pad + extralen; + pos += pad; + if (pos >= GDK_ELIMLIMIT) + break; + pos += extralen; s = h->base + pos; if (h->hashash) strhash = ((const BUN *) s)[-1]; @@ -315,9 +318,11 @@ strPut(BAT *b, var_t *dst, const void *V pad = 0; } + pad += extralen; + /* check heap for space (limited to a certain maximum after * which nils are inserted) */ - if (h->free + pad + len + extralen >= h->size) { + if (h->free + pad + len >= h->size) { size_t newsize = MAX(h->size, 4096); /* double the heap size until we have enough space */ @@ -326,11 +331,11 @@ strPut(BAT *b, var_t *dst, const void *V newsize <<= 1; else newsize += 4 * 1024 * 1024; - } while (newsize <= h->free + pad + len + extralen); + } while (newsize <= h->free + pad + len); assert(newsize); - if (h->free + pad + len + extralen >= (size_t) VAR_MAX) { + if (h->free + pad + len >= (size_t) VAR_MAX) { GDKerror("string heaps gets larger than %zuGiB.\n", (size_t) VAR_MAX >> 30); return 0; } @@ -342,19 +347,16 @@ strPut(BAT *b, var_t *dst, const void *V HEAPdecref(h, false); b->tvheap = h = new; MT_lock_unset(&b->theaplock); -#ifndef NDEBUG - /* fill should solve initialization problems within - * valgrind */ - memset(h->base + h->free, 0, h->size - h->free); -#endif /* make bucket point into the new heap */ bucket = ((stridx_t *) h->base) + off; } /* insert string */ - pos = h->free + pad + extralen; + pos = h->free + pad; *dst = (var_t) pos; + if (pad > 0) + memset(h->base + h->free, 0, pad); memcpy(h->base + pos, v, len); if (h->hashash) { ((BUN *) (h->base + pos))[-1] = strhash; @@ -362,7 +364,7 @@ strPut(BAT *b, var_t *dst, const void *V ((BUN *) (h->base + pos))[-2] = (BUN) len; #endif } - h->free += pad + len + extralen; + h->free += pad + len; h->dirty = true; /* maintain hash table */ diff --git a/monetdb5/modules/kernel/algebra.c b/monetdb5/modules/kernel/algebra.c --- a/monetdb5/modules/kernel/algebra.c +++ b/monetdb5/modules/kernel/algebra.c @@ -974,28 +974,46 @@ ALGsort11(bat *result, const bat *bid, c static str ALGcountCND_nil(lng *result, const bat *bid, const bat *cnd, const bit *ignore_nils) { - BAT *b, *s = NULL; + str msg = MAL_SUCCEED; + BAT *b = NULL, *s = NULL; + bool heap_loaded = false; - if ((b = BATdescriptor(*bid)) == NULL) { - throw(MAL, "aggr.count", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); + if (!(b = BBPquickdesc(*bid, false))) { _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list