|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pig.LoadFunc
org.apache.pig.builtin.TextLoader
public class TextLoader
This load function simply creates a tuple for each line of text that has a single chararray field that contains the line of text.
| Field Summary | |
|---|---|
protected org.apache.hadoop.mapreduce.RecordReader |
in
|
| Constructor Summary | |
|---|---|
TextLoader()
|
|
| Method Summary | |
|---|---|
DataBag |
bytesToBag(byte[] b,
ResourceSchema.ResourceFieldSchema schema)
TextLoader does not support conversion to Bag |
String |
bytesToCharArray(byte[] b)
Cast data from bytes to chararray value. |
Double |
bytesToDouble(byte[] b)
TextLoader does not support conversion to Double |
Float |
bytesToFloat(byte[] b)
TextLoader does not support conversion to Float |
Integer |
bytesToInteger(byte[] b)
TextLoader does not support conversion to Integer |
Long |
bytesToLong(byte[] b)
TextLoader does not support conversion to Long |
Map<String,Object> |
bytesToMap(byte[] b)
Cast data from bytearray to map value. |
Map<String,Object> |
bytesToMap(byte[] b,
ResourceSchema.ResourceFieldSchema schema)
TextLoader does not support conversion to Map |
Tuple |
bytesToTuple(byte[] b,
ResourceSchema.ResourceFieldSchema schema)
TextLoader does not support conversion to Tuple |
org.apache.hadoop.mapreduce.InputFormat |
getInputFormat()
This will be called during planning on the front end. |
LoadCaster |
getLoadCaster()
This will be called on the front end during planning and not on the back end during execution. |
Tuple |
getNext()
Retrieves the next tuple to be processed. |
void |
prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader,
PigSplit split)
Initializes LoadFunc for reading data. |
void |
setLocation(String location,
org.apache.hadoop.mapreduce.Job job)
Communicate to the loader the location of the object(s) being loaded. |
byte[] |
toBytes(DataBag bag)
|
byte[] |
toBytes(Double d)
|
byte[] |
toBytes(Float f)
|
byte[] |
toBytes(Integer i)
|
byte[] |
toBytes(Long l)
|
byte[] |
toBytes(Map<String,Object> m)
|
byte[] |
toBytes(String s)
|
byte[] |
toBytes(Tuple t)
|
| Methods inherited from class org.apache.pig.LoadFunc |
|---|
getAbsolutePath, getPathStrings, join, relativeToAbsolutePath, setUDFContextSignature |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.apache.hadoop.mapreduce.RecordReader in
| Constructor Detail |
|---|
public TextLoader()
| Method Detail |
|---|
public Tuple getNext()
throws IOException
LoadFunc
getNext in class LoadFuncIOException - if there is an exception while retrieving the next
tuple
public Integer bytesToInteger(byte[] b)
throws IOException
bytesToInteger in interface LoadCasterb - bytearray to be cast.
IOException - if the value cannot be cast.
public Long bytesToLong(byte[] b)
throws IOException
bytesToLong in interface LoadCasterb - bytearray to be cast.
IOException - if the value cannot be cast.
public Float bytesToFloat(byte[] b)
throws IOException
bytesToFloat in interface LoadCasterb - bytearray to be cast.
IOException - if the value cannot be cast.
public Double bytesToDouble(byte[] b)
throws IOException
bytesToDouble in interface LoadCasterb - bytearray to be cast.
IOException - if the value cannot be cast.
public String bytesToCharArray(byte[] b)
throws IOException
bytesToCharArray in interface LoadCasterb - byte array to be cast.
IOException - if the value cannot be cast.
public Map<String,Object> bytesToMap(byte[] b)
throws IOException
LoadCaster
bytesToMap in interface LoadCasterb - bytearray to be cast.
IOException - if the value cannot be cast.
public Map<String,Object> bytesToMap(byte[] b,
ResourceSchema.ResourceFieldSchema schema)
throws IOException
bytesToMap in interface LoadCasterb - bytearray to be cast.schema - field schema for the output map
IOException - if the value cannot be cast.
public Tuple bytesToTuple(byte[] b,
ResourceSchema.ResourceFieldSchema schema)
throws IOException
bytesToTuple in interface LoadCasterb - bytearray to be cast.schema - field schema for the output tuple
IOException - if the value cannot be cast.
public DataBag bytesToBag(byte[] b,
ResourceSchema.ResourceFieldSchema schema)
throws IOException
bytesToBag in interface LoadCasterb - bytearray to be cast.schema - field schema for the output bag
IOException - if the value cannot be cast.
public byte[] toBytes(DataBag bag)
throws IOException
IOException
public byte[] toBytes(String s)
throws IOException
IOException
public byte[] toBytes(Double d)
throws IOException
IOException
public byte[] toBytes(Float f)
throws IOException
IOException
public byte[] toBytes(Integer i)
throws IOException
IOException
public byte[] toBytes(Long l)
throws IOException
IOException
public byte[] toBytes(Map<String,Object> m)
throws IOException
IOException
public byte[] toBytes(Tuple t)
throws IOException
IOExceptionpublic org.apache.hadoop.mapreduce.InputFormat getInputFormat()
LoadFunc
getInputFormat in class LoadFuncpublic LoadCaster getLoadCaster()
LoadFunc
getLoadCaster in class LoadFuncLoadCaster associated with this loader. Returning null
indicates that casts from byte array are not supported for this loader.
construction
public void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader,
PigSplit split)
LoadFunc
prepareToRead in class LoadFuncreader - RecordReader to be used by this instance of the LoadFuncsplit - The input PigSplit to process
public void setLocation(String location,
org.apache.hadoop.mapreduce.Job job)
throws IOException
LoadFuncLoadFunc.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 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 LoadFunclocation - 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||