|
||||||||||
| 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.piggybank.storage.XMLLoader
public class XMLLoader
The load function to load the XML file
This implements the LoadFunc interface which is used to parse records
from a dataset. The various helper adaptor function is extended from loader.Utf8StorageConverter
which included various functions to cast raw byte data into various datatypes.
other sections of the code can call back to the loader to do the cast.
This takes a xmlTag as the arg which it will use to split the inputdataset into
multiple records.
For example if the input xml (input.xml) is like this
| Nested Class Summary | |
|---|---|
static class |
XMLLoader.XMLFileInputFormat
|
static class |
XMLLoader.XMLFileRecordReader
|
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
mLog
logger from pig |
String |
recordIdentifier
The record seperated. |
| Constructor Summary | |
|---|---|
XMLLoader()
|
|
XMLLoader(String recordIdentifier)
Constructs a Pig loader that uses specified string as the record seperater for example if the recordIdentifier is document. |
|
| Method Summary | |
|---|---|
Tuple |
createTuple(byte[] content)
|
boolean |
equals(Object obj)
to check for equality |
boolean |
equals(XMLLoader other)
to check for equality |
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. |
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. |
| Methods inherited from class org.apache.pig.LoadFunc |
|---|
getAbsolutePath, getLoadCaster, getPathStrings, join, relativeToAbsolutePath, setUDFContextSignature |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log mLog
public String recordIdentifier
| Constructor Detail |
|---|
public XMLLoader()
public XMLLoader(String recordIdentifier)
recordIdentifier - the xml tag which is used to pull records| Method Detail |
|---|
public Tuple getNext()
throws IOException
getNext in class LoadFuncIOException
public Tuple createTuple(byte[] content)
throws Exception
Exceptionpublic boolean equals(Object obj)
equals in class Objectobject - public boolean equals(XMLLoader other)
XMLLoader - object
public org.apache.hadoop.mapreduce.InputFormat getInputFormat()
throws IOException
LoadFunc
getInputFormat in class LoadFuncIOException - if there is an exception during InputFormat
construction
public void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader,
PigSplit split)
throws IOException
LoadFunc
prepareToRead in class LoadFuncreader - RecordReader to be used by this instance of the LoadFuncsplit - The input PigSplit to process
IOException - if there is an exception during initialization
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 | |||||||||