|
||||||||||
| 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.impl.builtin.DefaultIndexableLoader
public class DefaultIndexableLoader
Used by MergeJoin . Takes an index on sorted data consisting of sorted tuples of the form (key1,key2..., position,splitIndex) as input. For key given in seekNear(Tuple) finds the splitIndex that can contain the key and initializes ReadToEndLoader to read from that splitIndex onwards , in the sequence of splits in the index
| Constructor Summary | |
|---|---|
DefaultIndexableLoader(String loaderFuncSpec,
String indexFile,
String indexFileLoadFuncSpec,
String scope,
String inputLocation)
|
|
| Method Summary | |
|---|---|
void |
close()
A method called by the Pig runtime to give an opportunity for implementations to perform cleanup actions like closing the underlying input stream. |
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 |
initialize(org.apache.hadoop.conf.Configuration conf)
This method is called by Pig run time to allow the IndexableLoadFunc to perform any initialization actions |
void |
prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader,
PigSplit split)
Initializes LoadFunc for reading data. |
void |
seekNear(Tuple keys)
This method is called by the Pig runtime to indicate to the LoadFunc to position its underlying input stream near the keys supplied as the argument. |
void |
setIndexFile(String indexFile)
|
void |
setLocation(String location,
org.apache.hadoop.mapreduce.Job job)
Communicate to the loader the location of the object(s) being loaded. |
| Methods inherited from class org.apache.pig.LoadFunc |
|---|
getAbsolutePath, getPathStrings, join, relativeToAbsolutePath, setUDFContextSignature, warn |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultIndexableLoader(String loaderFuncSpec,
String indexFile,
String indexFileLoadFuncSpec,
String scope,
String inputLocation)
| Method Detail |
|---|
public void seekNear(Tuple keys)
throws IOException
IndexableLoadFunc
seekNear in interface IndexableLoadFunckeys - Tuple with join keys (which are a prefix of the sort
keys of the input data). For example if the data is sorted on
columns in position 2,4,5 any of the following Tuples are
valid as an argument value:
(fieldAt(2))
(fieldAt(2), fieldAt(4))
(fieldAt(2), fieldAt(4), fieldAt(5))
The following are some invalid cases:
(fieldAt(4))
(fieldAt(2), fieldAt(5))
(fieldAt(4), fieldAt(5))
IOException - When the loadFunc is unable to position
to the required point in its input stream
public Tuple getNext()
throws IOException
LoadFunc
getNext in class LoadFuncIOException - if there is an exception while retrieving the next
tuple
public void close()
throws IOException
IndexableLoadFunc
close in interface IndexableLoadFuncIOException - if the loadfunc is unable to perform
its close actions.
public void initialize(org.apache.hadoop.conf.Configuration conf)
throws IOException
IndexableLoadFunc
initialize in interface IndexableLoadFuncconf - The job configuration object
IOException
public org.apache.hadoop.mapreduce.InputFormat getInputFormat()
throws IOException
LoadFunc
getInputFormat in class LoadFuncIOException - if there is an exception during InputFormat
construction
public LoadCaster getLoadCaster()
throws IOException
LoadFunc
getLoadCaster in class LoadFuncLoadCaster associated with this loader. Returning null
indicates that casts from byte array are not supported for this loader.
construction
IOException - if there is an exception during LoadCaster
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 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 UDFContext
IOException - if the location is not valid.public void setIndexFile(String indexFile)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||