Changeset: aa34a8112c10 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/aa34a8112c10 Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_align.c gdk/gdk_bat.c gdk/gdk_private.h gdk/gdk_project.c monetdb5/modules/mal/remote.c Branch: default Log Message:
Fix remote get for string bats to use the correct name for the tail file. diffs (199 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 @@ -233,6 +233,7 @@ gdk_return BUNreplacemulti(BAT *b, const gdk_return BUNreplacemultiincr(BAT *b, oid position, const void *values, BUN count, bool force) __attribute__((__warn_unused_result__)); BAT *COLcopy(BAT *b, int tt, bool writable, 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__)); size_t GDK_mem_maxsize; size_t GDK_vm_maxsize; gdk_return GDKanalytical_correlation(BAT *r, BAT *p, BAT *o, BAT *b1, BAT *b2, BAT *s, BAT *e, int tpe, int frame_type); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -1060,6 +1060,8 @@ 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) + __attribute__((__warn_unused_result__)); gdk_export BAT *BATdense(oid hseq, oid tseq, BUN cnt) __attribute__((__warn_unused_result__)); gdk_export gdk_return BATextend(BAT *b, BUN newcap) diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c --- a/gdk/gdk_align.c +++ b/gdk/gdk_align.c @@ -255,7 +255,7 @@ BATmaterialize(BAT *b) b->tunique_est = is_oid_nil(t) ? 1.0 : (double) b->batCount; MT_lock_unset(&b->theaplock); b->ttype = TYPE_oid; - BATsetdims(b); + BATsetdims(b, 0); b->batDirtydesc = true; BATsetcount(b, b->batCount); diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -171,9 +171,9 @@ ATOMelmshift(int sz) void -BATsetdims(BAT *b) +BATsetdims(BAT *b, uint16_t width) { - b->twidth = b->ttype == TYPE_str ? 1 : ATOMsize(b->ttype); + b->twidth = b->ttype == TYPE_str ? width > 0 ? width : 1 : ATOMsize(b->ttype); b->tshift = ATOMelmshift(b->twidth); assert_shift_width(b->tshift, b->twidth); b->tvarsized = b->ttype == TYPE_void || BATatoms[b->ttype].atomPut != NULL; @@ -204,6 +204,7 @@ settailname(Heap *restrict tail, const c { if (tt == TYPE_str) { switch (width) { + case 0: case 1: strconcat_len(tail->filename, sizeof(tail->filename), physnme, @@ -241,7 +242,7 @@ settailname(Heap *restrict tail, const c * filenames. */ BAT * -COLnew_intern(oid hseq, int tt, BUN cap, role_t role, uint16_t width) +COLnew2(oid hseq, int tt, BUN cap, role_t role, uint16_t width) { BAT *bn; @@ -268,20 +269,11 @@ COLnew_intern(oid hseq, int tt, BUN cap, if (bn == NULL) return NULL; - BATsetdims(bn); + BATsetdims(bn, width); bn->batCapacity = cap; if (ATOMstorage(tt) == TYPE_msk) cap /= 8; /* 8 values per byte */ - else if (tt == TYPE_str) { - if (width != 0) { - /* power of two and not too large */ - assert((width & (width - 1)) == 0); - assert(width <= sizeof(var_t)); - bn->twidth = width; - } - settailname(bn->theap, BBP_physical(bn->batCacheid), tt, bn->twidth); - } /* alloc the main heaps */ if (tt && HEAPalloc(bn->theap, cap, bn->twidth, ATOMsize(bn->ttype)) != GDK_SUCCEED) { @@ -313,7 +305,7 @@ COLnew_intern(oid hseq, int tt, BUN cap, BAT * COLnew(oid hseq, int tt, BUN cap, role_t role) { - return COLnew_intern(hseq, tt, cap, role, 0); + return COLnew2(hseq, tt, cap, role, 0); } BAT * @@ -835,16 +827,15 @@ COLcopy(BAT *b, int tt, bool writable, r slowcopy = true; } - bn = COLnew_intern(b->hseqbase, tt, bi.count, role, bi.width); + bn = COLnew2(b->hseqbase, tt, bi.count, role, bi.width); if (bn == NULL) { bat_iterator_end(&bi); return NULL; } if (bn->tvheap != NULL && bn->tvheap->base == NULL) { /* this combination can happen since the last - * argument of COLnew_intern not being zero - * triggers a skip in the allocation of the - * tvheap */ + * argument of COLnew2 not being zero triggers a + * skip in the allocation of the tvheap */ if (ATOMheap(bn->ttype, bn->tvheap, bn->batCapacity) != GDK_SUCCEED) { bat_iterator_end(&bi); BBPreclaim(bn); @@ -2787,4 +2778,3 @@ BATassertProps(BAT *b) } MT_lock_unset(&b->theaplock); } - diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -83,7 +83,7 @@ void BATrmprop_nolock(BAT *b, enum prop_ __attribute__((__visibility__("hidden"))); gdk_return BATsave_locked(BAT *bd, BATiter *bi, BUN size) __attribute__((__visibility__("hidden"))); -void BATsetdims(BAT *b) +void BATsetdims(BAT *b, uint16_t width) __attribute__((__visibility__("hidden"))); ValPtr BATsetprop(BAT *b, enum prop_t idx, int type, const void *v) __attribute__((__visibility__("hidden"))); @@ -125,9 +125,6 @@ BUN binsearch_flt(const oid *restrict in __attribute__((__visibility__("hidden"))); BUN binsearch_dbl(const oid *restrict indir, oid offset, const dbl *restrict vals, BUN lo, BUN hi, dbl v, int ordering, int last) __attribute__((__visibility__("hidden"))); -BAT *COLnew_intern(oid hseq, int tt, BUN cap, role_t role, uint16_t width) - __attribute__((__warn_unused_result__)) - __attribute__((__visibility__("hidden"))); Heap *createOIDXheap(BAT *b, bool stable) __attribute__((__visibility__("hidden"))); void doHASHdestroy(BAT *b, Hash *hs) diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c --- a/gdk/gdk_project.c +++ b/gdk/gdk_project.c @@ -710,7 +710,7 @@ BATproject2(BAT *restrict l, BAT *restri r1i = bat_iterator(r1); r2i = bat_iterator(r2); } - bn = COLnew_intern(l->hseqbase, ATOMtype(r1->ttype), lcount, TRANSIENT, stringtrick ? r1i.width : 0); + bn = COLnew2(l->hseqbase, ATOMtype(r1->ttype), lcount, TRANSIENT, stringtrick ? r1i.width : 0); if (bn == NULL) { goto doreturn; } @@ -965,7 +965,7 @@ BATprojectchain(BAT **bats) bi = bat_iterator(b); if (nonil && ATOMstorage(tpe) == TYPE_str && b->batRestricted == BAT_READ) { stringtrick = true; - bn = COLnew_intern(ba[0].hlo, tpe, ba[0].cnt, TRANSIENT, bi.width); + bn = COLnew2(ba[0].hlo, tpe, ba[0].cnt, TRANSIENT, bi.width); if (bn && bn->tvheap) { /* no need to remove any files since they were * never created for this bat */ diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c --- a/monetdb5/modules/mal/remote.c +++ b/monetdb5/modules/mal/remote.c @@ -726,17 +726,10 @@ RMTinternalcopyfrom(BAT **ret, char *hdr hdr++; } - b = COLnew(0, bb.Ttype, bb.size, TRANSIENT); + b = COLnew2(0, bb.Ttype, bb.size, TRANSIENT, bb.size > 0 ? (uint16_t) (bb.tailsize / bb.size) : 0); if (b == NULL) throw(MAL, "remote.get", SQLSTATE(HY013) MAL_MALLOC_FAIL); - /* for strings, the width may not match, fix it to match what we - * retrieved */ - if (bb.Ttype == TYPE_str && bb.size) { - b->twidth = (unsigned short) (bb.tailsize / bb.size); - b->tshift = ATOMelmshift(Tsize(b)); - } - if (bb.tailsize > 0) { if (HEAPextend(b->theap, bb.tailsize, true) != GDK_SUCCEED || mnstr_read(in, b->theap->base, bb.tailsize, 1) < 0) @@ -744,7 +737,9 @@ RMTinternalcopyfrom(BAT **ret, char *hdr b->theap->dirty = true; } if (bb.theapsize > 0) { - if (HEAPextend(b->tvheap, bb.theapsize, true) != GDK_SUCCEED || + if ((b->tvheap->base == NULL && + (*BATatoms[b->ttype].atomHeap)(b->tvheap, b->batCapacity) != GDK_SUCCEED) || + HEAPextend(b->tvheap, bb.theapsize, true) != GDK_SUCCEED || mnstr_read(in, b->tvheap->base, bb.theapsize, 1) < 0) goto bailout; b->tvheap->free = bb.theapsize; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list