org.apache.hcatalog.pig
Class HCatBaseStorer

java.lang.Object
  extended by org.apache.pig.StoreFunc
      extended by org.apache.hcatalog.pig.HCatBaseStorer
All Implemented Interfaces:
org.apache.pig.StoreFuncInterface, org.apache.pig.StoreMetadata
Direct Known Subclasses:
HCatEximStorer, HCatStorer

public abstract class HCatBaseStorer
extends org.apache.pig.StoreFunc
implements org.apache.pig.StoreMetadata

Base class for HCatStorer and HCatEximStorer


Field Summary
protected static java.lang.String COMPUTED_OUTPUT_SCHEMA
           
protected  HCatSchema computedSchema
           
protected  java.util.Map<java.lang.String,java.lang.String> partitions
           
protected static java.lang.String PIG_SCHEMA
           
protected  org.apache.pig.impl.logicalLayer.schema.Schema pigSchema
           
protected  java.lang.String sign
           
 
Constructor Summary
HCatBaseStorer(java.lang.String partSpecs, java.lang.String schema)
           
 
Method Summary
 void checkSchema(org.apache.pig.ResourceSchema resourceSchema)
           
 void cleanupOnFailure(java.lang.String location, org.apache.hadoop.mapreduce.Job job)
           
protected  HCatSchema convertPigSchemaToHCatSchema(org.apache.pig.impl.logicalLayer.schema.Schema pigSchema, HCatSchema tableSchema)
          Constructs HCatSchema from pigSchema.
protected  void doSchemaValidations(org.apache.pig.impl.logicalLayer.schema.Schema pigSchema, HCatSchema tblSchema)
           
 void prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
           
 void putNext(org.apache.pig.data.Tuple tuple)
           
 java.lang.String relToAbsPathForStoreLocation(java.lang.String location, org.apache.hadoop.fs.Path curDir)
           
 void setStoreFuncUDFContextSignature(java.lang.String signature)
           
 void storeStatistics(org.apache.pig.ResourceStatistics stats, java.lang.String arg1, org.apache.hadoop.mapreduce.Job job)
           
 
Methods inherited from class org.apache.pig.StoreFunc
cleanupOnFailureImpl, getOutputFormat, setStoreLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.pig.StoreMetadata
storeSchema
 

Field Detail

COMPUTED_OUTPUT_SCHEMA

protected static final java.lang.String COMPUTED_OUTPUT_SCHEMA
See Also:
Constant Field Values

partitions

protected final java.util.Map<java.lang.String,java.lang.String> partitions

pigSchema

protected org.apache.pig.impl.logicalLayer.schema.Schema pigSchema

computedSchema

protected HCatSchema computedSchema

PIG_SCHEMA

protected static final java.lang.String PIG_SCHEMA
See Also:
Constant Field Values

sign

protected java.lang.String sign
Constructor Detail

HCatBaseStorer

public HCatBaseStorer(java.lang.String partSpecs,
                      java.lang.String schema)
               throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

checkSchema

public void checkSchema(org.apache.pig.ResourceSchema resourceSchema)
                 throws java.io.IOException
Specified by:
checkSchema in interface org.apache.pig.StoreFuncInterface
Overrides:
checkSchema in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

convertPigSchemaToHCatSchema

protected HCatSchema convertPigSchemaToHCatSchema(org.apache.pig.impl.logicalLayer.schema.Schema pigSchema,
                                                  HCatSchema tableSchema)
                                           throws org.apache.pig.impl.logicalLayer.FrontendException
Constructs HCatSchema from pigSchema. Passed tableSchema is the existing schema of the table in metastore.

Throws:
org.apache.pig.impl.logicalLayer.FrontendException

prepareToWrite

public void prepareToWrite(org.apache.hadoop.mapreduce.RecordWriter writer)
                    throws java.io.IOException
Specified by:
prepareToWrite in interface org.apache.pig.StoreFuncInterface
Specified by:
prepareToWrite in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

putNext

public void putNext(org.apache.pig.data.Tuple tuple)
             throws java.io.IOException
Specified by:
putNext in interface org.apache.pig.StoreFuncInterface
Specified by:
putNext in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

relToAbsPathForStoreLocation

public java.lang.String relToAbsPathForStoreLocation(java.lang.String location,
                                                     org.apache.hadoop.fs.Path curDir)
                                              throws java.io.IOException
Specified by:
relToAbsPathForStoreLocation in interface org.apache.pig.StoreFuncInterface
Overrides:
relToAbsPathForStoreLocation in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

setStoreFuncUDFContextSignature

public void setStoreFuncUDFContextSignature(java.lang.String signature)
Specified by:
setStoreFuncUDFContextSignature in interface org.apache.pig.StoreFuncInterface
Overrides:
setStoreFuncUDFContextSignature in class org.apache.pig.StoreFunc

doSchemaValidations

protected void doSchemaValidations(org.apache.pig.impl.logicalLayer.schema.Schema pigSchema,
                                   HCatSchema tblSchema)
                            throws org.apache.pig.impl.logicalLayer.FrontendException,
                                   HCatException
Throws:
org.apache.pig.impl.logicalLayer.FrontendException
HCatException

cleanupOnFailure

public void cleanupOnFailure(java.lang.String location,
                             org.apache.hadoop.mapreduce.Job job)
                      throws java.io.IOException
Specified by:
cleanupOnFailure in interface org.apache.pig.StoreFuncInterface
Overrides:
cleanupOnFailure in class org.apache.pig.StoreFunc
Throws:
java.io.IOException

storeStatistics

public void storeStatistics(org.apache.pig.ResourceStatistics stats,
                            java.lang.String arg1,
                            org.apache.hadoop.mapreduce.Job job)
                     throws java.io.IOException
Specified by:
storeStatistics in interface org.apache.pig.StoreMetadata
Throws:
java.io.IOException