Changeset: 1f941c030e28 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1f941c030e28
Modified Files:
monetdb5/modules/mal/Tests/mosaic_literal.stable.out
monetdb5/modules/mal/Tests/mosaic_literal_subselect.mal
monetdb5/modules/mal/mosaic.c
monetdb5/modules/mal/mosaic.h
Branch: mosaic
Log Message:
Make the compression fit for strings.
But we are going to ignore compressed string heaps for the time
being, as they blow up the code further. The overall effect is also less
prominent, due to the variable width.
diffs (106 lines):
diff --git a/monetdb5/modules/mal/Tests/mosaic_literal.stable.out
b/monetdb5/modules/mal/Tests/mosaic_literal.stable.out
--- a/monetdb5/modules/mal/Tests/mosaic_literal.stable.out
+++ b/monetdb5/modules/mal/Tests/mosaic_literal.stable.out
@@ -30,6 +30,14 @@ function user.main():void;
#mosaic.dump(x);
z := mosaic.decompress(x);
io.print(z);
+ s := bat.new(:oid,:str);
+ bat.append(s,"the");
+ bat.append(s,"big");
+ bat.append(s,"brown");
+ bat.append(s,"fox");
+ y := mosaic.compress(s,"literal");
+ zs := mosaic.decompress(y);
+ io.print(zs);
end main;
#--------------------------#
# h t # name
@@ -51,6 +59,14 @@ end main;
[ 3@0, 50 ]
[ 4@0, 19531015 ]
[ 5@0, 9 ]
+#--------------------------#
+# h t # name
+# void str # type
+#--------------------------#
+[ 0@0, "the" ]
+[ 1@0, "big" ]
+[ 2@0, "brown" ]
+[ 3@0, "fox" ]
# 23:21:09 >
# 23:21:09 > "Done."
diff --git a/monetdb5/modules/mal/Tests/mosaic_literal_subselect.mal
b/monetdb5/modules/mal/Tests/mosaic_literal_subselect.mal
--- a/monetdb5/modules/mal/Tests/mosaic_literal_subselect.mal
+++ b/monetdb5/modules/mal/Tests/mosaic_literal_subselect.mal
@@ -97,15 +97,15 @@ io.print(s);
xs:= mosaic.subselect(x,c,nil:int,nil:int,false,false,true);
io.print(xs);
-s:= bat.new(:oid,:str);
-bat.append(s,"the");
-bat.append(s,"big");
-bat.append(s,"brown");
-bat.append(s,"fox");
+bstr:= bat.new(:oid,:str);
+bat.append(bstr,"the");
+bat.append(bstr,"big");
+bat.append(bstr,"brown");
+bat.append(bstr,"fox");
-ys:= mosaic.compress(s,"literal");
+ystr:= mosaic.compress(bstr,"literal");
-t:= algebra.subselect(s,"big","fox",true,true,false);
-io.print(t);
-t:= mosaic.subselect(ys,"big","fox",true,true,false);
-io.print(t);
+tstr:= algebra.subselect(bstr,"big","fox",true,true,false);
+io.print(tstr);
+tstr:= mosaic.subselect(ystr,"big","fox",true,true,false);
+io.print(tstr);
diff --git a/monetdb5/modules/mal/mosaic.c b/monetdb5/modules/mal/mosaic.c
--- a/monetdb5/modules/mal/mosaic.c
+++ b/monetdb5/modules/mal/mosaic.c
@@ -450,6 +450,9 @@ MOScompressInternal(Client cntxt, int *r
BBPreleaseref(bsrc->batCacheid);
} else {
BATsetcount(bsrc,BATcount(bcompress));
+ // retain the stringwidth
+ bsrc->T->width = bcompress->T->width ;
+ bsrc->T->shift = bcompress->T->shift ;
bsrc->T->heap.dirty = 1;
bsrc->T->heap.free = (size_t) (task->dst -
Tloc(bsrc,BUNfirst(bsrc)) );
bsrc->T->heap.compressed= 1;
@@ -522,7 +525,8 @@ MOSdecompressInternal(Client cntxt, int
throw(MAL, "mosaic.decompress", "cannot decompress tail-VIEW");
}
- bsrc = BATnew(b->htype,b->ttype,BATgrows(b)+ MosaicHdrSize,TRANSIENT);
+ // use a copy to ensure you get the vheap as well
+ bsrc = BATcopy(b,b->htype,b->ttype,TRUE, TRANSIENT);
if ( bsrc == NULL) {
BBPreleaseref(b->batCacheid);
throw(MAL, "mosaic.decompress", MAL_MALLOC_FAIL);
@@ -637,6 +641,8 @@ MOSdecompressInternal(Client cntxt, int
} else {
BATsetcount(bsrc,BATcount(b));
bsrc->batDirty = 1;
+ bsrc->T->width = b->T->width;
+ bsrc->T->shift = b->T->shift;
bsrc->T->heap.free = (size_t) (BATcount(b) * b->T->width);
bsrc->T->heap.compressed= 0;
bsrc->hdense = 1;
diff --git a/monetdb5/modules/mal/mosaic.h b/monetdb5/modules/mal/mosaic.h
--- a/monetdb5/modules/mal/mosaic.h
+++ b/monetdb5/modules/mal/mosaic.h
@@ -66,7 +66,7 @@ typedef struct MOSAICHEADER{
int sumint;
oid sumoid;
lng sumlng;
-#ifdef HAVE_hge
+#ifdef HAVE_HGE
hge sumhge;
#endif
wrd sumwrd;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list