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
|
java.math.BigDecimal |
bytesToBigDecimal(byte[] b)
Cast data from bytearray to BigDecimal value.
|
java.math.BigInteger |
bytesToBigInteger(byte[] b)
Cast data from bytearray to BigInteger value.
|
java.lang.Boolean |
bytesToBoolean(byte[] b)
TextLoader does not support conversion to Boolean
|
java.lang.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
|
java.lang.Double |
bytesToDouble(byte[] b)
TextLoader does not support conversion to Double
|
java.lang.Float |
bytesToFloat(byte[] b)
TextLoader does not support conversion to Float
|
java.lang.Integer |
bytesToInteger(byte[] b)
TextLoader does not support conversion to Integer
|
java.lang.Long |
bytesToLong(byte[] b)
TextLoader does not support conversion to Long
|
java.util.Map<java.lang.String,java.lang.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(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
Communicate to the loader the location of the object(s) being loaded.
|
byte[] |
toBytes(java.lang.Boolean b) |
byte[] |
toBytes(DataBag bag) |
byte[] |
toBytes(org.joda.time.DateTime dt) |
byte[] |
toBytes(java.lang.Double d) |
byte[] |
toBytes(java.lang.Float f) |
byte[] |
toBytes(java.lang.Integer i) |
byte[] |
toBytes(java.lang.Long l) |
byte[] |
toBytes(java.util.Map<java.lang.String,java.lang.Object> m) |
byte[] |
toBytes(java.lang.String s) |
byte[] |
toBytes(Tuple t) |
addCredentials, getAbsolutePath, getCacheFiles, getGlobPaths, getPathStrings, getShipFiles, join, relativeToAbsolutePath, setUDFContextSignature, warnprotected org.apache.hadoop.mapreduce.RecordReader in
protected final org.apache.commons.logging.Log mLog
public Tuple getNext() throws java.io.IOException
LoadFuncpublic java.lang.Boolean bytesToBoolean(byte[] b)
throws java.io.IOException
bytesToBoolean in interface LoadCasterb - bytearray to be cast.java.io.IOException - if the value cannot be cast.public java.lang.Integer bytesToInteger(byte[] b)
throws java.io.IOException
bytesToInteger in interface LoadCasterb - bytearray to be cast.java.io.IOException - if the value cannot be cast.public java.lang.Long bytesToLong(byte[] b)
throws java.io.IOException
bytesToLong in interface LoadCasterb - bytearray to be cast.java.io.IOException - if the value cannot be cast.public java.lang.Float bytesToFloat(byte[] b)
throws java.io.IOException
bytesToFloat in interface LoadCasterb - bytearray to be cast.java.io.IOException - if the value cannot be cast.public java.lang.Double bytesToDouble(byte[] b)
throws java.io.IOException
bytesToDouble in interface LoadCasterb - bytearray to be cast.java.io.IOException - if the value cannot be cast.public org.joda.time.DateTime bytesToDateTime(byte[] b)
throws java.io.IOException
bytesToDateTime in interface LoadCasterb - bytearray to be cast.java.io.IOException - if the value cannot be cast.public java.lang.String bytesToCharArray(byte[] b)
throws java.io.IOException
bytesToCharArray in interface LoadCasterb - byte array to be cast.java.io.IOException - if the value cannot be cast.public java.util.Map<java.lang.String,java.lang.Object> bytesToMap(byte[] b,
ResourceSchema.ResourceFieldSchema schema)
throws java.io.IOException
LoadCasterbytesToMap in interface LoadCasterb - bytearray to be cast.schema - field schema for the output mapjava.io.IOException - if the value cannot be cast.public Tuple bytesToTuple(byte[] b, ResourceSchema.ResourceFieldSchema schema) throws java.io.IOException
bytesToTuple in interface LoadCasterb - bytearray to be cast.schema - field schema for the output tuplejava.io.IOException - if the value cannot be cast.public DataBag bytesToBag(byte[] b, ResourceSchema.ResourceFieldSchema schema) throws java.io.IOException
bytesToBag in interface LoadCasterb - bytearray to be cast.schema - field schema for the output bagjava.io.IOException - if the value cannot be cast.public byte[] toBytes(DataBag bag) throws java.io.IOException
java.io.IOExceptionpublic byte[] toBytes(java.lang.String s)
throws java.io.IOException
java.io.IOExceptionpublic byte[] toBytes(java.lang.Double d)
throws java.io.IOException
java.io.IOExceptionpublic byte[] toBytes(java.lang.Float f)
throws java.io.IOException
java.io.IOExceptionpublic byte[] toBytes(java.lang.Boolean b)
throws java.io.IOException
java.io.IOExceptionpublic byte[] toBytes(java.lang.Integer i)
throws java.io.IOException
java.io.IOExceptionpublic byte[] toBytes(java.lang.Long l)
throws java.io.IOException
java.io.IOExceptionpublic byte[] toBytes(org.joda.time.DateTime dt)
throws java.io.IOException
java.io.IOExceptionpublic byte[] toBytes(java.util.Map<java.lang.String,java.lang.Object> m)
throws java.io.IOException
java.io.IOExceptionpublic byte[] toBytes(Tuple t) throws java.io.IOException
java.io.IOExceptionpublic java.math.BigInteger bytesToBigInteger(byte[] b)
throws java.io.IOException
LoadCasterbytesToBigInteger in interface LoadCasterb - bytearray to be cast.java.io.IOException - if the value cannot be cast.public java.math.BigDecimal bytesToBigDecimal(byte[] b)
throws java.io.IOException
LoadCasterbytesToBigDecimal in interface LoadCasterb - bytearray to be cast.java.io.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(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
throws java.io.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 UDFContextjava.io.IOException - if the location is not valid.Copyright © 2007-2025 The Apache Software Foundation