Changeset: 4386881fd1f5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4386881fd1f5
Modified Files:
        gdk/gdk.h
        gdk/gdk_atoms.h
        monetdb5/modules/kernel/vss.c
Branch: nested
Log Message:

merge upstream


diffs (truncated from 1812 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
@@ -1,7 +1,7 @@
 # gdk
 int ALIGNsynced(BAT *b1, BAT *b2);
 int ATOMallocate(const char *nme);
-uint8_t ATOMelmshift(int sz) __attribute__((__const__));
+uint8_t ATOMelmshift(uint32_t sz) __attribute__((__const__));
 char *ATOMformat(allocator *ma, int id, const void *val) 
__attribute__((__warn_unused_result__));
 gdk_return ATOMheap(int id, Heap *hp, size_t cap) 
__attribute__((__warn_unused_result__));
 int ATOMindex(const char *nme);
@@ -248,7 +248,7 @@ const void *BUNtpos(BATiter *bi, BUN p) 
 BAT *COLcopy(BAT *b, int tt, bool writable, role_t role);
 BAT *COLcopy2(BAT *b, int tt, bool writable, bool mayshare, role_t role);
 BAT *COLnew(oid hseq, int tltype, BUN capacity, role_t role) 
__attribute__((__warn_unused_result__));
-BAT *COLnew2(oid hseq, int tt, BUN cap, role_t role, uint16_t width) 
__attribute__((__warn_unused_result__));
+BAT *COLnew2(oid hseq, int tt, BUN cap, role_t role, uint32_t width) 
__attribute__((__warn_unused_result__));
 size_t GDK_mem_maxsize;
 size_t GDK_vm_maxsize;
 BAT *GDKanalytical_correlation(BAT *p, BAT *o, BAT *b1, BAT *b2, BAT *s, BAT 
*e, int tpe, int frame_type) __attribute__((__warn_unused_result__));
@@ -316,7 +316,7 @@ int GDKnr_threads;
 void GDKprepareExit(void);
 void GDKprintinfo(void);
 void GDKprintinforegister(void (*func)(void));
-void GDKqsort(void *restrict h, void *restrict t, const void *restrict base, 
size_t n, int hs, int ts, int tpe, bool reverse, bool nilslast);
+void GDKqsort(void *restrict h, void *restrict t, const void *restrict base, 
size_t n, size_t hs, size_t ts, int tpe, bool reverse, bool nilslast);
 void *GDKrealloc(void *pold, size_t size) __attribute__((__alloc_size__(2))) 
__attribute__((__warn_unused_result__));
 gdk_return GDKrebuild_segment_tree(oid ncount, oid data_size, Heap *st, void 
**segment_tree, oid **levels_offset, oid *nlevels);
 void GDKreset(int status);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -405,7 +405,7 @@ typedef struct BAT {
        BUN batCapacity;        /* tuple capacity */
 
        /* dynamic column properties */
-       uint16_t twidth;        /* byte-width of the atom array */
+       uint32_t twidth;        /* byte-width of the atom array */
        int8_t ttype;           /* type id. */
        uint8_t tshift;         /* log2 of bun width */
        /* see also comment near BATassertProps() for more information
@@ -611,7 +611,7 @@ typedef struct BATiter {
        BUN nosorted, norevsorted;
        BUN minpos, maxpos;
        double unique_est;
-       uint16_t width;
+       uint32_t width;
        uint8_t shift;
        int8_t type;
        bool key:1,
@@ -779,7 +779,7 @@ gdk_export void HEAP_free(Heap *heap, va
 
 gdk_export BAT *COLnew(oid hseq, int tltype, BUN capacity, role_t role)
        __attribute__((__warn_unused_result__));
-gdk_export BAT *COLnew2(oid hseq, int tt, BUN cap, role_t role, uint16_t width)
+gdk_export BAT *COLnew2(oid hseq, int tt, BUN cap, role_t role, uint32_t width)
        __attribute__((__warn_unused_result__));
 gdk_export BAT *BATdense(oid hseq, oid tseq, BUN cnt)
        __attribute__((__warn_unused_result__));
@@ -787,7 +787,7 @@ gdk_export gdk_return BATextend(BAT *b, 
        __attribute__((__warn_unused_result__));
 
 /* internal */
-gdk_export uint8_t ATOMelmshift(int sz)
+gdk_export uint8_t ATOMelmshift(uint32_t sz)
        __attribute__((__const__));
 gdk_export gdk_return ATOMheap(int id, Heap *hp, size_t cap)
        __attribute__((__warn_unused_result__));
@@ -1028,7 +1028,7 @@ gdk_export gdk_return BATsort(BAT **sort
        __attribute__((__warn_unused_result__));
 
 
-gdk_export void GDKqsort(void *restrict h, void *restrict t, const void 
*restrict base, size_t n, int hs, int ts, int tpe, bool reverse, bool nilslast);
+gdk_export void GDKqsort(void *restrict h, void *restrict t, const void 
*restrict base, size_t n, size_t hs, size_t ts, int tpe, bool reverse, bool 
nilslast);
 
 /* BAT is dense (i.e., BATtvoid() is true and tseqbase is not NIL) */
 __attribute__((__pure__))
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
@@ -299,7 +299,7 @@ GDKanalyticalfirst(BAT *b, BAT *s, BAT *
                                has_nils |= atomeq(curval, nil);
                        }
                } else {
-                       uint16_t width = r->twidth;
+                       uint32_t width = r->twidth;
                        uint8_t *restrict rcast = (uint8_t *) Tloc(r, 0);
                        for (; k < cnt; k++) {
                                const void *curval = (end[k] > start[k]) ? 
BUNtloc(&bi, start[k]) : nil;
@@ -393,7 +393,7 @@ GDKanalyticallast(BAT *b, BAT *s, BAT *e
                                has_nils |= atomeq(curval, nil);
                        }
                } else {
-                       uint16_t width = r->twidth;
+                       uint32_t width = r->twidth;
                        uint8_t *restrict rcast = (uint8_t *) Tloc(r, 0);
                        for (; k < cnt; k++) {
                                const void *curval = (end[k] > start[k]) ? 
BUNtloc(&bi, end[k] - 1) : nil;
@@ -530,7 +530,7 @@ GDKanalyticalnthvalue(BAT *b, BAT *s, BA
                                }
                        } else {
                                uint8_t *restrict rcast = (uint8_t *) Tloc(r, 
0);
-                               uint16_t width = r->twidth;
+                               uint32_t width = r->twidth;
                                for (; k < cnt; k++) {
                                        lng lnth = tp[k];
                                        if (!is_lng_nil(nth) && nth <= 0) goto 
invalidnth;
@@ -604,7 +604,7 @@ GDKanalyticalnthvalue(BAT *b, BAT *s, BA
                                        }
                                }
                        } else {
-                               uint16_t width = r->twidth;
+                               uint32_t width = r->twidth;
                                uint8_t *restrict rcast = (uint8_t *) Tloc(r, 
0);
                                if (is_lng_nil(nth)) {
                                        has_nils = true;
@@ -1351,6 +1351,12 @@ minmaxvarsized##IMP:                                     
                \
 BAT *                                                                  \
 GDKanalytical##OP(BAT *p, BAT *o, BAT *b, BAT *s, BAT *e, int tpe, int 
frame_type) \
 {                                                                      \
+       if (!ATOMlinear(b->ttype)) {                                    \
+               /* there is no such thing as a smallest/largest value if \
+                * you can't compare values */                          \
+               GDKerror("non-linear type");                            \
+               return NULL;                                            \
+       }                                                               \
        lng t0 = 0;                                                     \
        TRC_DEBUG_IF(ALGO) t0 = GDKusec();                              \
        BAT *r = COLnew(b->hseqbase, b->ttype, BATcount(b), TRANSIENT); \
@@ -1370,7 +1376,7 @@ GDKanalytical##OP(BAT *p, BAT *o, BAT *b
        bool (*atomeq)(const void *, const void *) = ATOMequal(tpe);    \
        void *segment_tree = NULL;                                      \
        gdk_return res = GDK_SUCCEED;                                   \
-       uint16_t width = r->twidth;                                     \
+       uint32_t width = r->twidth;                                     \
        uint8_t *restrict rcast = (uint8_t *) Tloc(r, 0);               \
        Heap *st = NULL;                                                \
                                                                        \
diff --git a/gdk/gdk_atoms.h b/gdk/gdk_atoms.h
--- a/gdk/gdk_atoms.h
+++ b/gdk/gdk_atoms.h
@@ -450,7 +450,7 @@ strEq(const char *l, const char *r)
 
 __attribute__((__pure__))
 static inline size_t
-VarHeapVal(const void *b, BUN p, int w)
+VarHeapVal(const void *b, BUN p, uint32_t w)
 {
        switch (w) {
        case 1:
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -109,7 +109,7 @@ BUNtpos(BATiter *bi, BUN p)
 }
 
 BAT *
-BATcreatedesc(oid hseq, int tt, bool heapnames, role_t role, uint16_t width)
+BATcreatedesc(oid hseq, int tt, bool heapnames, role_t role, uint32_t width)
 {
        bat bid;
        BAT *bn;
@@ -202,10 +202,10 @@ BATcreatedesc(oid hseq, int tt, bool hea
 }
 
 uint8_t
-ATOMelmshift(int sz)
+ATOMelmshift(uint32_t sz)
 {
        uint8_t sh;
-       int i = sz >> 1;
+       uint32_t i = sz >> 1;
 
        for (sh = 0; i != 0; sh++) {
                i >>= 1;
@@ -215,7 +215,7 @@ ATOMelmshift(int sz)
 
 
 void
-BATsetdims(BAT *b, uint16_t width)
+BATsetdims(BAT *b, uint32_t width)
 {
        b->twidth = b->ttype == TYPE_str ? width > 0 ? width : 1 : 
ATOMsize(b->ttype);
        b->tshift = ATOMelmshift(b->twidth);
@@ -245,7 +245,7 @@ BATtailname(const BAT *b)
 }
 
 void
-settailname(Heap *restrict tail, const char *restrict physnme, int tt, int 
width)
+settailname(Heap *restrict tail, const char *restrict physnme, int tt, 
uint32_t width)
 {
        if (tt == TYPE_str) {
                switch (width) {
@@ -289,7 +289,7 @@ settailname(Heap *restrict tail, const c
  * filenames.
  */
 BAT *
-COLnew2(oid hseq, int tt, BUN cap, role_t role, uint16_t width)
+COLnew2(oid hseq, int tt, BUN cap, role_t role, uint32_t width)
 {
        BAT *bn;
 
@@ -1040,21 +1040,23 @@ BUNappendmulti(BAT *b, const void *value
        const void *t = b->ttype == TYPE_msk ? &(msk){false} : 
ATOMnilptr(b->ttype);
        MT_lock_set(&b->theaplock);
        BATiter bi = bat_iterator_nolock(b);
-       const ValRecord *prop;
        ValRecord minprop, maxprop;
        const void *minbound = NULL, *maxbound = NULL;
-       if ((prop = BATgetprop_nolock(b, GDK_MIN_BOUND)) != NULL &&
-           VALcopy(NULL, &minprop, prop) != NULL)
-               minbound = VALptr(&minprop);
-       if ((prop = BATgetprop_nolock(b, GDK_MAX_BOUND)) != NULL &&
-           VALcopy(NULL, &maxprop, prop) != NULL)
-               maxbound = VALptr(&maxprop);
+       if (ATOMlinear(b->ttype)) {
+               const ValRecord *prop;
+               if ((prop = BATgetprop_nolock(b, GDK_MIN_BOUND)) != NULL &&
+                   VALcopy(NULL, &minprop, prop) != NULL)
+                       minbound = VALptr(&minprop);
+               if ((prop = BATgetprop_nolock(b, GDK_MAX_BOUND)) != NULL &&
+                   VALcopy(NULL, &maxprop, prop) != NULL)
+                       maxbound = VALptr(&maxprop);
+       }
        const bool notnull = BATgetprop_nolock(b, GDK_NOT_NULL) != NULL;
        bool setnil = false;
        MT_lock_unset(&b->theaplock);
        MT_rwlock_wrlock(&b->thashlock);
        if (values && b->ttype) {
-               int (*atomcmp) (const void *, const void *) = 
ATOMcompare(b->ttype);
+               int (*atomcmp) (const void *, const void *) = 
ATOMlinear(b->ttype) ? ATOMcompare(b->ttype) : NULL;
                bool (*atomeq) (const void *, const void *) = 
ATOMequal(b->ttype);
                const void *atomnil = ATOMnilptr(b->ttype);
                const void *minvalp = NULL, *maxvalp = NULL;
@@ -1115,19 +1117,21 @@ BUNappendmulti(BAT *b, const void *value
                                                maxvalp = BUNtvar(&bi, 
bi.maxpos);
                                }
                                if (!isnil) {
-                                       if (p == 0) {
-                                               bi.minpos = bi.maxpos = 0;
-                                               minvalp = maxvalp = t;
-                                       } else {
-                                               if (bi.minpos != BUN_NONE &&
-                                                   atomcmp(minvalp, t) > 0) {
-                                                       bi.minpos = p;
-                                                       minvalp = t;
-                                               }
-                                               if (bi.maxpos != BUN_NONE &&
-                                                   atomcmp(maxvalp, t) < 0) {
-                                                       bi.maxpos = p;
-                                                       maxvalp = t;
+                                       if (atomcmp != NULL) {
+                                               if (p == 0) {
+                                                       bi.minpos = bi.maxpos = 
0;
+                                                       minvalp = maxvalp = t;
+                                               } else {
+                                                       if (bi.minpos != 
BUN_NONE &&
+                                                           atomcmp(minvalp, t) 
> 0) {
+                                                               bi.minpos = p;
+                                                               minvalp = t;
+                                                       }
+                                                       if (bi.maxpos != 
BUN_NONE &&
+                                                           atomcmp(maxvalp, t) 
< 0) {
+                                                               bi.maxpos = p;
+                                                               maxvalp = t;
+                                                       }
                                                }
                                        }
                                } else {
@@ -1173,19 +1177,21 @@ BUNappendmulti(BAT *b, const void *value
                                        HASHappend_locked(b, p, t);
                                }
                                if (!atomeq(t, atomnil)) {
-                                       if (p == 0) {
-                                               bi.minpos = bi.maxpos = 0;
-                                               minvalp = maxvalp = t;
-                                       } else {
-                                               if (bi.minpos != BUN_NONE &&
-                                                   atomcmp(minvalp, t) > 0) {
-                                                       bi.minpos = p;
-                                                       minvalp = t;
-                                               }
-                                               if (bi.maxpos != BUN_NONE &&
-                                                   atomcmp(maxvalp, t) < 0) {
-                                                       bi.maxpos = p;
-                                                       maxvalp = t;
+                                       if (atomcmp != NULL) {
+                                               if (p == 0) {
+                                                       bi.minpos = bi.maxpos = 
0;
+                                                       minvalp = maxvalp = t;
+                                               } else {
+                                                       if (bi.minpos != 
BUN_NONE &&
+                                                           atomcmp(minvalp, t) 
> 0) {
+                                                               bi.minpos = p;
+                                                               minvalp = t;
+                                                       }
+                                                       if (bi.maxpos != 
BUN_NONE &&
+                                                           atomcmp(maxvalp, t) 
< 0) {
+                                                               bi.maxpos = p;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to