public class TextLoader extends LoadFunc implements LoadCaster
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.hadoop.mapreduce.RecordReader |
in |
protected org.apache.commons.logging.Log |
mLog |
| Constructor and Description |
|---|
TextLoader() |
| Modifier and Type | Method and Description |
|---|---|
DataBag |
bytesToBag(byte[] b,
ResourceSchema.ResourceFieldSchema schema)
TextLoader does not support conversion to Bag
|
BigDecimal |
bytesToBigDecimal(byte[] b)
Cast data from bytearray to BigDecimal value.
|
BigInteger |
bytesToBigInteger(byte[] b)
Cast data from bytearray to BigInteger value.
|
Boolean |
bytesToBoolean(byte[] b)
TextLoader does not support conversion to Boolean
|
String |
bytesToCharArray(byte[] b)
Cast data from bytes to chararray value.
|
org.joda.time.DateTime |
bytesToDateTime(byte[] b)
TextLoader does not support conversion to DateTime
|
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,
ResourceSchema.ResourceFieldSchema schema)
Cast data from bytearray to map value.
|
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 both the front end and 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(Boolean b) |
byte[] |
toBytes(DataBag bag) |
byte[] |
toBytes(org.joda.time.DateTime dt) |
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) |
getAbsolutePath, getCacheFiles, getPathStrings, getShipFiles, join, relativeToAbsolutePath, setUDFContextSignature, warnprotected org.apache.hadoop.mapreduce.RecordReader in
protected final org.apache.commons.logging.Log mLog
public Tuple getNext() throws IOException
LoadFuncgetNext in class LoadFuncIOException - if there is an exception while retrieving the next
tuplepublic Boolean bytesToBoolean(byte[] b) throws IOException
bytesToBoolean in interface LoadCasterb - bytearray to be cast.IOException - if the value cannot be cast.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 org.joda.time.DateTime bytesToDateTime(byte[] b)
throws IOException
bytesToDateTime 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, ResourceSchema.ResourceFieldSchema schema) throws IOException
LoadCasterbytesToMap in interface LoadCasterb - bytearray to be cast.schema - field schema for the output mapIOException - 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 tupleIOException - 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 bagIOException - if the value cannot be cast.public byte[] toBytes(DataBag bag) throws IOException
IOExceptionpublic byte[] toBytes(String s) throws IOException
IOExceptionpublic byte[] toBytes(Double d) throws IOException
IOExceptionpublic byte[] toBytes(Float f) throws IOException
IOExceptionpublic byte[] toBytes(Boolean b) throws IOException
IOExceptionpublic byte[] toBytes(Integer i) throws IOException
IOExceptionpublic byte[] toBytes(Long l) throws IOException
IOExceptionpublic byte[] toBytes(org.joda.time.DateTime dt)
throws IOException
IOExceptionpublic byte[] toBytes(Map<String,Object> m) throws IOException
IOExceptionpublic byte[] toBytes(Tuple t) throws IOException
IOExceptionpublic BigInteger bytesToBigInteger(byte[] b) throws IOException
LoadCasterbytesToBigInteger in interface LoadCasterb - bytearray to be cast.IOException - if the value cannot be cast.public BigDecimal bytesToBigDecimal(byte[] b) throws IOException
LoadCasterbytesToBigDecimal in interface LoadCasterb - bytearray to be cast.IOException - if the value cannot be cast.public org.apache.hadoop.mapreduce.InputFormat getInputFormat()
LoadFuncgetInputFormat in class LoadFuncpublic LoadCaster getLoadCaster()
LoadFuncgetLoadCaster in class LoadFuncLoadCaster associated with this loader. Returning null
indicates that casts from byte array are not supported for this loader.
constructionpublic void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader,
PigSplit split)
LoadFuncprepareToRead in class LoadFuncreader - RecordReader to be used by this instance of the LoadFuncsplit - The input PigSplit to processpublic 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 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 LoadFunclocation - Location as returned by
LoadFunc.relativeToAbsolutePath(String, Path)job - the Job object
store or retrieve earlier stored information from the UDFContextIOException - if the location is not valid.Copyright © 2007-2017 The Apache Software Foundation