kafka.bridge.pig
Class AvroKafkaStorage

java.lang.Object
  extended by org.apache.pig.StoreFunc
      extended by kafka.bridge.pig.AvroKafkaStorage
All Implemented Interfaces:
org.apache.pig.StoreFuncInterface

public class AvroKafkaStorage
extends org.apache.pig.StoreFunc


Field Summary
protected  org.apache.avro.Schema avroSchema
           
protected  org.apache.pig.piggybank.storage.avro.PigAvroDatumWriter datumWriter
           
protected  org.apache.avro.io.Encoder encoder
           
protected  java.io.ByteArrayOutputStream os
           
protected  KafkaRecordWriter<java.lang.Object,byte[]> writer
           
 
Constructor Summary
AvroKafkaStorage(java.lang.String schema)
           
 
Method Summary
 void checkSchema(org.apache.pig.ResourceSchema schema)
           
 void cleanupOnFailure(java.lang.String location, org.apache.hadoop.mapreduce.Job job)
           
 org.apache.hadoop.mapreduce.OutputFormat getOutputFormat()
           
 void prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
           
 void putNext(org.apache.pig.data.Tuple tuple)
           
 java.lang.String relToAbsPathForStoreLocation(java.lang.String location, org.apache.hadoop.fs.Path curDir)
           
 void setStoreFuncUDFContextSignature(java.lang.String signature)
           
 void setStoreLocation(java.lang.String uri, org.apache.hadoop.mapreduce.Job job)
           
protected  void writeEnvelope(java.io.OutputStream os, org.apache.avro.io.Encoder enc)
           
 
Methods inherited from class org.apache.pig.StoreFunc
cleanupOnFailureImpl, cleanupOnSuccess, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

protected KafkaRecordWriter<java.lang.Object,byte[]> writer

avroSchema

protected org.apache.avro.Schema avroSchema

datumWriter

protected org.apache.pig.piggybank.storage.avro.PigAvroDatumWriter datumWriter

encoder

protected org.apache.avro.io.Encoder encoder

os

protected java.io.ByteArrayOutputStream os
Constructor Detail

AvroKafkaStorage

public AvroKafkaStorage(java.lang.String schema)
Method Detail

getOutputFormat

public org.apache.hadoop.mapreduce.OutputFormat getOutputFormat()
                                                         throws java.io.IOException
Specified by:
getOutputFormat in interface org.apache.pig.StoreFuncInterface
Specified by:
getOutputFormat in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

relToAbsPathForStoreLocation

public java.lang.String relToAbsPathForStoreLocation(java.lang.String location,
                                                     org.apache.hadoop.fs.Path curDir)
                                              throws java.io.IOException
Specified by:
relToAbsPathForStoreLocation in interface org.apache.pig.StoreFuncInterface
Overrides:
relToAbsPathForStoreLocation in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

setStoreLocation

public void setStoreLocation(java.lang.String uri,
                             org.apache.hadoop.mapreduce.Job job)
                      throws java.io.IOException
Specified by:
setStoreLocation in interface org.apache.pig.StoreFuncInterface
Specified by:
setStoreLocation in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

prepareToWrite

public void prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
                    throws java.io.IOException
Specified by:
prepareToWrite in interface org.apache.pig.StoreFuncInterface
Specified by:
prepareToWrite in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

cleanupOnFailure

public void cleanupOnFailure(java.lang.String location,
                             org.apache.hadoop.mapreduce.Job job)
                      throws java.io.IOException
Specified by:
cleanupOnFailure in interface org.apache.pig.StoreFuncInterface
Overrides:
cleanupOnFailure in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

setStoreFuncUDFContextSignature

public void setStoreFuncUDFContextSignature(java.lang.String signature)
Specified by:
setStoreFuncUDFContextSignature in interface org.apache.pig.StoreFuncInterface
Overrides:
setStoreFuncUDFContextSignature in class org.apache.pig.StoreFunc

checkSchema

public void checkSchema(org.apache.pig.ResourceSchema schema)
                 throws java.io.IOException
Specified by:
checkSchema in interface org.apache.pig.StoreFuncInterface
Overrides:
checkSchema in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

writeEnvelope

protected void writeEnvelope(java.io.OutputStream os,
                             org.apache.avro.io.Encoder enc)
                      throws java.io.IOException
Throws:
java.io.IOException

putNext

public void putNext(org.apache.pig.data.Tuple tuple)
             throws java.io.IOException
Specified by:
putNext in interface org.apache.pig.StoreFuncInterface
Specified by:
putNext in class org.apache.pig.StoreFunc
Throws:
java.io.IOException