}
case BYTES:
tuple.set(pos,objRecord); //TODO FIXME this should copy bytes really, not reference!
break;
case OBJECT:
FieldDeserializer customDeser = customDeserializers[pos];
if (objRecord instanceof byte[]){
inputBuffer.reset((byte[])objRecord,((byte[])objRecord).length);
} else if (objRecord instanceof ByteBuffer){
ByteBuffer buffer = (ByteBuffer)objRecord;
int offset = buffer.arrayOffset()+buffer.position();
int length = buffer.limit()- buffer.position();
inputBuffer.reset(buffer.array(),offset,length);
} else {
throw new PangoolRuntimeException("Can't convert to OBJECT from instance " + objRecord.getClass());
}
if (customDeser != null){
customDeser.open(inputBuffer);
tuple.set(pos,customDeser.deserialize(tuple.get(pos))); //TODO FIXME avro deserializer shouldn't reuse objects sometimes (UNION ?)
customDeser.close(); //TODO is this ok ?
} else {
//no custom deser , then use Hadoop serializers registered in "io.serializations"
Class clazz = pangoolField.getObjectClass();
if(tuple.get(pos) == null || tuple.get(pos).getClass() != clazz) {