Changeset: 514366014571 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=514366014571
Modified Files:
monetdb5/modules/mal/xid.c
monetdb5/modules/mal/xid.mal
monetdb5/optimizer/opt_xid.c
Branch: xid
Log Message:
prepare XID optimizer and MAL signatures for [:oid,:any] & [:any,:oid] BATs;
implementation for now does not compress them, but simply return the original
diffs (101 lines):
diff --git a/monetdb5/modules/mal/xid.c b/monetdb5/modules/mal/xid.c
--- a/monetdb5/modules/mal/xid.c
+++ b/monetdb5/modules/mal/xid.c
@@ -300,6 +300,14 @@ XIDcompress(Client cntxt, MalBlkPtr mb,
(void) mb;
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "xid.compress", INTERNAL_BAT_ACCESS);
+ assert(ATOMtype(b->htype) == TYPE_oid || ATOMtype(b->ttype) ==
TYPE_oid);
+ if (ATOMtype(b->htype) != TYPE_oid || ATOMtype(b->ttype) != TYPE_oid) {
+ /* cannot (yet?) compress */
+ mnstr_printf(cntxt->fdout,"#xid head or tail not oid
%d\n",getArg(pci,1));
+ BBPkeepref(*ret = b->batCacheid);
+ return MAL_SUCCEED;
+ }
+ assert(ATOMtype(b->htype) == TYPE_oid && ATOMtype(b->ttype) ==
TYPE_oid);
if (b->H->heap.xidcompressed || b->T->heap.xidcompressed) {
BBPreleaseref(b->batCacheid);
throw(MAL, "xid.compress", "cannot compress already
%s%scompressed BAT",
@@ -308,7 +316,6 @@ XIDcompress(Client cntxt, MalBlkPtr mb,
cnt = BATcount(b);
ht = b->htype;
tt = b->ttype;
- assert(ATOMtype(ht) == TYPE_oid && ATOMtype(tt) == TYPE_oid);
if ( isVIEW(b) || isVIEWCOMBINE(b) || cnt == 0 || (ht == TYPE_void &&
tt == TYPE_void) ) {
/* no need to compress */
mnstr_printf(cntxt->fdout,"#xid %s view %d\n",(cnt==0 ?
"empty":""), getArg(pci,1));
@@ -494,11 +501,12 @@ XIDdecompress(Client cntxt, MalBlkPtr mb
(void) mb;
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "xid.decompress", INTERNAL_BAT_ACCESS);
- assert(ATOMtype(b->htype) == TYPE_oid && ATOMtype(b->ttype) ==
TYPE_oid);
+ assert(ATOMtype(b->htype) == TYPE_oid || ATOMtype(b->ttype) ==
TYPE_oid);
if (!b->H->heap.xidcompressed && !b->T->heap.xidcompressed) {
BBPkeepref(*ret = b->batCacheid);
return MAL_SUCCEED;
}
+ assert(ATOMtype(b->htype) == TYPE_oid && ATOMtype(b->ttype) ==
TYPE_oid);
if (isVIEW(b)) {
BBPreleaseref(b->batCacheid);
throw(MAL, "xid.decompress", "cannot decompress view");
@@ -586,6 +594,7 @@ XIDdump(void *ret, bat *bid)
if ((b = BATdescriptor(*bid)) == NULL)
throw(MAL, "xid.dump", INTERNAL_BAT_ACCESS);
+ assert(ATOMtype(b->htype) == TYPE_oid || ATOMtype(b->ttype) ==
TYPE_oid);
if ( b->T->heap.xidcompressed){
col = (XIDcolumn) b->T->heap.base;
lim = (BUN) col[XID_IDX_COMP].count;
diff --git a/monetdb5/modules/mal/xid.mal b/monetdb5/modules/mal/xid.mal
--- a/monetdb5/modules/mal/xid.mal
+++ b/monetdb5/modules/mal/xid.mal
@@ -1,15 +1,28 @@
module xid;
-pattern compress(b:bat[:oid,:oid]) (xid:bat[:oid,:oid])
+
+pattern compress(b:bat[:oid,:any_2]) (xid:bat[:oid,:any_2])
address XIDcompress
-comment "Compress the tail oid list";
+comment "Compress oid column(s)";
-pattern decompress(b:bat[:oid,:oid]) :bat[:oid,:oid]
+pattern decompress(b:bat[:oid,:any_2]) :bat[:oid,:any_2]
address XIDdecompress
-comment "Decompress an oid list";
+comment "Decompress oid column(s)";
-command dump(b:bat[:oid,:oid])
+command dump(b:bat[:oid,:any_2])
address XIDdump
-comment "Dump the encoding table";
+comment "Dump the encoding table(s)";
+pattern compress(b:bat[:any_1,:oid]) (xid:bat[:any_1,:oid])
+address XIDcompress
+comment "Compress oid column(s)";
+
+pattern decompress(b:bat[:any_1,:oid]) :bat[:any_1,:oid]
+address XIDdecompress
+comment "Decompress oid column(s)";
+
+command dump(b:bat[:any_1,:oid])
+address XIDdump
+comment "Dump the encoding table(s)";
+
diff --git a/monetdb5/optimizer/opt_xid.c b/monetdb5/optimizer/opt_xid.c
--- a/monetdb5/optimizer/opt_xid.c
+++ b/monetdb5/optimizer/opt_xid.c
@@ -64,9 +64,9 @@ OPTxidImplementation(Client cntxt, MalBl
getArg(q,0) = getArg(p,j);
}
- /* compress the result, now only on oid-oid */
+ /* compress the result, if at least one column is :oid */
for ( j =0, type= getVarType(mb,getArg(p,j)); j< p->retc; j++,
type= getVarType(mb,getArg(p,j)))
- if ( getTailType(type) == TYPE_oid && getHeadType(type) ==
TYPE_oid && alias[getArg(p,j)]==0 ){
+ if ( (getTailType(type) == TYPE_oid || getHeadType(type) ==
TYPE_oid) && alias[getArg(p,j)]==0 ){
mnstr_printf(GDKout,"#got candidate %d head %d tail
%d\n",getArg(p,j), getHeadType(getVarType(mb,getArg(p,j))),
getTailType(getVarType(mb,getArg(p,j))));
q = newStmt(mb,"xid","compress");
q= pushArgument(mb,q, getArg(p,j));
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list