Changeset: 1b09c24fd64f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1b09c24fd64f
Modified Files:
monetdb5/modules/mal/remote.mx
Branch: default
Log Message:
remote.get: allow binary get of simple head types
Since we will be facing non-dense OID heads next to VOID heads, also
transfer the head if it is a non-varsized type. This allows to ship
intermediates for instance.
diffs (98 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
@@ -649,7 +649,7 @@
rt, ident);
GDKfree(rt);
- if (isaBatType(rtype) && (localtype == 0 || localtype != c->type ||
(getHeadType(rtype) != TYPE_void && getHeadType(rtype) != TYPE_oid)))
+ if (isaBatType(rtype) && (localtype == 0 || localtype != c->type ||
(ATOMvarsized(getHeadType(rtype)))))
{
int h, t, s;
ptr l, r;
@@ -1201,6 +1201,7 @@
{
int bid = *(int *)getArgReference(stk, pci, 1);
BAT *b = BBPquickdesc(bid, FALSE);
+ char sendhead = 0;
(void)mb;
(void)stk;
@@ -1208,30 +1209,37 @@
if (b == NULL)
throw(MAL, "remote.bincopyto", RUNTIME_OBJECT_UNDEFINED);
- if (!(b->htype == TYPE_void || (b->htype == TYPE_oid && b->H->dense)))
- throw(ILLARG, "remote.bincopyto", "only void-headed BATs are
supported");
+ if (b->hvarsized)
+ throw(ILLARG, "remote.bincopyto", "varsized-headed BATs are not
supported");
BBPincref(bid, FALSE);
+ sendhead = b->htype != TYPE_void && (b->htype != TYPE_oid ||
!b->H->dense);
+
mnstr_printf(cntxt->fdout, /*JSON*/"{"
"\"version\":1,"
"\"htype\":%d,"
"\"ttype\":%d,"
"\"seqbase\":" OIDFMT ","
"\"size\":" SZFMT ","
+ "\"headsize\":" SZFMT ","
"\"tailsize\":" SZFMT ","
"\"theapsize\":" SZFMT
"}\n",
- TYPE_void,
+ sendhead ? b->htype : TYPE_void,
b->ttype,
b->hseqbase == oid_nil ? 0 : b->hseqbase,
b->batCount,
+ sendhead ? b->batCount * Hsize(b) : 0,
b->batCount * Tsize(b),
- b->tvarsized ? b->T->vheap->free : 0
+ b->tvarsized && b->batCount > 0 ? b->T->vheap->free : 0
);
+ if (sendhead)
+ mnstr_write(cntxt->fdout, /* head */
+ Hloc(b, BUNfirst(b)), b->batCount * Hsize(b),
1);
mnstr_write(cntxt->fdout, /* tail */
Tloc(b, BUNfirst(b)), b->batCount * Tsize(b), 1);
- if (b->tvarsized)
+ if (b->batCount > 0 && b->tvarsized)
mnstr_write(cntxt->fdout, /* theap */
Tbase(b), b->T->vheap->free, 1);
/* flush is done by the calling environment (MAL) */
@@ -1249,6 +1257,7 @@
int Ttype;
oid seqbase;
size_t size;
+ size_t headsize;
size_t tailsize;
size_t theapsize;
} binbat;
@@ -1256,7 +1265,7 @@
static inline str
RMTinternalcopyfrom(BAT **ret, char *hdr, stream *in)
{
- binbat bb = { 0, 0, 0, 0, 0, 0 };
+ binbat bb = { 0, 0, 0, 0, 0, 0, 0 };
char *nme = NULL;
char *val = NULL;
char tmp;
@@ -1304,6 +1313,8 @@
bb.seqbase = (oid)atol(val);
} else if (strcmp(nme, "size") == 0) {
bb.size = atol(val);
+ } else if (strcmp(nme, "headsize") == 0) {
+ bb.headsize = atol(val);
} else if (strcmp(nme, "tailsize") == 0) {
bb.tailsize = atol(val);
} else if (strcmp(nme, "theapsize") == 0) {
@@ -1325,6 +1336,8 @@
if (bb.size > 0 && bb.Ttype == TYPE_str)
b->T->width = bb.tailsize / bb.size;
+ if (bb.headsize > 0)
+ mnstr_read(in, b->H->heap.base, bb.headsize, 1);
mnstr_read(in, b->T->heap.base, bb.tailsize, 1);
b->batCount = bb.size;
if (bb.theapsize > 0) {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list