{
if (this.avroSchema == null)
throw new IllegalStateException("avroSchema shouldn't be null");
this.writer = (KafkaRecordWriter) writer;
this.datumWriter = new PigAvroDatumWriter(this.avroSchema);
this.os = new ByteArrayOutputStream();
this.encoder = new BinaryEncoder(this.os);
}