|
||||||||||
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
Parses an XML input file given a specified identifier of tags to be loaded. The output is a bag of XML elements where each element is returned as a chararray containing the text of the matched XML element including the start and tags as well as the data between them. In case of nesting elements of the matching tags, only the top level one is returned.
Nested Class Summary | |
---|---|
static class |
XMLLoader.XMLRecordReader
Use this record reader to read XML tags out of a text file. |
Field Summary | |
---|---|
protected org.apache.hadoop.mapreduce.RecordReader |
in
Underlying record reader |
Constructor Summary | |
---|---|
XMLLoader(String identifier)
|
Method Summary | |
---|---|
Tuple |
createTuple(String str)
Creates a tuple from a matched string |
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, warn |
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 XMLLoader(String identifier)
Method Detail |
---|
public void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader, PigSplit split) throws IOException
LoadFunc
prepareToRead
in class LoadFunc
reader
- RecordReader
to be used by this instance of the LoadFuncsplit
- The input PigSplit
to process
IOException
- if there is an exception during initializationpublic Tuple getNext() throws IOException
LoadFunc
getNext
in class LoadFunc
IOException
- if there is an exception while retrieving the next
tuplepublic Tuple createTuple(String str)
public org.apache.hadoop.mapreduce.InputFormat getInputFormat() throws IOException
LoadFunc
getInputFormat
in class LoadFunc
IOException
- if there is an exception during InputFormat
constructionpublic void setLocation(String location, org.apache.hadoop.mapreduce.Job job) throws IOException
LoadFunc
LoadFunc.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 LoadFunc
location
- 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 |