|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pig.StoreFunc
org.apache.hadoop.zebra.pig.TableStorer
public class TableStorer
Pig LoadFunc implementation for Zebra Table
| Constructor Summary | |
|---|---|
TableStorer()
|
|
TableStorer(String storageHintString)
|
|
TableStorer(String storageHintString,
String partitionClassString)
|
|
TableStorer(String storageHintString,
String partitionClassString,
String partitionClassArgumentsString)
|
|
| Method Summary | |
|---|---|
void |
checkSchema(ResourceSchema schema)
Set the schema for data to be stored. |
org.apache.hadoop.mapreduce.OutputFormat |
getOutputFormat()
Return the OutputFormat associated with StoreFunc. |
void |
prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
Initialize StoreFunc to write data. |
void |
putNext(Tuple tuple)
Write a tuple to the data store. |
String |
relToAbsPathForStoreLocation(String location,
org.apache.hadoop.fs.Path curDir)
This method is called by the Pig runtime in the front end to convert the output location to an absolute path if the location is relative. |
void |
setStoreFuncUDFContextSignature(String signature)
This method will be called by Pig both in the front end and back end to pass a unique signature to the StoreFunc which it can use to store
information in the UDFContext which it needs to store between
various method invocations in the front end and back end. |
void |
setStoreLocation(String location,
org.apache.hadoop.mapreduce.Job job)
Communicate to the storer the location where the data needs to be stored. |
void |
storeSchema(ResourceSchema schema,
String location,
org.apache.hadoop.mapreduce.Job job)
Store schema of the data being written |
void |
storeStatistics(ResourceStatistics stats,
String location,
org.apache.hadoop.mapreduce.Job job)
Store statistics about the data being written. |
| Methods inherited from class org.apache.pig.StoreFunc |
|---|
cleanupOnFailure, cleanupOnFailureImpl |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TableStorer()
public TableStorer(String storageHintString)
public TableStorer(String storageHintString,
String partitionClassString)
public TableStorer(String storageHintString,
String partitionClassString,
String partitionClassArgumentsString)
| Method Detail |
|---|
public void putNext(Tuple tuple)
throws IOException
StoreFunc
putNext in interface StoreFuncInterfaceputNext in class StoreFunctuple - the tuple to store.
IOException - if an exception occurs during the write
public void checkSchema(ResourceSchema schema)
throws IOException
StoreFunc
checkSchema in interface StoreFuncInterfacecheckSchema in class StoreFuncschema - to be checked
IOException - if this schema is not acceptable. It should include
a detailed error message indicating what is wrong with the schema.
public org.apache.hadoop.mapreduce.OutputFormat getOutputFormat()
throws IOException
StoreFunc
getOutputFormat in interface StoreFuncInterfacegetOutputFormat in class StoreFuncOutputFormat associated with StoreFunc
IOException - if an exception occurs while constructing the
OutputFormat
public void prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
throws IOException
StoreFunc
prepareToWrite in interface StoreFuncInterfaceprepareToWrite in class StoreFuncwriter - RecordWriter to use.
IOException - if an exception occurs during initialization
public String relToAbsPathForStoreLocation(String location,
org.apache.hadoop.fs.Path curDir)
throws IOException
StoreFunc
relToAbsPathForStoreLocation in interface StoreFuncInterfacerelToAbsPathForStoreLocation in class StoreFunclocation - location as provided in the "store" statement of the scriptcurDir - the current working direction based on any "cd" statements
in the script before the "store" statement. If there are no "cd" statements
in the script, this would be the home directory -
/user/
IOException - if the conversion is not possible
public void setStoreLocation(String location,
org.apache.hadoop.mapreduce.Job job)
throws IOException
StoreFuncStoreFunc here is the
return value of StoreFunc.relToAbsPathForStoreLocation(String, Path)
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.
StoreFunc.checkSchema(ResourceSchema) will be called before any call to
StoreFunc.setStoreLocation(String, Job).
setStoreLocation in interface StoreFuncInterfacesetStoreLocation in class StoreFunclocation - Location returned by
StoreFunc.relToAbsPathForStoreLocation(String, Path)job - The Job object
IOException - if the location is not valid.
public void storeSchema(ResourceSchema schema,
String location,
org.apache.hadoop.mapreduce.Job job)
throws IOException
StoreMetadata
storeSchema in interface StoreMetadataschema - Schema to be recordedlocation - Location as returned by
LoadFunc.relativeToAbsolutePath(String, org.apache.hadoop.fs.Path)job - The Job object - this should be used only to obtain
cluster properties through JobContext.getConfiguration() and not to set/query
any runtime job information.
IOExceptionpublic void setStoreFuncUDFContextSignature(String signature)
StoreFuncStoreFunc which it can use to store
information in the UDFContext which it needs to store between
various method invocations in the front end and back end. This method
will be called before other methods in StoreFunc. This is necessary
because in a Pig Latin script with multiple stores, the different
instances of store functions need to be able to find their (and only their)
data in the UDFContext object. The default implementation is a no-op.
setStoreFuncUDFContextSignature in interface StoreFuncInterfacesetStoreFuncUDFContextSignature in class StoreFuncsignature - a unique signature to identify this StoreFunc
public void storeStatistics(ResourceStatistics stats,
String location,
org.apache.hadoop.mapreduce.Job job)
throws IOException
StoreMetadata
storeStatistics in interface StoreMetadatastats - statistics to be recordedlocation - Location as returned by
LoadFunc.relativeToAbsolutePath(String, org.apache.hadoop.fs.Path)job - The Job object - this should be used only to obtain
cluster properties through JobContext.getConfiguration() and not to set/query
any runtime job information.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||