Changeset: c99b74163ffa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c99b74163ffa
Modified Files:
        clients/Tests/exports.stable.out
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_hash.c
        gdk/gdk_logger.c
        gdk/gdk_private.h
        gdk/gdk_storage.c
        gdk/gdk_string.c
        sql/storage/store.c
        testing/Mtest.py.in
Branch: ustr
Log Message:

Merge with default branch.


diffs (truncated from 984 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -257,7 +257,7 @@ BAT *GDKanalytical_covariance_pop(BAT *p
 BAT *GDKanalytical_covariance_samp(BAT *p, BAT *o, BAT *b1, BAT *b2, BAT *s, 
BAT *e, int tpe, int frame_type) __attribute__((__warn_unused_result__));
 BAT *GDKanalytical_stddev_pop(BAT *p, BAT *o, BAT *b, BAT *s, BAT *e, int tpe, 
int frame_type) __attribute__((__warn_unused_result__));
 BAT *GDKanalytical_stddev_samp(BAT *p, BAT *o, BAT *b, BAT *s, BAT *e, int 
tpe, int frame_type) __attribute__((__warn_unused_result__));
-gdk_return GDKanalytical_str_group_concat(BAT *r, BAT *p, BAT *o, BAT *b, BAT 
*sep, BAT *s, BAT *e, const char *restrict separator, int frame_type);
+BAT *GDKanalytical_str_group_concat(BAT *b, BAT *p, BAT *o, BAT *sep, BAT *s, 
BAT *e, const char *restrict separator, int frame_type);
 BAT *GDKanalytical_variance_pop(BAT *p, BAT *o, BAT *b, BAT *s, BAT *e, int 
tpe, int frame_type) __attribute__((__warn_unused_result__));
 BAT *GDKanalytical_variance_samp(BAT *p, BAT *o, BAT *b, BAT *s, BAT *e, int 
tpe, int frame_type) __attribute__((__warn_unused_result__));
 BAT *GDKanalyticalavg(BAT *p, BAT *o, BAT *b, BAT *s, BAT *e, int tpe, int 
frame_type) __attribute__((__warn_unused_result__));
diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c
--- a/gdk/gdk_analytic_func.c
+++ b/gdk/gdk_analytic_func.c
@@ -984,7 +984,7 @@ GDKanalyticallead(BAT *b, BAT *p, BUN le
 #define ANALYTICAL_MIN_MAX_CALC_FIXED_UNBOUNDED_TILL_CURRENT_ROW(TPE, MIN_MAX) 
\
        do {                                                            \
                TPE curval = TPE##_nil;                                 \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                if (!is_##TPE##_nil(bp[k])) {           \
@@ -1091,7 +1091,7 @@ GDKanalyticallead(BAT *b, BAT *p, BUN le
        do {                                                            \
                const void *curval = nil;                               \
                if (ATOMvarsized(tpe)) {                                \
-                       for (; k < i;) {                                \
+                       while (k < i) {                                 \
                                j = k;                                  \
                                do {                                    \
                                        const void *next = BUNtvar(&bi, k); \
@@ -1109,7 +1109,7 @@ GDKanalyticallead(BAT *b, BAT *p, BUN le
                                has_nils |= atomeq(curval, nil);        \
                        }                                               \
                } else {                                                \
-                       for (; k < i;) {                                \
+                       while (k < i) {                                 \
                                j = k;                                  \
                                do {                                    \
                                        const void *next = BUNtloc(&bi, k); \
@@ -1435,7 +1435,7 @@ ANALYTICAL_MIN_MAX(max, MAX, <)
        do {                                                            \
                curval = 0;                                             \
                if (count_all) {                                        \
-                       for (; k < i;) {                                \
+                       while (k < i) {                                 \
                                j = k;                                  \
                                do {                                    \
                                        k++;                            \
@@ -1445,7 +1445,7 @@ ANALYTICAL_MIN_MAX(max, MAX, <)
                                        rb[j] = curval;                 \
                        }                                               \
                } else {                                                \
-                       for (; k < i;) {                                \
+                       while (k < i) {                                 \
                                j = k;                                  \
                                do {                                    \
                                        curval += !is_##TPE##_nil(bp[k]); \
@@ -1557,7 +1557,7 @@ ANALYTICAL_MIN_MAX(max, MAX, <)
        do {                                                            \
                curval = 0;                                             \
                if (count_all) {                                        \
-                       for (; k < i;) {                                \
+                       while (k < i) {                                 \
                                j = k;                                  \
                                do {                                    \
                                        k++;                            \
@@ -1567,7 +1567,7 @@ ANALYTICAL_MIN_MAX(max, MAX, <)
                                        rb[j] = curval;                 \
                        }                                               \
                } else {                                                \
-                       for (; k < i; ) {                               \
+                       while (k < i) {                                 \
                                j = k;                                  \
                                do {                                    \
                                        curval += !atomeq(BUNtail(&bi, k), 
nil); \
@@ -1814,7 +1814,7 @@ cleanup:
 #define ANALYTICAL_SUM_IMP_NUM_UNBOUNDED_TILL_CURRENT_ROW(TPE1, TPE2)  \
        do {                                                            \
                TPE2 curval = TPE2##_nil;                               \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                if (!is_##TPE1##_nil(bp[k])) {          \
@@ -2187,7 +2187,7 @@ calc_overflow:
 #define ANALYTICAL_PROD_CALC_NUM_UNBOUNDED_TILL_CURRENT_ROW(TPE1, TPE2, TPE3) \
        do {                                                            \
                TPE2 curval = TPE2##_nil;                               \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                PROD_NUM(TPE1, TPE2, TPE3, bp[k]);      \
@@ -2294,7 +2294,7 @@ calc_overflow:
 #define ANALYTICAL_PROD_CALC_NUM_LIMIT_UNBOUNDED_TILL_CURRENT_ROW(TPE1, TPE2, 
REAL_IMP) \
        do {                                                            \
                TPE2 curval = TPE2##_nil;                               \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                PROD_NUM_LIMIT(TPE1, TPE2, REAL_IMP, bp[k]); \
@@ -2390,7 +2390,7 @@ calc_overflow:
 #define ANALYTICAL_PROD_CALC_FP_UNBOUNDED_TILL_CURRENT_ROW(TPE1, TPE2, ARG3)   
/* ARG3 is ignored here */ \
        do {                                                            \
                TPE2 curval = TPE2##_nil;                               \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                PROD_FP(TPE1, TPE2, bp[k]);             \
diff --git a/gdk/gdk_analytic_statistics.c b/gdk/gdk_analytic_statistics.c
--- a/gdk/gdk_analytic_statistics.c
+++ b/gdk/gdk_analytic_statistics.c
@@ -59,7 +59,7 @@
        do {                                                            \
                TPE a = 0;                                              \
                dbl curval = dbl_nil;                                   \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                ANALYTICAL_AVERAGE_CALC_NUM_STEP1(TPE, IMP, 
bp[k]); \
@@ -204,7 +204,7 @@ avg_num_deltas(lng)
        do {                                                            \
                TPE a = 0;                                              \
                dbl curval = dbl_nil;                                   \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                if (!is_##TPE##_nil(bp[k]))             \
@@ -458,7 +458,7 @@ nosupport:
 #define ANALYTICAL_AVG_INT_UNBOUNDED_TILL_CURRENT_ROW(TPE)             \
        do {                                                            \
                TPE avg = 0;                                            \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                if (!is_##TPE##_nil(bp[k]))             \
@@ -707,7 +707,7 @@ nosupport:
 #define ANALYTICAL_STDEV_VARIANCE_UNBOUNDED_TILL_CURRENT_ROW(TPE, SAMPLE, OP) \
        do {                                                            \
                TPE *restrict bp = (TPE*)bi.base;                       \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                TPE v = bp[k];                          \
@@ -994,7 +994,7 @@ GDK_ANALYTICAL_STDEV_VARIANCE(variance_p
 #define ANALYTICAL_COVARIANCE_UNBOUNDED_TILL_CURRENT_ROW(TPE, SAMPLE, OP) \
        do {                                                            \
                TPE *bp1 = (TPE*)b1i.base, *bp2 = (TPE*)b2i.base;       \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                TPE v1 = bp1[k], v2 = bp2[k];           \
@@ -1226,7 +1226,7 @@ GDK_ANALYTICAL_COVARIANCE(covariance_pop
 #define ANALYTICAL_CORRELATION_UNBOUNDED_TILL_CURRENT_ROW(TPE, SAMPLE, OP)     
/* SAMPLE and OP not used */ \
        do {                                                            \
                TPE *bp1 = (TPE*)b1i.base, *bp2 = (TPE*)b2i.base;       \
-               for (; k < i;) {                                        \
+               while (k < i) {                                         \
                        j = k;                                          \
                        do {                                            \
                                TPE v1 = bp1[k], v2 = bp2[k];           \
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1085,6 +1085,7 @@ BUNappendmulti(BAT *b, const void *value
                        if (bi.maxpos != BUN_NONE)
                                maxvalp = BUNtvar(&bi, bi.maxpos);
                        const void *vbase = b->tvheap->base;
+                       Heap *oldheap = b->theap;
                        for (BUN i = 0; i < count; i++) {
                                t = ((void **) values)[i];
                                bool isnil = atomeq(t, atomnil);
@@ -1116,12 +1117,11 @@ BUNappendmulti(BAT *b, const void *value
                                                VALclear(&maxprop);
                                        return rc;
                                }
-                               if (vbase != b->tvheap->base) {
-                                       /* tvheap changed location, so
+                               if (vbase != b->tvheap->base ||
+                                   oldheap != b->theap) {
+                                       /* a heap changed location, so
                                         * pointers may need to be
-                                        * updated (not if they were
-                                        * initialized from t below, but
-                                        * we don't know) */
+                                        * updated */
                                        BUN minpos = bi.minpos;
                                        BUN maxpos = bi.maxpos;
                                        MT_lock_set(&b->theaplock);
@@ -1130,6 +1130,7 @@ BUNappendmulti(BAT *b, const void *value
                                        bi.minpos = minpos;
                                        bi.maxpos = maxpos;
                                        vbase = b->tvheap->base;
+                                       oldheap = b->theap;
                                        if (bi.minpos != BUN_NONE)
                                                minvalp = BUNtvar(&bi, 
bi.minpos);
                                        if (bi.maxpos != BUN_NONE)
@@ -1161,17 +1162,18 @@ BUNappendmulti(BAT *b, const void *value
                        if (maxbound)
                                VALclear(&maxprop);
                        if (b->thash) {
+                               bi.vh = b->tvheap;
                                p -= count;
                                if (b->ustr) {
                                        for (BUN i = 0; i < count; i++) {
                                                var_t o = 
VarHeapVal(b->theap->base, p, b->twidth);
-                                               HASHappend_locked(b, p, &o);
+                                               HASHappend_locked(&bi, p, &o);
                                                p++;
                                        }
                                } else {
                                        for (BUN i = 0; i < count; i++) {
                                                t = ((void **) values)[i];
-                                               HASHappend_locked(b, p, t);
+                                               HASHappend_locked(&bi, p, t);
                                                p++;
                                        }
                                }
@@ -1199,7 +1201,7 @@ BUNappendmulti(BAT *b, const void *value
                                        return rc;
                                }
                                if (b->thash) {
-                                       HASHappend_locked(b, p, t);
+                                       HASHappend_locked(&bi, p, t);
                                }
                                if (!atomeq(t, atomnil)) {
                                        if (p == 0) {
@@ -1233,7 +1235,7 @@ BUNappendmulti(BAT *b, const void *value
                                return rc;
                        }
                        if (b->thash) {
-                               HASHappend_locked(b, p, b->ustr ? &(var_t){0} : 
t);
+                               HASHappend_locked(&bi, p, b->ustr ? &(var_t){0} 
: t);
                        }
                        p++;
                }
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -419,17 +419,18 @@ insert_string_bat(BAT *b, BATiter *ni, s
        MT_lock_set(&b->theaplock);
        BATsetcount(b, oldcnt + ci->ncand);
        assert(b->batCapacity >= b->batCount);
+       BATiter bi = bat_iterator_nolock(b);
        MT_lock_unset(&b->theaplock);
        /* maintain hash */
        if (b->ustr) {
                for (r = oldcnt, cnt = BATcount(b); b->thash && r < cnt; r++) {
                        off = VarHeapVal(Tloc(b, 0), r, b->twidth);
-                       HASHappend_locked(b, r, &off);
+                       HASHappend_locked(&bi, r, &off);
                }
        } else {
                for (r = oldcnt, cnt = BATcount(b); b->thash && r < cnt; r++) {
                        off = VarHeapVal(Tloc(b, 0), r, b->twidth);
-                       HASHappend_locked(b, r, off == 0 ? str_nil : 
b->tvheap->base + off);
+                       HASHappend_locked(&bi, r, off == 0 ? str_nil : 
b->tvheap->base + off);
                }
        }
        BUN nunique = b->thash ? b->thash->nunique : 0;
@@ -505,6 +506,7 @@ append_varsized_bat(BAT *b, BATiter *ni,
                MT_rwlock_wrlock(&b->thashlock);
                MT_lock_set(&b->theaplock);
                BATsetcount(b, BATcount(b) + ci->ncand);
+               BATiter bi = bat_iterator_nolock(b);
                MT_lock_unset(&b->theaplock);
                /* maintain hash table */
                const void *nil = ATOMnilptr(b->ttype);
@@ -512,7 +514,7 @@ append_varsized_bat(BAT *b, BATiter *ni,
                     b->thash && i < BATcount(b);
                     i++) {
                        var_t off = *(var_t *) Tloc(b, i);
-                       HASHappend_locked(b, i, off == 0 ? nil : 
b->tvheap->base + off);
+                       HASHappend_locked(&bi, i, off == 0 ? nil : 
b->tvheap->base + off);
                }
                BUN nunique = b->thash ? b->thash->nunique : 0;
                MT_rwlock_wrunlock(&b->thashlock);
@@ -597,7 +599,7 @@ append_varsized_bat(BAT *b, BATiter *ni,
                BATiter bi = bat_iterator_nolock(b);
                for (BUN i = 0; i < cnt; i++) {
                        const void *t = BUNtvar(&bi, r);
-                       HASHappend_locked(b, r, t);
+                       HASHappend_locked(&bi, r, t);
                        r++;
                }
        }
@@ -1066,6 +1068,9 @@ BATappend2(BAT *b, BAT *n, BAT *s, bool 
                                goto bailout;
                        }
                }
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to