public class SequenceFileLoader extends FileInputLoadFunc
Modifier and Type | Field and Description |
---|---|
protected byte |
keyType |
protected static org.apache.commons.logging.Log |
LOG |
protected TupleFactory |
mTupleFactory |
protected org.apache.hadoop.io.serializer.SerializationFactory |
serializationFactory |
protected byte |
valType |
Constructor and Description |
---|
SequenceFileLoader() |
Modifier and Type | Method and Description |
---|---|
org.apache.hadoop.mapreduce.InputFormat |
getInputFormat()
This will be called during planning on the front end.
|
Tuple |
getNext()
Retrieves the next tuple to be processed.
|
protected byte |
inferPigDataType(Type t) |
void |
prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader,
PigSplit split)
Initializes LoadFunc for reading data.
|
protected void |
setKeyType(Class<?> keyClass) |
void |
setLocation(String location,
org.apache.hadoop.mapreduce.Job job)
Communicate to the loader the location of the object(s) being loaded.
|
protected void |
setValueType(Class<?> valueClass) |
protected Object |
translateWritableToPigDataType(org.apache.hadoop.io.Writable w,
byte dataType) |
getSplitComparable
getAbsolutePath, getCacheFiles, getLoadCaster, getPathStrings, getShipFiles, join, relativeToAbsolutePath, setUDFContextSignature, warn
protected static final org.apache.commons.logging.Log LOG
protected TupleFactory mTupleFactory
protected org.apache.hadoop.io.serializer.SerializationFactory serializationFactory
protected byte keyType
protected byte valType
protected void setKeyType(Class<?> keyClass) throws BackendException
BackendException
protected void setValueType(Class<?> valueClass) throws BackendException
BackendException
protected byte inferPigDataType(Type t)
protected Object translateWritableToPigDataType(org.apache.hadoop.io.Writable w, byte dataType)
public Tuple getNext() throws IOException
LoadFunc
getNext
in class LoadFunc
IOException
- if there is an exception while retrieving the next
tuplepublic org.apache.hadoop.mapreduce.InputFormat getInputFormat() throws IOException
LoadFunc
getInputFormat
in class LoadFunc
IOException
- if there is an exception during InputFormat
constructionpublic void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader, PigSplit split) throws IOException
LoadFunc
prepareToRead
in class LoadFunc
reader
- RecordReader
to be used by this instance of the LoadFuncsplit
- The input PigSplit
to processIOException
- if there is an exception during initializationpublic void setLocation(String location, org.apache.hadoop.mapreduce.Job job) throws IOException
LoadFunc
LoadFunc.relativeToAbsolutePath(String, Path)
. Implementations
should use this method to communicate the location (and any other information)
to its underlying InputFormat through the Job object.
This method will be called in the frontend and backend multiple times. Implementations
should bear in mind that this method is called multiple times and should
ensure there are no inconsistent side effects due to the multiple calls.setLocation
in class LoadFunc
location
- Location as returned by
LoadFunc.relativeToAbsolutePath(String, Path)
job
- the Job
object
store or retrieve earlier stored information from the UDFContext
IOException
- if the location is not valid.Copyright © 2007-2012 The Apache Software Foundation