if (this.result == null) {
this.result = buildResult();
}
try {
FileStoreOutputStream fs = this.result.getOuputStream();
fs.close();
if (fs.bytesWritten()) {
return new BlobType(new BlobImpl(result));
}
return new BlobType(new SerialBlob(Arrays.copyOf(fs.getBuffer(), fs.getCount())));
} catch (IOException e) {
throw new TeiidProcessingException(e);
} catch (SQLException e) {
throw new TeiidProcessingException(e);
}