private Writable serializeBatch() throws SerDeException {
	  output.reset();
	  for (int i = 0; i < columnBuffers.length; i++) {
		  TColumn tColumn = columnBuffers[i].toTColumn();
		  try {
			  tColumn.write(protocol);
		  } catch(TException e) {
			  throw new SerDeException(e);
		  }
	  }
	  initializeRowAndColumns();
	  serializedBytesWritable.set(output.getData(), 0, output.getLength());
	  return serializedBytesWritable;
  }
This SerDe is used to serialize the final output to thrift-able objects directly in the SerDe. Use this SerDe only for final output resultSets.
It is used  if HIVE_SERVER2_THRIFT_RESULTSET_SERIALIZE_IN_TASKS is set to true. It buffers rows that come in from FileSink till it reaches max_buffer_size (also configurable)
or all rows are finished and FileSink.closeOp() is called.
serde/src/java/org/apache/hadoop/hive/serde2/thrift/ThriftJDBCBinarySerDe.java