if (filter == null) return null;
try(ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(byteStream)) {
HbaseObjectWritable.writeObject(out, filter, filter.getClass(), null);
return byteStream.toByteArray();
} catch (IOException e) {
throw new DrillRuntimeException("Error serializing filter: " + filter, e);
}
}