Changeset: 478b906732cb for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=478b906732cb Modified Files: monetdb5/modules/mal/remote.mx Branch: default Log Message:
remote.get: set capacity correctly - set BAT properties afterwards - recalculate the capacity after extending the heaps Signed-off-by: Fabian Groffen <[email protected]> diffs (70 lines): diff --git a/monetdb5/modules/mal/remote.mx b/monetdb5/modules/mal/remote.mx --- a/monetdb5/modules/mal/remote.mx +++ b/monetdb5/modules/mal/remote.mx @@ -1385,6 +1385,32 @@ /* the BAT we will return */ b = BATnew(bb.Htype, bb.Ttype, bb.size); + + /* for strings, the width may not match, fix it to match what we + * retrieved */ + if (bb.Ttype == TYPE_str && bb.size) { + b->T->width = bb.tailsize / bb.size; + b->T->shift = ATOMelmshift(Tsize(b)); + } + + if (bb.headsize > 0) { + HEAPextend(&b->H->heap, bb.headsize); /* cheap if already done */ + mnstr_read(in, b->H->heap.base, bb.headsize, 1); + b->H->heap.dirty = TRUE; + } + if (bb.tailsize > 0) { + HEAPextend(&b->T->heap, bb.tailsize); + mnstr_read(in, b->T->heap.base, bb.tailsize, 1); + b->T->heap.dirty = TRUE; + } + if (bb.theapsize > 0) { + HEAPextend(b->T->vheap, bb.theapsize); + mnstr_read(in, b->T->vheap->base, bb.theapsize, 1); + b->T->vheap->free = bb.theapsize; + b->T->vheap->dirty = TRUE; + } + + /* set properties */ b->hseqbase = bb.Hseqbase; b->tseqbase = bb.Tseqbase; b->hsorted = bb.Hsorted; @@ -1396,32 +1422,10 @@ if (bb.Htype == TYPE_void) b->hdense = TRUE; b->tdense = bb.Tdense; + BATsetcapacity(b, b->T->heap.size >> b->T->shift); BATsetcount(b, (oid)bb.size); b->batDirty = TRUE; - /* for strings, the width may not match, fix it to match what we - * retrieved */ - if (bb.Ttype == TYPE_str && bb.size) { - b->T->width = bb.tailsize / bb.size; - b->T->shift = ATOMelmshift(Tsize(b)); - b->U->capacity = b->T->heap.size >> b->T->shift; - } - - if (bb.headsize > 0) { - mnstr_read(in, b->H->heap.base, bb.headsize, 1); - b->H->heap.dirty = TRUE; - } - if (bb.tailsize > 0) { - mnstr_read(in, b->T->heap.base, bb.tailsize, 1); - b->T->heap.dirty = TRUE; - } - if (bb.theapsize > 0) { - HEAPextend(b->T->vheap, bb.theapsize); /* cheap if already done */ - mnstr_read(in, b->T->vheap->base, bb.theapsize, 1); - b->T->vheap->free = bb.theapsize; - b->T->vheap->dirty = TRUE; - } - /* read blockmode flush */ while (mnstr_read(in, &tmp, 1, 1) != 0) { mnstr_printf(GDKout, "!MALexception:remote.bincopyfrom: expected flush, got: %c", tmp); _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
