public class CSVExcelStorage extends PigStorage implements StoreFuncInterface, LoadPushDown
| Modifier and Type | Class and Description |
|---|---|
static class |
CSVExcelStorage.Headers |
static class |
CSVExcelStorage.Linebreaks |
static class |
CSVExcelStorage.Multiline |
LoadPushDown.OperatorSet, LoadPushDown.RequiredField, LoadPushDown.RequiredFieldList, LoadPushDown.RequiredFieldResponse| Modifier and Type | Field and Description |
|---|---|
protected static byte |
DOUBLE_QUOTE |
protected org.apache.hadoop.mapreduce.RecordReader |
in |
protected static byte |
LINEFEED |
protected static byte |
RECORD_DEL |
protected ResourceSchema |
schema |
caster, mLog, signature, writer| Constructor and Description |
|---|
CSVExcelStorage() |
CSVExcelStorage(java.lang.String delimiter) |
CSVExcelStorage(java.lang.String delimiter,
java.lang.String multilineTreatmentStr) |
CSVExcelStorage(java.lang.String delimiter,
java.lang.String multilineTreatmentStr,
java.lang.String eolTreatmentStr) |
CSVExcelStorage(java.lang.String delimiter,
java.lang.String multilineTreatmentStr,
java.lang.String eolTreatmentStr,
java.lang.String headerTreatmentStr) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkSchema(ResourceSchema s)
Set the schema for data to be stored.
|
java.util.List<LoadPushDown.OperatorSet> |
getFeatures()
Determine the operators that can be pushed to the loader.
|
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 |
prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
Initialize StoreFuncInterface to write data.
|
LoadPushDown.RequiredFieldResponse |
pushProjection(LoadPushDown.RequiredFieldList requiredFieldList)
Indicate to the loader fields that will be needed.
|
void |
putNext(Tuple tupleToWrite)
Write a tuple to the data store.
|
void |
setLocation(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
Communicate to the loader the location of the object(s) being loaded.
|
void |
setUDFContextSignature(java.lang.String signature)
This method will be called by Pig both in the front end and back end to
pass a unique signature to the
LoadFunc. |
cleanupOnFailure, cleanupOnSuccess, cleanupOutput, equals, equals, getOutputFormat, getPartitionKeys, getSchema, getStatistics, hashCode, readField, relToAbsPathForStoreLocation, setPartitionFilter, setStoreFuncUDFContextSignature, setStoreLocation, shouldOverwrite, storeSchema, storeStatisticsgetSplitComparablegetAbsolutePath, getCacheFiles, getLoadCaster, getPathStrings, getShipFiles, join, relativeToAbsolutePath, warnclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcleanupOnFailure, cleanupOnSuccess, getOutputFormat, relToAbsPathForStoreLocation, setStoreFuncUDFContextSignature, setStoreLocationprotected static final byte LINEFEED
protected static final byte DOUBLE_QUOTE
protected static final byte RECORD_DEL
protected org.apache.hadoop.mapreduce.RecordReader in
protected ResourceSchema schema
public CSVExcelStorage()
public CSVExcelStorage(java.lang.String delimiter)
public CSVExcelStorage(java.lang.String delimiter,
java.lang.String multilineTreatmentStr)
public CSVExcelStorage(java.lang.String delimiter,
java.lang.String multilineTreatmentStr,
java.lang.String eolTreatmentStr)
public CSVExcelStorage(java.lang.String delimiter,
java.lang.String multilineTreatmentStr,
java.lang.String eolTreatmentStr,
java.lang.String headerTreatmentStr)
public void checkSchema(ResourceSchema s) throws java.io.IOException
StoreFuncInterfacecheckSchema in interface StoreFuncInterfacecheckSchema in class PigStorages - to be checkedjava.io.IOException - if this schema is not acceptable. It should include
a detailed error message indicating what is wrong with the schema.public void prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
StoreFuncInterfaceprepareToWrite in interface StoreFuncInterfaceprepareToWrite in class PigStoragewriter - RecordWriter to use.public void putNext(Tuple tupleToWrite) throws java.io.IOException
StoreFuncInterfaceputNext in interface StoreFuncInterfaceputNext in class PigStoragetupleToWrite - the tuple to store.java.io.IOException - if an exception occurs during the writepublic Tuple getNext() throws java.io.IOException
LoadFuncgetNext in class PigStoragejava.io.IOException - if there is an exception while retrieving the next
tuplepublic 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 PigStoragelocation - 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.public org.apache.hadoop.mapreduce.InputFormat getInputFormat()
LoadFuncgetInputFormat in class PigStoragepublic void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader,
PigSplit split)
LoadFuncprepareToRead in class PigStoragereader - RecordReader to be used by this instance of the LoadFuncsplit - The input PigSplit to processpublic LoadPushDown.RequiredFieldResponse pushProjection(LoadPushDown.RequiredFieldList requiredFieldList) throws FrontendException
LoadPushDownpushProjection in interface LoadPushDownpushProjection in class PigStoragerequiredFieldList - RequiredFieldList indicating which columns will be needed.
This structure is read only. User cannot make change to it inside pushProjection.FrontendExceptionpublic void setUDFContextSignature(java.lang.String signature)
LoadFuncLoadFunc. The signature can be used
to store into the UDFContext any information which the
LoadFunc needs to store between various method invocations in the
front end and back end. A use case is to store LoadPushDown.RequiredFieldList
passed to it in LoadPushDown.pushProjection(RequiredFieldList) for
use in the back end before returning tuples in LoadFunc.getNext().
This method will be call before other methods in LoadFuncsetUDFContextSignature in class PigStoragesignature - a unique signature to identify this LoadFuncpublic java.util.List<LoadPushDown.OperatorSet> getFeatures()
LoadPushDowngetFeatures in interface LoadPushDowngetFeatures in class PigStorageCopyright © 2007-2012 The Apache Software Foundation