public class FixedWidthStorer extends StoreFunc
Constructor and Description |
---|
FixedWidthStorer() |
FixedWidthStorer(java.lang.String columnSpec) |
FixedWidthStorer(java.lang.String columnSpec,
java.lang.String headerStr) |
Modifier and Type | Method and Description |
---|---|
void |
checkSchema(ResourceSchema s)
Set the schema for data to be stored.
|
org.apache.hadoop.mapreduce.OutputFormat |
getOutputFormat()
Return the OutputFormat associated with StoreFunc.
|
java.lang.String[] |
getPartitionKeys(java.lang.String location,
org.apache.hadoop.mapreduce.Job job) |
ResourceStatistics |
getStatistics(java.lang.String location,
org.apache.hadoop.mapreduce.Job job) |
void |
prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
Initialize StoreFunc to write data.
|
void |
putNext(Tuple t)
Write a tuple to the data store.
|
void |
setPartitionFilter(Expression partitionFilter) |
void |
setStoreFuncUDFContextSignature(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
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(java.lang.String location,
org.apache.hadoop.mapreduce.Job job)
Communicate to the storer the location where the data needs to be stored.
|
void |
storeStatistics(ResourceStatistics stats,
java.lang.String location,
org.apache.hadoop.mapreduce.Job job) |
cleanupOnFailure, cleanupOnFailureImpl, cleanupOnSuccess, relToAbsPathForStoreLocation, warn
public FixedWidthStorer()
public FixedWidthStorer(java.lang.String columnSpec)
public FixedWidthStorer(java.lang.String columnSpec, java.lang.String headerStr)
public org.apache.hadoop.mapreduce.OutputFormat getOutputFormat() throws java.io.IOException
StoreFunc
getOutputFormat
in interface StoreFuncInterface
getOutputFormat
in class StoreFunc
OutputFormat
associated with StoreFuncjava.io.IOException
- if an exception occurs while constructing the
OutputFormatpublic void setStoreLocation(java.lang.String location, org.apache.hadoop.mapreduce.Job job) throws java.io.IOException
StoreFunc
StoreFunc
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 StoreFuncInterface
setStoreLocation
in class StoreFunc
location
- Location returned by
StoreFunc.relToAbsPathForStoreLocation(String, Path)
job
- The Job
objectjava.io.IOException
- if the location is not valid.public void setStoreFuncUDFContextSignature(java.lang.String signature)
StoreFunc
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. 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 StoreFuncInterface
setStoreFuncUDFContextSignature
in class StoreFunc
signature
- a unique signature to identify this StoreFuncpublic void checkSchema(ResourceSchema s) throws java.io.IOException
StoreFunc
checkSchema
in interface StoreFuncInterface
checkSchema
in class StoreFunc
s
- 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) throws java.io.IOException
StoreFunc
prepareToWrite
in interface StoreFuncInterface
prepareToWrite
in class StoreFunc
writer
- RecordWriter to use.java.io.IOException
- if an exception occurs during initializationpublic void putNext(Tuple t) throws java.io.IOException
StoreFunc
putNext
in interface StoreFuncInterface
putNext
in class StoreFunc
t
- the tuple to store.java.io.IOException
- if an exception occurs during the writepublic ResourceStatistics getStatistics(java.lang.String location, org.apache.hadoop.mapreduce.Job job) throws java.io.IOException
java.io.IOException
public void storeStatistics(ResourceStatistics stats, java.lang.String location, org.apache.hadoop.mapreduce.Job job) throws java.io.IOException
java.io.IOException
public java.lang.String[] getPartitionKeys(java.lang.String location, org.apache.hadoop.mapreduce.Job job) throws java.io.IOException
java.io.IOException
public void setPartitionFilter(Expression partitionFilter) throws java.io.IOException
java.io.IOException
Copyright © 2007-2012 The Apache Software Foundation