Skip to content
Snippets Groups Projects
Commit f3bcf0db authored by Mick Jordan's avatar Mick Jordan
Browse files

fix bad merge

parent 746cb631
No related branches found
No related tags found
No related merge requests found
...@@ -344,16 +344,16 @@ public class HiddenInternalFunctions { ...@@ -344,16 +344,16 @@ public class HiddenInternalFunctions {
@Override @Override
protected void createCasts(CastBuilder casts) { protected void createCasts(CastBuilder casts) {
casts.toInteger(3); casts.toInteger(2).toInteger(3);
} }
@Specialization @Specialization
protected RIntVector lazyLoadDBinsertValue(VirtualFrame frame, Object value, RAbstractStringVector file, byte asciiL, int compression, RFunction hook) { protected RIntVector lazyLoadDBinsertValue(VirtualFrame frame, Object value, RAbstractStringVector file, int asciiL, int compression, RFunction hook) {
return lazyLoadDBinsertValueInternal(frame.materialize(), value, file, asciiL, compression, hook); return lazyLoadDBinsertValueInternal(frame.materialize(), value, file, asciiL, compression, hook);
} }
@TruffleBoundary @TruffleBoundary
private RIntVector lazyLoadDBinsertValueInternal(MaterializedFrame frame, Object value, RAbstractStringVector file, byte asciiL, int compression, RFunction hook) { private RIntVector lazyLoadDBinsertValueInternal(MaterializedFrame frame, Object value, RAbstractStringVector file, int type, int compression, RFunction hook) {
if (!(compression == 1 || compression == 3)) { if (!(compression == 1 || compression == 3)) {
throw RError.error(this, Message.GENERIC, "unsupported compression"); throw RError.error(this, Message.GENERIC, "unsupported compression");
} }
...@@ -366,27 +366,27 @@ public class HiddenInternalFunctions { ...@@ -366,27 +366,27 @@ public class HiddenInternalFunctions {
}; };
try { try {
byte[] data = RSerialize.serialize(value, RRuntime.fromLogical(asciiL), false, RSerialize.DEFAULT_VERSION, callHook); byte[] data = RSerialize.serialize(value, type, RSerialize.DEFAULT_VERSION, callHook);
// See comment in LazyLoadDBFetch for format // See comment in LazyLoadDBFetch for format
int outLen; int outLen;
int offset; int offset;
RCompression.Type type; RCompression.Type ctype;
byte[] cdata; byte[] cdata;
if (compression == 1) { if (compression == 1) {
type = RCompression.Type.GZIP; ctype = RCompression.Type.GZIP;
offset = 4; offset = 4;
outLen = (int) (1.001 * data.length) + 20; outLen = (int) (1.001 * data.length) + 20;
cdata = new byte[outLen]; cdata = new byte[outLen];
boolean rc = RCompression.compress(type, data, cdata); boolean rc = RCompression.compress(ctype, data, cdata);
if (!rc) { if (!rc) {
throw RError.error(this, Message.GENERIC, "zlib compress error"); throw RError.error(this, Message.GENERIC, "zlib compress error");
} }
} else if (compression == 3) { } else if (compression == 3) {
type = RCompression.Type.LZMA; ctype = RCompression.Type.LZMA;
offset = 5; offset = 5;
outLen = data.length; outLen = data.length;
cdata = new byte[outLen]; cdata = new byte[outLen];
boolean rc = RCompression.compress(type, data, cdata); boolean rc = RCompression.compress(ctype, data, cdata);
if (!rc) { if (!rc) {
throw RError.error(this, Message.GENERIC, "lzma compress error"); throw RError.error(this, Message.GENERIC, "lzma compress error");
} }
...@@ -395,7 +395,7 @@ public class HiddenInternalFunctions { ...@@ -395,7 +395,7 @@ public class HiddenInternalFunctions {
} }
int[] intData = new int[2]; int[] intData = new int[2];
intData[1] = outLen + offset; // include length + type (compression == 3) intData[1] = outLen + offset; // include length + type (compression == 3)
intData[0] = appendFile(file.getDataAt(0), cdata, data.length, type); intData[0] = appendFile(file.getDataAt(0), cdata, data.length, ctype);
return RDataFactory.createIntVector(intData, RDataFactory.COMPLETE_VECTOR); return RDataFactory.createIntVector(intData, RDataFactory.COMPLETE_VECTOR);
} catch (Throwable ex) { } catch (Throwable ex) {
// Exceptions have been observed that were masked and very hard to find // Exceptions have been observed that were masked and very hard to find
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment