List<ValueVector> vectorList = Lists.newArrayList();
RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
DrillConfig config = DrillConfig.create();
Drillbit bit = new Drillbit(config, serviceSet);
bit.run();
DrillbitContext context = bit.getContext();
MaterializedField intField = MaterializedField.create(new SchemaPath("int", ExpressionPosition.UNKNOWN), Types.required(TypeProtos.MinorType.INT));
IntVector intVector = (IntVector)TypeHelper.getNewVector(intField, context.getAllocator());
MaterializedField binField = MaterializedField.create(new SchemaPath("binary", ExpressionPosition.UNKNOWN), Types.required(TypeProtos.MinorType.VARBINARY));
VarBinaryVector binVector = (VarBinaryVector)TypeHelper.getNewVector(binField, context.getAllocator());
AllocationHelper.allocate(intVector, 4, 4);
AllocationHelper.allocate(binVector, 4, 5);
vectorList.add(intVector);
vectorList.add(binVector);
intVector.getMutator().setSafe(0, 0); binVector.getMutator().setSafe(0, "ZERO".getBytes());
intVector.getMutator().setSafe(1, 1); binVector.getMutator().setSafe(1, "ONE".getBytes());
intVector.getMutator().setSafe(2, 2); binVector.getMutator().setSafe(2, "TWO".getBytes());
intVector.getMutator().setSafe(3, 3); binVector.getMutator().setSafe(3, "THREE".getBytes());
intVector.getMutator().setValueCount(4);
binVector.getMutator().setValueCount(4);
VectorContainer container = new VectorContainer();
container.addCollection(vectorList);
container.setRecordCount(4);
WritableBatch batch = WritableBatch.getBatchNoHVWrap(container.getRecordCount(), container, false);
VectorAccessibleSerializable wrap = new VectorAccessibleSerializable(batch, context.getAllocator());
Configuration conf = new Configuration();
conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
FileSystem fs = FileSystem.get(conf);
Path path = new Path("/tmp/drillSerializable");
if (fs.exists(path)) fs.delete(path, false);
FSDataOutputStream out = fs.create(path);
wrap.writeToStream(out);
out.close();
FSDataInputStream in = fs.open(path);
VectorAccessibleSerializable newWrap = new VectorAccessibleSerializable(context.getAllocator());
newWrap.readFromStream(in);
fs.close();
VectorAccessible newContainer = newWrap.get();
for (VectorWrapper w : newContainer) {